rm dep. menu & optimize

This commit is contained in:
Junyuan Feng
2022-11-07 19:54:26 +08:00
parent bd04fd3f1a
commit 5b8468effa
9 changed files with 70 additions and 160 deletions

View File

@@ -354,7 +354,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 155; CURRENT_PROJECT_VERSION = 158;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -362,7 +362,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.155; MARKETING_VERSION = 1.0.158;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -484,7 +484,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 155; CURRENT_PROJECT_VERSION = 158;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -492,7 +492,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.155; MARKETING_VERSION = 1.0.158;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -508,7 +508,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 155; CURRENT_PROJECT_VERSION = 158;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -516,7 +516,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.155; MARKETING_VERSION = 1.0.158;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -115,11 +115,13 @@ Widget buildPopuopMenu(
return PopupMenuButton( return PopupMenuButton(
itemBuilder: (_) => items, itemBuilder: (_) => items,
onSelected: onSelected, onSelected: onSelected,
padding: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
child: const Padding( child: const Padding(
padding: EdgeInsets.only(left: 7), padding: EdgeInsets.only(left: 7),
child: Icon( child: Icon(
Icons.more_vert, Icons.more_vert,
size: 23, size: 21,
), ),
), ),
); );

View File

@@ -2,9 +2,9 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 156; static const int build = 158;
static const String engine = static const String engine =
"Flutter 3.3.4 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision eb6d86ee27 (4 weeks ago) • 2022-10-04 22:31:45 -0700\nEngine • revision c08d7d5efc\nTools • Dart 2.18.2 • DevTools 2.15.0\n"; "Flutter 3.3.4 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision eb6d86ee27 (5 weeks ago) • 2022-10-04 22:31:45 -0700\nEngine • revision c08d7d5efc\nTools • Dart 2.18.2 • DevTools 2.15.0\n";
static const String buildAt = "2022-11-05 23:02:53.614616"; static const String buildAt = "2022-11-07 19:16:17.058901";
static const int modifications = 20; static const int modifications = 0;
} }

View File

@@ -44,22 +44,20 @@ class _ConvertPageState extends State<ConvertPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return Scaffold( return Scaffold(
body: GestureDetector( body: SingleChildScrollView(
child: SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 7),
padding: const EdgeInsets.symmetric(horizontal: 7), controller: ScrollController(),
controller: ScrollController(), child: Column(children: [
child: Column(children: [ const SizedBox(height: 13),
const SizedBox(height: 13), _buildInputTop(),
_buildInputTop(), _buildTypeOption(),
_buildTypeOption(), _buildResult(),
_buildResult(), ])),
])),
onTap: () => FocusScope.of(context).requestFocus(FocusNode()),
),
floatingActionButton: FloatingActionButton( floatingActionButton: FloatingActionButton(
onPressed: () { onPressed: () {
try { try {
_textEditingControllerResult.text = doConvert(); _textEditingControllerResult.text = doConvert();
FocusScope.of(context).requestFocus(FocusNode());
} catch (e) { } catch (e) {
showSnackBar(context, Text('Error: \n$e')); showSnackBar(context, Text('Error: \n$e'));
} }
@@ -89,8 +87,7 @@ class _ConvertPageState extends State<ConvertPage>
Widget _buildInputTop() { Widget _buildInputTop() {
return SizedBox( return SizedBox(
height: _media.size.height * 0.33, height: _media.size.height * 0.33,
child: buildInput(context, _textEditingController, child: buildInput(context, _textEditingController),
onSubmitted: (_) => _textEditingControllerResult.text = doConvert()),
); );
} }
@@ -159,8 +156,8 @@ class _ConvertPageState extends State<ConvertPage>
title: Text( title: Text(
e, e,
style: TextStyle( style: TextStyle(
color: color: _theme.textTheme.bodyText2!.color!.withAlpha(177),
_theme.textTheme.bodyText2!.color!.withAlpha(177)), ),
), ),
trailing: _buildRadio(typeOption.indexOf(e)), trailing: _buildRadio(typeOption.indexOf(e)),
)) ))

