optimize ping page & make.dart

This commit is contained in:
Junyuan Feng
2022-11-07 20:15:39 +08:00
parent 5b8468effa
commit bfd31e561c
10 changed files with 78 additions and 43 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 = 158; CURRENT_PROJECT_VERSION = 159;
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.158; MARKETING_VERSION = 1.0.159;
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 = 158; CURRENT_PROJECT_VERSION = 159;
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.158; MARKETING_VERSION = 1.0.159;
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 = 158; CURRENT_PROJECT_VERSION = 159;
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.158; MARKETING_VERSION = 1.0.159;
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

@@ -2,9 +2,9 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 158; static const int build = 159;
static const String engine = static const String engine =
"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"; "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-07 19:16:17.058901"; static const String buildAt = "2022-11-07 19:55:21.553007";
static const int modifications = 0; static const int modifications = 0;
} }

View File

@@ -122,6 +122,8 @@ class MessageLookup extends MessageLookupByLibrary {
"import": MessageLookupByLibrary.simpleMessage("Import"), "import": MessageLookupByLibrary.simpleMessage("Import"),
"importAndExport": "importAndExport":
MessageLookupByLibrary.simpleMessage("Import and Export"), MessageLookupByLibrary.simpleMessage("Import and Export"),
"inputDomainHere":
MessageLookupByLibrary.simpleMessage("Input Domain here"),
"install": MessageLookupByLibrary.simpleMessage("install"), "install": MessageLookupByLibrary.simpleMessage("install"),
"installDockerWithUrl": MessageLookupByLibrary.simpleMessage( "installDockerWithUrl": MessageLookupByLibrary.simpleMessage(
"Please https://docs.docker.com/engine/install docker first."), "Please https://docs.docker.com/engine/install docker first."),

View File

@@ -111,6 +111,7 @@ class MessageLookup extends MessageLookupByLibrary {
"httpFailedWithCode": m5, "httpFailedWithCode": m5,
"import": MessageLookupByLibrary.simpleMessage("导入"), "import": MessageLookupByLibrary.simpleMessage("导入"),
"importAndExport": MessageLookupByLibrary.simpleMessage("导入或导出"), "importAndExport": MessageLookupByLibrary.simpleMessage("导入或导出"),
"inputDomainHere": MessageLookupByLibrary.simpleMessage("在这里输入域名"),
"install": MessageLookupByLibrary.simpleMessage("安装"), "install": MessageLookupByLibrary.simpleMessage("安装"),
"installDockerWithUrl": MessageLookupByLibrary.simpleMessage( "installDockerWithUrl": MessageLookupByLibrary.simpleMessage(
"请先 https://docs.docker.com/engine/install docker"), "请先 https://docs.docker.com/engine/install docker"),

View File

@@ -1340,6 +1340,16 @@ class S {
args: [], args: [],
); );
} }
/// `Input Domain here`
String get inputDomainHere {
return Intl.message(
'Input Domain here',
name: 'inputDomainHere',
desc: '',
args: [],
);
}
} }
class AppLocalizationDelegate extends LocalizationsDelegate<S> { class AppLocalizationDelegate extends LocalizationsDelegate<S> {

View File

@@ -127,5 +127,6 @@
"clickSee": "Click here", "clickSee": "Click here",
"feedback": "Feedback", "feedback": "Feedback",
"feedbackOnGithub": "If you have any questions, please feedback on Github.", "feedbackOnGithub": "If you have any questions, please feedback on Github.",
"update": "Update" "update": "Update",
"inputDomainHere": "Input Domain here"
} }

View File

@@ -127,5 +127,6 @@
"clickSee": "点击查看", "clickSee": "点击查看",
"feedback": "反馈", "feedback": "反馈",
"feedbackOnGithub": "如果你有任何问题请在GitHub反馈", "feedbackOnGithub": "如果你有任何问题请在GitHub反馈",
"update": "更新" "update": "更新",
"inputDomainHere": "在这里输入域名"
} }

View File

@@ -9,6 +9,12 @@ import 'package:toolbox/locator.dart';
import 'package:toolbox/view/widget/input_field.dart'; import 'package:toolbox/view/widget/input_field.dart';
import 'package:toolbox/view/widget/round_rect_card.dart'; import 'package:toolbox/view/widget/round_rect_card.dart';
final doaminReg =
RegExp(r'^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$');
final ipv4Reg =
RegExp(r'^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])(\.(?!$)|$)){4}$');
final ipv6Reg = RegExp(r'^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$');
class PingPage extends StatefulWidget { class PingPage extends StatefulWidget {
const PingPage({Key? key}) : super(key: key); const PingPage({Key? key}) : super(key: key);
@@ -49,7 +55,9 @@ class _PingPageState extends State<PingPage>
child: Column(children: [ child: Column(children: [
const SizedBox(height: 13), const SizedBox(height: 13),
buildInput(context, _textEditingController, buildInput(context, _textEditingController,
maxLines: 1, onSubmitted: (_) => doPing()), hint: s.inputDomainHere,
maxLines: 1,
onSubmitted: (_) => doPing()),
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
height: _media.size.height * 0.6, height: _media.size.height * 0.6,
@@ -118,6 +126,14 @@ class _PingPageState extends State<PingPage>
return; return;
} }
if (!doaminReg.hasMatch(target) &&
!ipv4Reg.hasMatch(target) &&
!ipv6Reg.hasMatch(target)) {
showSnackBar(context, Text(s.pingInputIP));
return;
}
try {
await Future.wait(_serverProvider.servers.map((e) async { await Future.wait(_serverProvider.servers.map((e) async {
if (e.client == null) { if (e.client == null) {
return; return;
@@ -126,6 +142,9 @@ class _PingPageState extends State<PingPage>
_results.add(PingResult.parse(e.info.name, result)); _results.add(PingResult.parse(e.info.name, result));
setState(() {}); setState(() {});
})); }));
} catch (e) {
showSnackBar(context, Text(e.toString()));
}
} }
@override @override

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 = 158; CURRENT_PROJECT_VERSION = 159;
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.158; MARKETING_VERSION = 1.0.159;
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 = 158; CURRENT_PROJECT_VERSION = 159;
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.158; MARKETING_VERSION = 1.0.159;
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 = 158; CURRENT_PROJECT_VERSION = 159;
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.158; MARKETING_VERSION = 1.0.159;
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

@@ -104,8 +104,9 @@ Future<void> flutterBuild(
buildType, buildType,
]; ];
// No sksl cache for macos // No sksl cache for macos
if ('macos' != buildType) { final skslPath = '$buildType$skslFileSuffix';
args.add('--bundle-sksl-path=$buildType$skslFileSuffix'); if (await File(skslPath).exists()) {
args.add('--bundle-sksl-path=$skslPath');
} }
final isAndroid = 'apk' == buildType; final isAndroid = 'apk' == buildType;
// [--target-platform] only for Android // [--target-platform] only for Android