mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
optimization: desktop UI (#747)
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:dartssh2/dartssh2.dart';
|
||||
import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:server_box/core/extension/context/locale.dart';
|
||||
import 'package:server_box/core/route.dart';
|
||||
import 'package:server_box/data/res/store.dart';
|
||||
|
||||
import 'package:server_box/data/model/app/shell_func.dart';
|
||||
@@ -12,11 +13,17 @@ import 'package:server_box/data/model/server/server_private_info.dart';
|
||||
import 'package:server_box/view/widget/two_line_text.dart';
|
||||
|
||||
class ProcessPage extends StatefulWidget {
|
||||
final Spi spi;
|
||||
const ProcessPage({super.key, required this.spi});
|
||||
final SpiRequiredArgs args;
|
||||
|
||||
const ProcessPage({super.key, required this.args});
|
||||
|
||||
@override
|
||||
State<ProcessPage> createState() => _ProcessPageState();
|
||||
|
||||
static const route = AppRouteArg(
|
||||
page: ProcessPage.new,
|
||||
path: '/process',
|
||||
);
|
||||
}
|
||||
|
||||
class _ProcessPageState extends State<ProcessPage> {
|
||||
@@ -43,7 +50,7 @@ class _ProcessPageState extends State<ProcessPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_client = widget.spi.server?.value.client;
|
||||
_client = widget.args.spi.server?.value.client;
|
||||
final duration =
|
||||
Duration(seconds: Stores.setting.serverStatusUpdateInterval.fetch());
|
||||
_timer = Timer.periodic(duration, (_) => _refresh());
|
||||
@@ -58,7 +65,7 @@ class _ProcessPageState extends State<ProcessPage> {
|
||||
Future<void> _refresh() async {
|
||||
if (mounted) {
|
||||
final result =
|
||||
await _client?.run(ShellFunc.process.exec(widget.spi.id)).string;
|
||||
await _client?.run(ShellFunc.process.exec(widget.args.spi.id)).string;
|
||||
if (result == null || result.isEmpty) {
|
||||
context.showSnackBar(libL10n.empty);
|
||||
return;
|
||||
@@ -125,7 +132,7 @@ class _ProcessPageState extends State<ProcessPage> {
|
||||
return Scaffold(
|
||||
appBar: CustomAppBar(
|
||||
centerTitle: true,
|
||||
title: TwoLineText(up: widget.spi.name, down: l10n.process),
|
||||
title: TwoLineText(up: widget.args.spi.name, down: l10n.process),
|
||||
actions: actions,
|
||||
),
|
||||
body: child,
|
||||
|
||||
Reference in New Issue
Block a user