mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
Optimized view logic
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ToolBox";
|
||||
static const int build = 54;
|
||||
static const String engine = "Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 18116933e7 (2 weeks ago) • 2021-10-15 10:46:35 -0700\nEngine • revision d3ea636dc5\nTools • Dart 2.14.4\n";
|
||||
static const String buildAt = "2021-11-01 22:19:44.302306";
|
||||
static const int modifications = 0;
|
||||
static const int build = 55;
|
||||
static const String engine =
|
||||
"Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 18116933e7 (3 weeks ago) • 2021-10-15 10:46:35 -0700\nEngine • revision d3ea636dc5\nTools • Dart 2.14.4\n";
|
||||
static const String buildAt = "2021-11-02 15:32:29.280614";
|
||||
static const int modifications = 1;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:toolbox/core/route.dart';
|
||||
import 'package:toolbox/data/model/server/net_speed.dart';
|
||||
import 'package:toolbox/data/model/server/server.dart';
|
||||
import 'package:toolbox/data/model/server/server_status.dart';
|
||||
import 'package:toolbox/data/provider/server.dart';
|
||||
import 'package:toolbox/data/res/color.dart';
|
||||
import 'package:toolbox/data/res/icon/linux_icons.dart';
|
||||
import 'package:toolbox/view/page/server/edit.dart';
|
||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||
|
||||
const style11 = TextStyle(fontSize: 11);
|
||||
@@ -23,13 +25,11 @@ class ServerDetailPage extends StatefulWidget {
|
||||
class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late MediaQueryData _media;
|
||||
late ThemeData _theme;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
_media = MediaQuery.of(context);
|
||||
_theme = Theme.of(context);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -44,6 +44,12 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(si.info.name),
|
||||
actions: [IconButton(onPressed: () => AppRoute(
|
||||
ServerEditPage(
|
||||
spi: si.info,
|
||||
),
|
||||
'Edit server info page')
|
||||
.go(context), icon: const Icon(Icons.edit))],
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(17),
|
||||
@@ -274,7 +280,12 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
}
|
||||
|
||||
Widget _buildNetView(NetSpeed ns) {
|
||||
final children = <Widget>[_buildNetSpeedTop(), const Divider(height: 7,)];
|
||||
final children = <Widget>[
|
||||
_buildNetSpeedTop(),
|
||||
const Divider(
|
||||
height: 7,
|
||||
)
|
||||
];
|
||||
children.addAll(ns.devices.map((e) => _buildNetSpeedItem(ns, e)));
|
||||
return RoundRectCard(Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 7),
|
||||
@@ -290,7 +301,10 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: const [
|
||||
Icon(Icons.device_hub, size: 17,),
|
||||
Icon(
|
||||
Icons.device_hub,
|
||||
size: 17,
|
||||
),
|
||||
Icon(Icons.arrow_upward, size: 17),
|
||||
Icon(Icons.arrow_downward, size: 17)
|
||||
],
|
||||
|
||||
@@ -49,8 +49,25 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||
widget.spi != null
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
_serverProvider.delServer(widget.spi!);
|
||||
Navigator.of(context).pop();
|
||||
showRoundDialog(
|
||||
context,
|
||||
'Attention',
|
||||
Text(
|
||||
'Are you sure to delete server [${widget.spi!.name}]'),
|
||||
[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
_serverProvider.delServer(widget.spi!);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text(
|
||||
'Yes',
|
||||
style: TextStyle(color: Colors.red),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('No'))
|
||||
]);
|
||||
},
|
||||
icon: const Icon(Icons.delete))
|
||||
: const SizedBox()
|
||||
|
||||
@@ -88,21 +88,14 @@ class _ServerPageState extends State<ServerPage>
|
||||
}
|
||||
|
||||
Widget _buildEachServerCard(ServerInfo si) {
|
||||
return GestureDetector(
|
||||
child: _buildEachCardContent(si),
|
||||
onLongPress: () {
|
||||
AppRoute(
|
||||
return Card(
|
||||
child: InkWell(
|
||||
onLongPress: () => AppRoute(
|
||||
ServerEditPage(
|
||||
spi: si.info,
|
||||
),
|
||||
'Edit server info page')
|
||||
.go(context);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildEachCardContent(ServerInfo si) {
|
||||
return Card(
|
||||
child: InkWell(
|
||||
.go(context),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(13),
|
||||
child:
|
||||
|
||||
Reference in New Issue
Block a user