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