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 {
|
class BuildData {
|
||||||
static const String name = "ToolBox";
|
static const String name = "ToolBox";
|
||||||
static const int build = 54;
|
static const int build = 55;
|
||||||
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 engine =
|
||||||
static const String buildAt = "2021-11-01 22:19:44.302306";
|
"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 int modifications = 0;
|
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:flutter/material.dart';
|
||||||
import 'package:provider/provider.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/net_speed.dart';
|
||||||
import 'package:toolbox/data/model/server/server.dart';
|
import 'package:toolbox/data/model/server/server.dart';
|
||||||
import 'package:toolbox/data/model/server/server_status.dart';
|
import 'package:toolbox/data/model/server/server_status.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
import 'package:toolbox/data/res/icon/linux_icons.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';
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
const style11 = TextStyle(fontSize: 11);
|
const style11 = TextStyle(fontSize: 11);
|
||||||
@@ -23,13 +25,11 @@ class ServerDetailPage extends StatefulWidget {
|
|||||||
class _ServerDetailPageState extends State<ServerDetailPage>
|
class _ServerDetailPageState extends State<ServerDetailPage>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
late ThemeData _theme;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
_media = MediaQuery.of(context);
|
_media = MediaQuery.of(context);
|
||||||
_theme = Theme.of(context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -44,6 +44,12 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(si.info.name),
|
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(
|
body: ListView(
|
||||||
padding: const EdgeInsets.all(17),
|
padding: const EdgeInsets.all(17),
|
||||||
@@ -274,7 +280,12 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildNetView(NetSpeed ns) {
|
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)));
|
children.addAll(ns.devices.map((e) => _buildNetSpeedItem(ns, e)));
|
||||||
return RoundRectCard(Padding(
|
return RoundRectCard(Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 7),
|
padding: const EdgeInsets.symmetric(vertical: 7),
|
||||||
@@ -290,7 +301,10 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: const [
|
children: const [
|
||||||
Icon(Icons.device_hub, size: 17,),
|
Icon(
|
||||||
|
Icons.device_hub,
|
||||||
|
size: 17,
|
||||||
|
),
|
||||||
Icon(Icons.arrow_upward, size: 17),
|
Icon(Icons.arrow_upward, size: 17),
|
||||||
Icon(Icons.arrow_downward, size: 17)
|
Icon(Icons.arrow_downward, size: 17)
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -48,10 +48,27 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
appBar: AppBar(title: const Text('Edit'), actions: [
|
appBar: AppBar(title: const Text('Edit'), actions: [
|
||||||
widget.spi != null
|
widget.spi != null
|
||||||
? IconButton(
|
? IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
showRoundDialog(
|
||||||
|
context,
|
||||||
|
'Attention',
|
||||||
|
Text(
|
||||||
|
'Are you sure to delete server [${widget.spi!.name}]'),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_serverProvider.delServer(widget.spi!);
|
_serverProvider.delServer(widget.spi!);
|
||||||
Navigator.of(context).pop();
|
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))
|
icon: const Icon(Icons.delete))
|
||||||
: const SizedBox()
|
: const SizedBox()
|
||||||
]),
|
]),
|
||||||
|
|||||||
@@ -88,21 +88,14 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildEachServerCard(ServerInfo si) {
|
Widget _buildEachServerCard(ServerInfo si) {
|
||||||
return GestureDetector(
|
return Card(
|
||||||
child: _buildEachCardContent(si),
|
child: InkWell(
|
||||||
onLongPress: () {
|
onLongPress: () => AppRoute(
|
||||||
AppRoute(
|
|
||||||
ServerEditPage(
|
ServerEditPage(
|
||||||
spi: si.info,
|
spi: si.info,
|
||||||
),
|
),
|
||||||
'Edit server info page')
|
'Edit server info page')
|
||||||
.go(context);
|
.go(context),
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildEachCardContent(ServerInfo si) {
|
|
||||||
return Card(
|
|
||||||
child: InkWell(
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(13),
|
padding: const EdgeInsets.all(13),
|
||||||
child:
|
child:
|
||||||
|
|||||||
Reference in New Issue
Block a user