new: license dialog

This commit is contained in:
lollipopkit
2023-04-18 22:37:19 +08:00
parent f903a1da55
commit 216d64e3eb
9 changed files with 105 additions and 85 deletions

View File

@@ -612,7 +612,7 @@ abstract class S {
/// No description provided for @madeWithLove. /// No description provided for @madeWithLove.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'\nMade with ❤️ by {myGithub}'** /// **'Made with ❤️ by {myGithub}'**
String madeWithLove(Object myGithub); String madeWithLove(Object myGithub);
/// No description provided for @max. /// No description provided for @max.

View File

@@ -284,7 +284,7 @@ class SEn extends S {
@override @override
String madeWithLove(Object myGithub) { String madeWithLove(Object myGithub) {
return '\nMade with ❤️ by $myGithub'; return 'Made with ❤️ by $myGithub';
} }
@override @override

View File

@@ -284,7 +284,7 @@ class SZh extends S {
@override @override
String madeWithLove(Object myGithub) { String madeWithLove(Object myGithub) {
return '\n用❤️制作 by $myGithub'; return '用❤️制作 by $myGithub';
} }
@override @override

View File

@@ -359,7 +359,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 262; CURRENT_PROJECT_VERSION = 263;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -367,7 +367,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.262; MARKETING_VERSION = 1.0.263;
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";
@@ -490,7 +490,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 262; CURRENT_PROJECT_VERSION = 263;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -498,7 +498,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.262; MARKETING_VERSION = 1.0.263;
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";
@@ -515,7 +515,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 262; CURRENT_PROJECT_VERSION = 263;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -523,7 +523,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.262; MARKETING_VERSION = 1.0.263;
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

@@ -30,94 +30,97 @@ import 'dart:convert';
import '/core/utils/platform.dart'; import '/core/utils/platform.dart';
class AppUpdate { class AppUpdate {
AppUpdate({ AppUpdate({
required this.changelog, required this.changelog,
required this.build, required this.build,
required this.url, required this.url,
}); });
final AppUpdatePlatformSpecific<String> changelog; final AppUpdatePlatformSpecific<String> changelog;
final Build build; final Build build;
final AppUpdatePlatformSpecific<String> url; final AppUpdatePlatformSpecific<String> url;
factory AppUpdate.fromRawJson(String str) => AppUpdate.fromJson(json.decode(str)); factory AppUpdate.fromRawJson(String str) =>
AppUpdate.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory AppUpdate.fromJson(Map<String, dynamic> json) => AppUpdate( factory AppUpdate.fromJson(Map<String, dynamic> json) => AppUpdate(
changelog: AppUpdatePlatformSpecific.fromJson(json["changelog"]), changelog: AppUpdatePlatformSpecific.fromJson(json["changelog"]),
build: Build.fromJson(json["build"]), build: Build.fromJson(json["build"]),
url: AppUpdatePlatformSpecific.fromJson(json["url"]), url: AppUpdatePlatformSpecific.fromJson(json["url"]),
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"changelog": changelog.toJson(), "changelog": changelog.toJson(),
"build": build.toJson(), "build": build.toJson(),
"url": url.toJson(), "url": url.toJson(),
}; };
} }
class Build { class Build {
Build({ Build({
required this.min, required this.min,
required this.last, required this.last,
}); });
final AppUpdatePlatformSpecific<int> min; final AppUpdatePlatformSpecific<int> min;
final AppUpdatePlatformSpecific<int> last; final AppUpdatePlatformSpecific<int> last;
factory Build.fromRawJson(String str) => Build.fromJson(json.decode(str)); factory Build.fromRawJson(String str) => Build.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory Build.fromJson(Map<String, dynamic> json) => Build( factory Build.fromJson(Map<String, dynamic> json) => Build(
min: AppUpdatePlatformSpecific.fromJson(json["min"]), min: AppUpdatePlatformSpecific.fromJson(json["min"]),
last: AppUpdatePlatformSpecific.fromJson(json["last"]), last: AppUpdatePlatformSpecific.fromJson(json["last"]),
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"min": min.toJson(), "min": min.toJson(),
"last": last.toJson(), "last": last.toJson(),
}; };
} }
class AppUpdatePlatformSpecific<T> { class AppUpdatePlatformSpecific<T> {
AppUpdatePlatformSpecific({ AppUpdatePlatformSpecific({
required this.mac, required this.mac,
required this.ios, required this.ios,
required this.android, required this.android,
}); });
final T mac; final T mac;
final T ios; final T ios;
final T android; final T android;
factory AppUpdatePlatformSpecific.fromRawJson(String str) => AppUpdatePlatformSpecific.fromJson(json.decode(str)); factory AppUpdatePlatformSpecific.fromRawJson(String str) =>
AppUpdatePlatformSpecific.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson()); String toRawJson() => json.encode(toJson());
factory AppUpdatePlatformSpecific.fromJson(Map<String, dynamic> json) => AppUpdatePlatformSpecific( factory AppUpdatePlatformSpecific.fromJson(Map<String, dynamic> json) =>
AppUpdatePlatformSpecific(
mac: json["mac"], mac: json["mac"],
ios: json["ios"], ios: json["ios"],
android: json["android"], android: json["android"],
); );
Map<String, dynamic> toJson() => { Map<String, dynamic> toJson() => {
"mac": mac, "mac": mac,
"ios": ios, "ios": ios,
"android": android, "android": android,
}; };
T? get current { T? get current {
switch (platform) { switch (platform) {
case PlatformType.macos: case PlatformType.macos:
return mac; return mac;
case PlatformType.ios: case PlatformType.ios:
return ios; return ios;
case PlatformType.android: case PlatformType.android:
return android; return android;
default: default:
return null; return null;
}
} }
}
} }

View File

@@ -2,8 +2,8 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 262; static const int build = 263;
static const String engine = "3.7.11"; static const String engine = "3.7.11";
static const String buildAt = "2023-04-17 18:13:48.223240"; static const String buildAt = "2023-04-18 22:01:22.468457";
static const int modifications = 4; static const int modifications = 3;
} }

