mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-01 05:45:04 +01:00
new: license dialog
This commit is contained in:
@@ -30,94 +30,97 @@ import 'dart:convert';
|
||||
import '/core/utils/platform.dart';
|
||||
|
||||
class AppUpdate {
|
||||
AppUpdate({
|
||||
required this.changelog,
|
||||
required this.build,
|
||||
required this.url,
|
||||
});
|
||||
AppUpdate({
|
||||
required this.changelog,
|
||||
required this.build,
|
||||
required this.url,
|
||||
});
|
||||
|
||||
final AppUpdatePlatformSpecific<String> changelog;
|
||||
final Build build;
|
||||
final AppUpdatePlatformSpecific<String> url;
|
||||
final AppUpdatePlatformSpecific<String> changelog;
|
||||
final Build build;
|
||||
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"]),
|
||||
build: Build.fromJson(json["build"]),
|
||||
url: AppUpdatePlatformSpecific.fromJson(json["url"]),
|
||||
);
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
Map<String, dynamic> toJson() => {
|
||||
"changelog": changelog.toJson(),
|
||||
"build": build.toJson(),
|
||||
"url": url.toJson(),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
class Build {
|
||||
Build({
|
||||
required this.min,
|
||||
required this.last,
|
||||
});
|
||||
Build({
|
||||
required this.min,
|
||||
required this.last,
|
||||
});
|
||||
|
||||
final AppUpdatePlatformSpecific<int> min;
|
||||
final AppUpdatePlatformSpecific<int> last;
|
||||
final AppUpdatePlatformSpecific<int> min;
|
||||
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"]),
|
||||
last: AppUpdatePlatformSpecific.fromJson(json["last"]),
|
||||
);
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
Map<String, dynamic> toJson() => {
|
||||
"min": min.toJson(),
|
||||
"last": last.toJson(),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
class AppUpdatePlatformSpecific<T> {
|
||||
AppUpdatePlatformSpecific({
|
||||
required this.mac,
|
||||
required this.ios,
|
||||
required this.android,
|
||||
});
|
||||
AppUpdatePlatformSpecific({
|
||||
required this.mac,
|
||||
required this.ios,
|
||||
required this.android,
|
||||
});
|
||||
|
||||
final T mac;
|
||||
final T ios;
|
||||
final T android;
|
||||
final T mac;
|
||||
final T ios;
|
||||
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"],
|
||||
ios: json["ios"],
|
||||
android: json["android"],
|
||||
);
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
Map<String, dynamic> toJson() => {
|
||||
"mac": mac,
|
||||
"ios": ios,
|
||||
"android": android,
|
||||
};
|
||||
};
|
||||
|
||||
T? get current {
|
||||
switch (platform) {
|
||||
case PlatformType.macos:
|
||||
return mac;
|
||||
case PlatformType.ios:
|
||||
return ios;
|
||||
case PlatformType.android:
|
||||
return android;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
T? get current {
|
||||
switch (platform) {
|
||||
case PlatformType.macos:
|
||||
return mac;
|
||||
case PlatformType.ios:
|
||||
return ios;
|
||||
case PlatformType.android:
|
||||
return android;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
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 buildAt = "2023-04-17 18:13:48.223240";
|
||||
static const int modifications = 4;
|
||||
static const String buildAt = "2023-04-18 22:01:22.468457";
|
||||
static const int modifications = 3;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
"light": "Light",
|
||||
"loadingFiles": "Loading files...",
|
||||
"loss": "loss",
|
||||
"madeWithLove": "\nMade with ❤️ by {myGithub}",
|
||||
"madeWithLove": "Made with ❤️ by {myGithub}",
|
||||
"max": "max",
|
||||
"maxRetryCount": "Number of server reconnection",
|
||||
"maxRetryCountEqual0": "Will retry again and again.",
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
"light": "亮",
|
||||
"loadingFiles": "正在加载目录。。。",
|
||||
"loss": "丢包率",
|
||||
"madeWithLove": "\n用❤️制作 by {myGithub}",
|
||||
"madeWithLove": "用❤️制作 by {myGithub}",
|
||||
"max": "最大",
|
||||
"maxRetryCount": "服务器尝试重连次数",
|
||||
"maxRetryCountEqual0": "会无限重试",
|
||||
|
||||
@@ -265,27 +265,44 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
onTap: () => AppRoute(const SnippetListPage(), 'snippet list')
|
||||
.go(context),
|
||||
),
|
||||
AboutListTile(
|
||||
icon: const Icon(Icons.text_snippet),
|
||||
applicationName: '\n${BuildData.name}',
|
||||
applicationVersion: _versionStr,
|
||||
applicationIcon: _buildIcon(),
|
||||
aboutBoxChildren: [
|
||||
UrlText(
|
||||
text: _s.madeWithLove(myGithub),
|
||||
replace: 'lollipopkit'),
|
||||
UrlText(
|
||||
text: _s.aboutThanks,
|
||||
),
|
||||
// Thanks
|
||||
...thanksMap.keys.map(
|
||||
(key) => UrlText(
|
||||
text: thanksMap[key] ?? '',
|
||||
replace: key,
|
||||
ListTile(
|
||||
leading: const Icon(Icons.text_snippet),
|
||||
title: Text(_s.about),
|
||||
onTap: () {
|
||||
showRoundDialog(
|
||||
context,
|
||||
_s.about,
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
UrlText(
|
||||
text: _s.madeWithLove(myGithub),
|
||||
replace: 'lollipopkit'),
|
||||
UrlText(
|
||||
text: _s.aboutThanks,
|
||||
),
|
||||
// Thanks
|
||||
...thanksMap.keys.map(
|
||||
(key) => UrlText(
|
||||
text: thanksMap[key] ?? '',
|
||||
replace: key,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
child: Text(_s.about),
|
||||
[
|
||||
TextButton(
|
||||
onPressed: () => showLicensePage(context: context),
|
||||
child: Text(_s.license),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(_s.close),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user