mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 23:34:24 +01:00
Improve.
This commit is contained in:
@@ -11,13 +11,14 @@ class MenuItem {
|
||||
}
|
||||
|
||||
class MenuItems {
|
||||
static const List<MenuItem> firstItems = [sftp, snippet, apt];
|
||||
static const List<MenuItem> firstItems = [ssh, sftp, snippet, apt];
|
||||
static const List<MenuItem> secondItems = [edit];
|
||||
|
||||
static const ssh = MenuItem(text: 'SSH', icon: Icons.link);
|
||||
static const sftp = MenuItem(text: 'SFTP', icon: Icons.file_present);
|
||||
static const snippet = MenuItem(text: 'Snippet', icon: Icons.label);
|
||||
static const apt = MenuItem(text: 'Apt', icon: Icons.system_security_update);
|
||||
static const edit = MenuItem(text: 'Edit', icon: Icons.settings);
|
||||
static const edit = MenuItem(text: 'Edit', icon: Icons.edit);
|
||||
|
||||
static Widget buildItem(MenuItem item) {
|
||||
return Row(
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 95;
|
||||
static const int build = 97;
|
||||
static const String engine =
|
||||
"Flutter 2.10.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 5f105a6ca7 (7 days ago) • 2022-02-01 14:15:42 -0800\nEngine • revision 776efd2034\nTools • Dart 2.16.0 • DevTools 2.9.2\n";
|
||||
static const String buildAt = "2022-02-08 21:30:51.218738";
|
||||
static const int modifications = 3;
|
||||
static const String buildAt = "2022-02-09 10:58:45.586008";
|
||||
static const int modifications = 8;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:toolbox/data/model/app/navigation_item.dart';
|
||||
|
||||
final List<String> tabs = ['Servers', 'En/Decode', 'Ping'];
|
||||
final List<NavigationItem> tabItems = [
|
||||
NavigationItem(Icons.computer, 'Server'),
|
||||
NavigationItem(Icons.cloud, 'Server'),
|
||||
NavigationItem(Icons.code, 'Convert'),
|
||||
NavigationItem(Icons.network_check, 'Ping'),
|
||||
NavigationItem(Icons.leak_add, 'Ping'),
|
||||
];
|
||||
|
||||
@@ -213,39 +213,48 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.07,
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.settings),
|
||||
title: const Text('Setting'),
|
||||
onTap: () => AppRoute(const SettingPage(), 'Setting').go(context),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.vpn_key),
|
||||
title: const Text('Private Key'),
|
||||
onTap: () =>
|
||||
AppRoute(const StoredPrivateKeysPage(), 'private key list')
|
||||
.go(context),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.snippet_folder),
|
||||
title: const Text('Snippet'),
|
||||
onTap: () =>
|
||||
AppRoute(const SnippetListPage(), 'snippet list').go(context),
|
||||
),
|
||||
AboutListTile(
|
||||
icon: const Icon(Icons.text_snippet),
|
||||
child: const Text('Licences'),
|
||||
applicationName: BuildData.name,
|
||||
applicationVersion: _buildVersionStr(),
|
||||
applicationIcon: _buildIcon(),
|
||||
aboutBoxChildren: const [
|
||||
UrlText(
|
||||
text: '\nMade with ❤️ by $myGithub', replace: 'LollipopKit'),
|
||||
UrlText(
|
||||
text:
|
||||
'\nThanks $rainSunMeGithub for participating in the test.\n\nAll rights reserved.',
|
||||
replace: 'RainSunMe',
|
||||
),
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 29),
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.settings),
|
||||
title: const Text('Setting'),
|
||||
onTap: () =>
|
||||
AppRoute(const SettingPage(), 'Setting').go(context),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.vpn_key),
|
||||
title: const Text('Private Key'),
|
||||
onTap: () => AppRoute(
|
||||
const StoredPrivateKeysPage(), 'private key list')
|
||||
.go(context),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.snippet_folder),
|
||||
title: const Text('Snippet'),
|
||||
onTap: () => AppRoute(const SnippetListPage(), 'snippet list')
|
||||
.go(context),
|
||||
),
|
||||
AboutListTile(
|
||||
icon: const Icon(Icons.text_snippet),
|
||||
child: const Text('Licences'),
|
||||
applicationName: BuildData.name,
|
||||
applicationVersion: _buildVersionStr(),
|
||||
applicationIcon: _buildIcon(),
|
||||
aboutBoxChildren: const [
|
||||
UrlText(
|
||||
text: '\nMade with ❤️ by $myGithub',
|
||||
replace: 'LollipopKit'),
|
||||
UrlText(
|
||||
text:
|
||||
'\nThanks $rainSunMeGithub for participating in the test.\n\nAll rights reserved.',
|
||||
replace: 'RainSunMe',
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -18,15 +18,13 @@ class PingPage extends StatefulWidget {
|
||||
class _PingPageState extends State<PingPage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
late TextEditingController _textEditingController;
|
||||
late TextEditingController _textEditingControllerResult;
|
||||
late String _result;
|
||||
String _result = '';
|
||||
Ping? _ping;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_textEditingController = TextEditingController(text: '');
|
||||
_textEditingControllerResult = TextEditingController(text: '');
|
||||
if (Platform.isIOS) {
|
||||
DartPingIOS.register();
|
||||
}
|
||||
@@ -48,7 +46,12 @@ class _PingPageState extends State<PingPage>
|
||||
const SizedBox(height: 13),
|
||||
buildInput(context, _textEditingController, maxLines: 1),
|
||||
_buildControl(),
|
||||
buildInput(context, _textEditingControllerResult),
|
||||
RoundRectCard(
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Padding(padding: const EdgeInsets.all(7), child: Text(_result)),
|
||||
),
|
||||
),
|
||||
])),
|
||||
onTap: () => FocusScope.of(context).requestFocus(FocusNode()),
|
||||
),
|
||||
@@ -62,7 +65,7 @@ class _PingPageState extends State<PingPage>
|
||||
final resp = event.response.toString();
|
||||
if (resp == 'null') return;
|
||||
_result += '$resp\n';
|
||||
_textEditingControllerResult.text = _result;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -175,70 +175,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
style: style),
|
||||
)
|
||||
: Text(topRightStr, style: style, textScaleFactor: 1.0),
|
||||
DropdownButtonHideUnderline(
|
||||
child: DropdownButton2(
|
||||
customButton: const Padding(
|
||||
padding: EdgeInsets.only(left: 7),
|
||||
child: Icon(
|
||||
Icons.more_vert,
|
||||
size: 17,
|
||||
),
|
||||
),
|
||||
customItemsIndexes: const [3],
|
||||
customItemsHeight: 8,
|
||||
items: [
|
||||
...MenuItems.firstItems.map(
|
||||
(item) => DropdownMenuItem<MenuItem>(
|
||||
value: item,
|
||||
child: MenuItems.buildItem(item),
|
||||
),
|
||||
),
|
||||
const DropdownMenuItem<Divider>(
|
||||
enabled: false, child: Divider()),
|
||||
...MenuItems.secondItems.map(
|
||||
(item) => DropdownMenuItem<MenuItem>(
|
||||
value: item,
|
||||
child: MenuItems.buildItem(item),
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
final item = value as MenuItem;
|
||||
switch (item) {
|
||||
case MenuItems.apt:
|
||||
case MenuItems.sftp:
|
||||
showSnackBar(
|
||||
context, const Text('Now is not supported'));
|
||||
break;
|
||||
case MenuItems.snippet:
|
||||
AppRoute(
|
||||
SnippetListPage(
|
||||
spi: spi,
|
||||
),
|
||||
'snippet list')
|
||||
.go(context);
|
||||
break;
|
||||
case MenuItems.edit:
|
||||
AppRoute(
|
||||
ServerEditPage(
|
||||
spi: spi,
|
||||
),
|
||||
'Edit server info page')
|
||||
.go(context);
|
||||
break;
|
||||
}
|
||||
},
|
||||
itemHeight: 37,
|
||||
itemPadding: const EdgeInsets.only(left: 17, right: 17),
|
||||
dropdownWidth: 160,
|
||||
dropdownPadding: const EdgeInsets.symmetric(vertical: 7),
|
||||
dropdownDecoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
dropdownElevation: 8,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
),
|
||||
_buildMoreBtn(spi),
|
||||
],
|
||||
)
|
||||
],
|
||||
@@ -272,6 +209,72 @@ class _ServerPageState extends State<ServerPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMoreBtn(ServerPrivateInfo spi) {
|
||||
return DropdownButtonHideUnderline(
|
||||
child: DropdownButton2(
|
||||
customButton: const Padding(
|
||||
padding: EdgeInsets.only(left: 7),
|
||||
child: Icon(
|
||||
Icons.more_vert,
|
||||
size: 17,
|
||||
),
|
||||
),
|
||||
customItemsIndexes: [MenuItems.firstItems.length],
|
||||
customItemsHeight: 8,
|
||||
items: [
|
||||
...MenuItems.firstItems.map(
|
||||
(item) => DropdownMenuItem<MenuItem>(
|
||||
value: item,
|
||||
child: MenuItems.buildItem(item),
|
||||
),
|
||||
),
|
||||
const DropdownMenuItem<Divider>(enabled: false, child: Divider()),
|
||||
...MenuItems.secondItems.map(
|
||||
(item) => DropdownMenuItem<MenuItem>(
|
||||
value: item,
|
||||
child: MenuItems.buildItem(item),
|
||||
),
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
final item = value as MenuItem;
|
||||
switch (item) {
|
||||
case MenuItems.ssh:
|
||||
case MenuItems.apt:
|
||||
case MenuItems.sftp:
|
||||
showSnackBar(context, const Text('Now is not supported'));
|
||||
break;
|
||||
case MenuItems.snippet:
|
||||
AppRoute(
|
||||
SnippetListPage(
|
||||
spi: spi,
|
||||
),
|
||||
'snippet list')
|
||||
.go(context);
|
||||
break;
|
||||
case MenuItems.edit:
|
||||
AppRoute(
|
||||
ServerEditPage(
|
||||
spi: spi,
|
||||
),
|
||||
'Edit server info page')
|
||||
.go(context);
|
||||
break;
|
||||
}
|
||||
},
|
||||
itemHeight: 37,
|
||||
itemPadding: const EdgeInsets.only(left: 17, right: 17),
|
||||
dropdownWidth: 160,
|
||||
dropdownPadding: const EdgeInsets.symmetric(vertical: 7),
|
||||
dropdownDecoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
dropdownElevation: 8,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildExplainText(String text) {
|
||||
return SizedBox(
|
||||
width: _media.size.width * 0.2,
|
||||
|
||||
Reference in New Issue
Block a user