View File

@@ -85,7 +85,7 @@
"light": "Light", "light": "Light",
"loadingFiles": "Loading files...", "loadingFiles": "Loading files...",
"loss": "loss", "loss": "loss",
"madeWithLove": "\nMade with ❤️ by {myGithub}", "madeWithLove": "Made with ❤️ by {myGithub}",
"max": "max", "max": "max",
"maxRetryCount": "Number of server reconnection", "maxRetryCount": "Number of server reconnection",
"maxRetryCountEqual0": "Will retry again and again.", "maxRetryCountEqual0": "Will retry again and again.",

View File

@@ -85,7 +85,7 @@
"light": "亮", "light": "亮",
"loadingFiles": "正在加载目录。。。", "loadingFiles": "正在加载目录。。。",
"loss": "丢包率", "loss": "丢包率",
"madeWithLove": "\n用❤️制作 by {myGithub}", "madeWithLove": "用❤️制作 by {myGithub}",
"max": "最大", "max": "最大",
"maxRetryCount": "服务器尝试重连次数", "maxRetryCount": "服务器尝试重连次数",
"maxRetryCountEqual0": "会无限重试", "maxRetryCountEqual0": "会无限重试",

View File

@@ -265,27 +265,44 @@ class _MyHomePageState extends State<MyHomePage>
onTap: () => AppRoute(const SnippetListPage(), 'snippet list') onTap: () => AppRoute(const SnippetListPage(), 'snippet list')
.go(context), .go(context),
), ),
AboutListTile( ListTile(
icon: const Icon(Icons.text_snippet), leading: const Icon(Icons.text_snippet),
applicationName: '\n${BuildData.name}', title: Text(_s.about),
applicationVersion: _versionStr, onTap: () {
applicationIcon: _buildIcon(), showRoundDialog(
aboutBoxChildren: [ context,
UrlText( _s.about,
text: _s.madeWithLove(myGithub), Column(
replace: 'lollipopkit'), mainAxisSize: MainAxisSize.min,
UrlText( crossAxisAlignment: CrossAxisAlignment.start,
text: _s.aboutThanks, children: [
), UrlText(
// Thanks text: _s.madeWithLove(myGithub),
...thanksMap.keys.map( replace: 'lollipopkit'),
(key) => UrlText( UrlText(
text: thanksMap[key] ?? '', text: _s.aboutThanks,
replace: key, ),
// Thanks
...thanksMap.keys.map(
(key) => UrlText(
text: thanksMap[key] ?? '',
replace: key,
),
)
],
), ),
) [
], TextButton(
child: Text(_s.about), onPressed: () => showLicensePage(context: context),
child: Text(_s.license),
),
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(_s.close),
)
],
);
},
) )
], ],
), ),