View File

@@ -1,7 +1,6 @@
import 'package:after_layout/after_layout.dart'; import 'package:after_layout/after_layout.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_advanced_drawer/flutter_advanced_drawer.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';
import 'package:toolbox/core/analysis.dart'; import 'package:toolbox/core/analysis.dart';
import 'package:toolbox/core/build_mode.dart'; import 'package:toolbox/core/build_mode.dart';
@@ -46,7 +45,6 @@ class _MyHomePageState extends State<MyHomePage>
WidgetsBindingObserver { WidgetsBindingObserver {
late final ServerProvider _serverProvider; late final ServerProvider _serverProvider;
late final PageController _pageController; late final PageController _pageController;
late final AdvancedDrawerController _advancedDrawerController;
late int _selectIndex; late int _selectIndex;
late double _width; late double _width;
late S s; late S s;
@@ -58,7 +56,6 @@ class _MyHomePageState extends State<MyHomePage>
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
_selectIndex = locator<SettingStore>().launchPage.fetch()!; _selectIndex = locator<SettingStore>().launchPage.fetch()!;
_pageController = PageController(initialPage: _selectIndex); _pageController = PageController(initialPage: _selectIndex);
_advancedDrawerController = AdvancedDrawerController();
} }
@override @override
@@ -92,8 +89,9 @@ class _MyHomePageState extends State<MyHomePage>
return WillPopScope( return WillPopScope(
child: _buildMain(context), child: _buildMain(context),
onWillPop: () { onWillPop: () {
if (_advancedDrawerController.value.visible) { final scaffold = Scaffold.of(context);
_advancedDrawerController.hideDrawer(); if (scaffold.isDrawerOpen) {
scaffold.closeDrawer();
return Future.value(false); return Future.value(false);
} }
return Future.value(true); return Future.value(true);
@@ -101,63 +99,31 @@ class _MyHomePageState extends State<MyHomePage>
} }
Widget _buildMain(BuildContext context) { Widget _buildMain(BuildContext context) {
return AdvancedDrawer( return Scaffold(
controller: _advancedDrawerController, drawer: _buildDrawer(),
animationCurve: Curves.easeInOut, appBar: AppBar(
animationDuration: const Duration(milliseconds: 300), title: Text(tabTitleName(context, _selectIndex), style: size18),
animateChildDecoration: true, actions: [
rtlOpening: false, IconButton(
childDecoration: const BoxDecoration( icon: const Icon(Icons.developer_mode, size: 23),
// NOTICE: Uncomment if you want to add shadow behind the page. tooltip: s.debug,
// Keep in mind that it may cause animation jerks. onPressed: () =>
// boxShadow: <BoxShadow>[ AppRoute(const DebugPage(), 'Debug Page').go(context),
// BoxShadow(
// color: Colors.black12,
// blurRadius: 0.0,
// ),
// ],
borderRadius: BorderRadius.all(Radius.circular(16)),
),
drawer: _buildDrawer(),
child: Scaffold(
appBar: AppBar(
title: Text(tabTitleName(context, _selectIndex), style: size18),
actions: [
IconButton(
icon: const Icon(Icons.developer_mode, size: 23),
tooltip: s.debug,
onPressed: () =>
AppRoute(const DebugPage(), 'Debug Page').go(context),
),
],
leading: IconButton(
onPressed: () => _advancedDrawerController.showDrawer(),
icon: ValueListenableBuilder<AdvancedDrawerValue>(
valueListenable: _advancedDrawerController,
builder: (_, value, __) {
return AnimatedSwitcher(
duration: const Duration(milliseconds: 250),
child: Icon(
value.visible ? Icons.clear : Icons.menu,
key: ValueKey<bool>(value.visible),
),
);
},
),
),
), ),
body: PageView( ],
physics: const ClampingScrollPhysics(), ),
controller: _pageController, body: PageView(
onPageChanged: (i) { physics: const ClampingScrollPhysics(),
FocusScope.of(context).unfocus(); controller: _pageController,
_selectIndex = i; onPageChanged: (i) {
setState(() {}); FocusScope.of(context).unfocus();
}, _selectIndex = i;
children: const [ServerPage(), ConvertPage(), PingPage()], setState(() {});
), },
bottomNavigationBar: _buildBottom(context), children: const [ServerPage(), ConvertPage(), PingPage()],
)); ),
bottomNavigationBar: _buildBottom(context),
);
} }
Widget _buildItem(int idx, NavigationItem item, bool isSelected) { Widget _buildItem(int idx, NavigationItem item, bool isSelected) {
@@ -208,7 +174,7 @@ class _MyHomePageState extends State<MyHomePage>
} }
Widget _buildDrawer() { Widget _buildDrawer() {
return SafeArea( return Drawer(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [

View File

@@ -44,14 +44,12 @@ class _PingPageState extends State<PingPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return Scaffold( return Scaffold(
body: GestureDetector( body: SingleChildScrollView(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 7), padding: const EdgeInsets.symmetric(horizontal: 7),
child: Column(children: [ child: Column(children: [
const SizedBox(height: 13), const SizedBox(height: 13),
buildInput(context, _textEditingController, buildInput(context, _textEditingController,
maxLines: 1, onSubmitted: (_) => doPing()), maxLines: 1, onSubmitted: (_) => doPing()),
_buildControl(),
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: _media.size.height * 0.6, height: _media.size.height * 0.6,
@@ -64,7 +62,15 @@ class _PingPageState extends State<PingPage>
}), }),
), ),
])), ])),
onTap: () => FocusScope.of(context).requestFocus(FocusNode()), floatingActionButton: FloatingActionButton(
child: const Icon(Icons.play_arrow),
onPressed: () {
try {
doPing();
} catch (e) {
showSnackBar(context, Text('Error: \n$e'));
}
},
), ),
); );
} }
@@ -122,59 +128,6 @@ class _PingPageState extends State<PingPage>
})); }));
} }
Widget _buildControl() {
return SizedBox(
height: 57,
child: RoundRectCard(
InkWell(
onTap: () => FocusScope.of(context).unfocus(),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(primaryColor)),
child: Row(
children: [
const Icon(Icons.delete),
const SizedBox(
width: 7,
),
Text(s.clear)
],
),
onPressed: () {
_results.clear();
setState(() {});
},
),
TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(primaryColor)),
child: Row(
children: [
const Icon(Icons.play_arrow),
const SizedBox(
width: 7,
),
Text(s.start)
],
),
onPressed: () {
try {
doPing();
} catch (e) {
showSnackBar(context, Text('Error: \n$e'));
}
},
)
],
),
),
),
);
}
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }

View File

@@ -420,14 +420,14 @@
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 155; CURRENT_PROJECT_VERSION = 158;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MARKETING_VERSION = 1.0.155; MARKETING_VERSION = 1.0.158;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
@@ -550,14 +550,14 @@
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 155; CURRENT_PROJECT_VERSION = 158;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MARKETING_VERSION = 1.0.155; MARKETING_VERSION = 1.0.158;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -574,14 +574,14 @@
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 155; CURRENT_PROJECT_VERSION = 158;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/../Frameworks", "@executable_path/../Frameworks",
); );
MARKETING_VERSION = 1.0.155; MARKETING_VERSION = 1.0.158;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;

View File

@@ -262,13 +262,6 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_advanced_drawer:
dependency: "direct main"
description:
name: flutter_advanced_drawer
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.2"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:

View File

@@ -51,7 +51,6 @@ dependencies:
ref: main ref: main
# path: ../circle_chart # path: ../circle_chart
r_upgrade: ^0.3.6 r_upgrade: ^0.3.6
flutter_advanced_drawer: ^1.3.0
path_provider: ^2.0.9 path_provider: ^2.0.9
easy_isolate: ^1.3.0 easy_isolate: ^1.3.0
share_plus: ^4.0.4 share_plus: ^4.0.4