mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
new: pull to refresh on server tab
This commit is contained in:
@@ -356,7 +356,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 218;
|
||||
CURRENT_PROJECT_VERSION = 220;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@@ -364,7 +364,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.218;
|
||||
MARKETING_VERSION = 1.0.220;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -486,7 +486,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 218;
|
||||
CURRENT_PROJECT_VERSION = 220;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@@ -494,7 +494,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.218;
|
||||
MARKETING_VERSION = 1.0.220;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -510,7 +510,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 218;
|
||||
CURRENT_PROJECT_VERSION = 220;
|
||||
DEVELOPMENT_TEAM = BA88US33G6;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@@ -518,7 +518,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.218;
|
||||
MARKETING_VERSION = 1.0.220;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
|
||||
@@ -41,12 +41,18 @@ class ServerProvider extends BusyProvider {
|
||||
return Server(spi, initStatus, null, ServerState.disconnected);
|
||||
}
|
||||
|
||||
Future<void> refreshData({ServerPrivateInfo? spi}) async {
|
||||
Future<void> refreshData(
|
||||
{ServerPrivateInfo? spi, bool onlyFailed = false}) async {
|
||||
if (spi != null) {
|
||||
await _getData(spi);
|
||||
return;
|
||||
}
|
||||
await Future.wait(_servers.map((s) async {
|
||||
if (onlyFailed) {
|
||||
if (s.cs != ServerState.failed) return;
|
||||
_limiter.resetTryTimes(s.spi.id);
|
||||
}
|
||||
if (onlyFailed && s.cs != ServerState.failed) return;
|
||||
await _getData(s.spi);
|
||||
}));
|
||||
}
|
||||
@@ -72,6 +78,7 @@ class ServerProvider extends BusyProvider {
|
||||
for (var i = 0; i < _servers.length; i++) {
|
||||
_servers[i].cs = ServerState.disconnected;
|
||||
}
|
||||
_limiter.clear();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -274,4 +281,8 @@ class _TryLimiter {
|
||||
void resetTryTimes(String id) {
|
||||
_triedTimes[id] = 0;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
_triedTimes.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 218;
|
||||
static const String engine =
|
||||
"Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 9944297138 (5 days ago) • 2023-02-08 15:46:04 -0800\nEngine • revision 248290d6d5\nTools • Dart 2.19.2 • DevTools 2.20.1\n";
|
||||
static const String buildAt = "2023-02-14 18:46:55.180156";
|
||||
static const int modifications = 5;
|
||||
static const int build = 220;
|
||||
static const String engine = "Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 9944297138 (7 days ago) • 2023-02-08 15:46:04 -0800\nEngine • revision 248290d6d5\nTools • Dart 2.19.2 • DevTools 2.20.1\n";
|
||||
static const String buildAt = "2023-02-16 12:58:28.193531";
|
||||
static const int modifications = 3;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
||||
"about": MessageLookupByLibrary.simpleMessage("About"),
|
||||
"aboutThanks": MessageLookupByLibrary.simpleMessage(
|
||||
"\n\nThanks to the following people who participated in the test."),
|
||||
"addAServer": MessageLookupByLibrary.simpleMessage("add a server"),
|
||||
|
||||
@@ -66,6 +66,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
|
||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
||||
"about": MessageLookupByLibrary.simpleMessage("关于"),
|
||||
"aboutThanks":
|
||||
MessageLookupByLibrary.simpleMessage("\n\n感谢以下参与软件测试的各位。"),
|
||||
"addAServer": MessageLookupByLibrary.simpleMessage("添加服务器"),
|
||||
|
||||
@@ -50,6 +50,16 @@ class S {
|
||||
return Localizations.of<S>(context, S);
|
||||
}
|
||||
|
||||
/// `About`
|
||||
String get about {
|
||||
return Intl.message(
|
||||
'About',
|
||||
name: 'about',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `\n\nThanks to the following people who participated in the test.`
|
||||
String get aboutThanks {
|
||||
return Intl.message(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"about": "About",
|
||||
"aboutThanks": "\n\nThanks to the following people who participated in the test.",
|
||||
"addAServer": "add a server",
|
||||
"addOne": "Add one",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"about": "关于",
|
||||
"aboutThanks": "\n\n感谢以下参与软件测试的各位。",
|
||||
"addAServer": "添加服务器",
|
||||
"addOne": "前去新增",
|
||||
|
||||
@@ -267,7 +267,7 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
),
|
||||
)
|
||||
],
|
||||
child: Text(_s.license),
|
||||
child: Text(_s.about),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
@@ -220,7 +220,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
children: [
|
||||
Text('${used.toStringAsFixed(0)}%', style: textSize27),
|
||||
width7,
|
||||
Text('of ${(ss.mem.total * 1024).convertBytes} Mem',
|
||||
Text('of ${(ss.mem.total * 1024).convertBytes}',
|
||||
style: textSize13Grey)
|
||||
],
|
||||
),
|
||||
@@ -233,9 +233,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 11,
|
||||
),
|
||||
height13,
|
||||
_buildProgress(used)
|
||||
],
|
||||
),
|
||||
@@ -262,7 +260,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
children: [
|
||||
Text('${used.toStringAsFixed(0)}%', style: textSize27),
|
||||
width7,
|
||||
Text('of ${(ss.swap.total * 1024).convertBytes} Swap',
|
||||
Text('of ${(ss.swap.total * 1024).convertBytes} ',
|
||||
style: textSize13Grey)
|
||||
],
|
||||
),
|
||||
@@ -275,9 +273,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 11,
|
||||
),
|
||||
height13,
|
||||
_buildProgress(used)
|
||||
],
|
||||
),
|
||||
|
||||
@@ -76,6 +76,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
return ListView.separated(
|
||||
padding: const EdgeInsets.all(7),
|
||||
controller: ScrollController(),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
itemBuilder: (ctx, idx) {
|
||||
if (idx == pro.servers.length) {
|
||||
return SizedBox(height: _media.padding.bottom);
|
||||
@@ -90,7 +91,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
},
|
||||
);
|
||||
return Scaffold(
|
||||
body: child,
|
||||
body: RefreshIndicator(child: child, onRefresh: () async => await _serverProvider.refreshData(onlyFailed: true)),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => AppRoute(
|
||||
const ServerEditPage(),
|
||||
|
||||
@@ -90,7 +90,7 @@ Future<void> updateBuildData() async {
|
||||
|
||||
Future<void> dartFormat() async {
|
||||
final result = await fvmRun(['dart', 'format', '.']);
|
||||
print('\n${result.stdout}');
|
||||
print(result.stdout);
|
||||
if (result.exitCode != 0) {
|
||||
print(result.stderr);
|
||||
exit(1);
|
||||
@@ -183,8 +183,8 @@ void main(List<String> args) async {
|
||||
switch (command) {
|
||||
case 'build':
|
||||
final stopwatch = Stopwatch()..start();
|
||||
build = await getGitCommitCount();
|
||||
await dartFormat();
|
||||
build = await getGitCommitCount();
|
||||
await updateBuildData();
|
||||
await changeAppleVersion();
|
||||
if (args.length > 1) {
|
||||
@@ -192,7 +192,7 @@ void main(List<String> args) async {
|
||||
for (final platform in platforms.split(',')) {
|
||||
if (buildFuncs.keys.contains(platform)) {
|
||||
await buildFuncs[platform]!();
|
||||
print('Build finished in ${stopwatch.elapsed}');
|
||||
print('Build finished in [${stopwatch.elapsed}]');
|
||||
stopwatch.reset();
|
||||
stopwatch.start();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user