From 2887d23381972131f3610c18344912665335db66 Mon Sep 17 00:00:00 2001 From: lollipopkit Date: Tue, 8 Aug 2023 14:55:13 +0800 Subject: [PATCH] new: animation --- ios/Runner.xcodeproj/project.pbxproj | 24 +++++++++---------- lib/data/res/build_data.dart | 6 ++--- lib/data/res/ui.dart | 1 + lib/view/page/docker.dart | 4 ++-- lib/view/page/server/detail.dart | 32 ++++++++++++++++++++++---- lib/view/page/server/tab.dart | 28 ++++++++++++++++------ macos/Podfile.lock | 6 ----- macos/Runner.xcodeproj/project.pbxproj | 12 +++++----- make.dart | 2 +- 9 files changed, 73 insertions(+), 42 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 36998015..125a68f5 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -470,7 +470,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 446; + CURRENT_PROJECT_VERSION = 450; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -478,7 +478,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.446; + MARKETING_VERSION = 1.0.450; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -602,7 +602,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 446; + CURRENT_PROJECT_VERSION = 450; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -610,7 +610,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.446; + MARKETING_VERSION = 1.0.450; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -628,7 +628,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 446; + CURRENT_PROJECT_VERSION = 450; DEVELOPMENT_TEAM = BA88US33G6; ENABLE_BITCODE = NO; INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist"; @@ -636,7 +636,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.446; + MARKETING_VERSION = 1.0.450; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -657,7 +657,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 446; + CURRENT_PROJECT_VERSION = 450; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -670,7 +670,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.446; + MARKETING_VERSION = 1.0.450; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; @@ -696,7 +696,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 446; + CURRENT_PROJECT_VERSION = 450; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -709,7 +709,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.446; + MARKETING_VERSION = 1.0.450; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -732,7 +732,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 446; + CURRENT_PROJECT_VERSION = 450; DEVELOPMENT_TEAM = BA88US33G6; GCC_C_LANGUAGE_STANDARD = gnu11; GENERATE_INFOPLIST_FILE = YES; @@ -745,7 +745,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.0.446; + MARKETING_VERSION = 1.0.450; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart index 46da879b..2fcf1c99 100644 --- a/lib/data/res/build_data.dart +++ b/lib/data/res/build_data.dart @@ -2,8 +2,8 @@ class BuildData { static const String name = "ServerBox"; - static const int build = 446; + static const int build = 450; static const String engine = "3.10.6"; - static const String buildAt = "2023-08-07 18:34:12.547300"; - static const int modifications = 4; + static const String buildAt = "2023-08-08 14:47:37.806229"; + static const int modifications = 9; } diff --git a/lib/data/res/ui.dart b/lib/data/res/ui.dart index 8837d0a6..5b167e8e 100644 --- a/lib/data/res/ui.dart +++ b/lib/data/res/ui.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; const textSize11 = TextStyle(fontSize: 11); const textSize12Grey = TextStyle(color: Colors.grey, fontSize: 11); const textSize13 = TextStyle(fontSize: 13); +const textSize13Bold = TextStyle(fontSize: 13, fontWeight: FontWeight.bold); const textSize13Grey = TextStyle(color: Colors.grey, fontSize: 13); const textSize15 = TextStyle(fontSize: 15); const textSize18 = TextStyle(fontSize: 18); diff --git a/lib/view/page/docker.dart b/lib/view/page/docker.dart index 015e07c2..906046af 100644 --- a/lib/view/page/docker.dart +++ b/lib/view/page/docker.dart @@ -455,7 +455,7 @@ class _DockerManagePageState extends State { AppRoute( SSHPage( spi: widget.spi, - initCmd: 'docker logs ${dItem.containerId}', + initCmd: 'docker logs -f --tail 100 ${dItem.containerId}', ), 'Docker logs', ).go(context); @@ -464,7 +464,7 @@ class _DockerManagePageState extends State { AppRoute( SSHPage( spi: widget.spi, - initCmd: 'docker exec -it ${dItem.containerId} /bin/sh', + initCmd: 'docker exec -it ${dItem.containerId} sh', ), 'Docker terminal', ).go(context); diff --git a/lib/view/page/server/detail.dart b/lib/view/page/server/detail.dart index fdd0e383..a7b2a830 100644 --- a/lib/view/page/server/detail.dart +++ b/lib/view/page/server/detail.dart @@ -106,6 +106,7 @@ class _ServerDetailPageState extends State } Widget _buildCPUView(ServerStatus ss) { + final percent = ss.cpu.usedPercent(coreIdx: 0).toInt(); return RoundRectCard( Padding( padding: roundRectCardPadding, @@ -113,10 +114,10 @@ class _ServerDetailPageState extends State Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - '${ss.cpu.usedPercent(coreIdx: 0).toInt()}%', - style: textSize27, - textScaleFactor: 1.0, + _buildAnimatedText( + ValueKey(percent), + '$percent%', + textSize27, ), Row( children: [ @@ -206,6 +207,7 @@ class _ServerDetailPageState extends State final free = ss.mem.free / ss.mem.total * 100; final avail = ss.mem.availPercent * 100; final used = ss.mem.usedPercent * 100; + final usedStr = used.toStringAsFixed(0); return RoundRectCard( Padding( @@ -219,7 +221,11 @@ class _ServerDetailPageState extends State children: [ Row( children: [ - Text('${used.toStringAsFixed(0)}%', style: textSize27), + _buildAnimatedText( + ValueKey(usedStr), + '$usedStr%', + textSize27, + ), width7, Text('of ${(ss.mem.total * 1024).convertBytes}', style: textSize13Grey) @@ -437,4 +443,20 @@ class _ServerDetailPageState extends State child: Column(children: children), )); } + + Widget _buildAnimatedText(Key key, String text, TextStyle style) { + return AnimatedSwitcher( + duration: const Duration(milliseconds: 277), + child: Text( + key: key, + text, + style: style, + textScaleFactor: 1.0, + ), + transitionBuilder: (child, animation) => FadeTransition( + opacity: animation, + child: child, + ), + ); + } } diff --git a/lib/view/page/server/tab.dart b/lib/view/page/server/tab.dart index 8381fddf..ed866e6a 100644 --- a/lib/view/page/server/tab.dart +++ b/lib/view/page/server/tab.dart @@ -168,10 +168,15 @@ class _ServerPageState extends State ServerPrivateInfo spi, ) { final rootDisk = findRootDisk(ss.disk); - - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + late final List children; + var height = 23.0; + if (cs != ServerState.connected) { + children = [ + _buildServerCardTitle(ss, cs, spi), + ]; + } else { + height = 137; + children = [ _buildServerCardTitle(ss, cs, spi), height13, Row( @@ -195,7 +200,17 @@ class _ServerPageState extends State ], ), const SizedBox(height: 3), - ], + ]; + } + + return AnimatedContainer( + duration: const Duration(milliseconds: 377), + curve: Curves.fastEaseInToSlowEaseOut, + height: height, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: children, + ), ); } @@ -213,8 +228,7 @@ class _ServerPageState extends State children: [ Text( spi.name, - style: - const TextStyle(fontWeight: FontWeight.bold, fontSize: 12), + style: textSize13Bold, textScaleFactor: 1.0, ), const Icon( diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 5b52c08f..97e82977 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -1,6 +1,4 @@ PODS: - - flutter_volume_controller (0.0.1): - - FlutterMacOS - FlutterMacOS (1.0.0) - path_provider_foundation (0.0.1): - Flutter @@ -14,7 +12,6 @@ PODS: - FlutterMacOS DEPENDENCIES: - - flutter_volume_controller (from `Flutter/ephemeral/.symlinks/plugins/flutter_volume_controller/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`) @@ -22,8 +19,6 @@ DEPENDENCIES: - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) EXTERNAL SOURCES: - flutter_volume_controller: - :path: Flutter/ephemeral/.symlinks/plugins/flutter_volume_controller/macos FlutterMacOS: :path: Flutter/ephemeral path_provider_foundation: @@ -36,7 +31,6 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos SPEC CHECKSUMS: - flutter_volume_controller: 25d09126b0d695560f11c80b1311d5063fed882f FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8 share_plus: 76dd39142738f7a68dd57b05093b5e8193f220f7 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 49a9e619..5b9244f4 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -475,9 +475,9 @@ baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 446; + CURRENT_PROJECT_VERSION = 450; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0.446; + MARKETING_VERSION = 1.0.450; PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -490,9 +490,9 @@ baseConfigurationReference = 15AF97DF993E8968098D6EBE /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 446; + CURRENT_PROJECT_VERSION = 450; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0.446; + MARKETING_VERSION = 1.0.450; PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -505,9 +505,9 @@ baseConfigurationReference = 7CFA7DE7FABA75685DFB6948 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - CURRENT_PROJECT_VERSION = 446; + CURRENT_PROJECT_VERSION = 450; GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0.446; + MARKETING_VERSION = 1.0.450; PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; diff --git a/make.dart b/make.dart index 046f51a1..040b5456 100755 --- a/make.dart +++ b/make.dart @@ -146,7 +146,7 @@ Future scp2CDN() async { print('SHA1: $sha1'); final result = await Process.run( 'scp', - [apkPath, 'hk:/var/www/res/serverbox/apks/$sha1.apk'], + [apkPath, 'hk:/var/www/res/serverbox/apks/$build-$sha1.apk'], runInShell: true, ); if (result.exitCode != 0) {