new: animation for process page

This commit is contained in:
lollipopkit
2023-08-08 15:21:22 +08:00
parent 2887d23381
commit 693eef8f7e
4 changed files with 85 additions and 68 deletions

View File

@@ -470,7 +470,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 450;
CURRENT_PROJECT_VERSION = 451;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -478,7 +478,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.450;
MARKETING_VERSION = 1.0.451;
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 = 450;
CURRENT_PROJECT_VERSION = 451;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -610,7 +610,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.450;
MARKETING_VERSION = 1.0.451;
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 = 450;
CURRENT_PROJECT_VERSION = 451;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -636,7 +636,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.450;
MARKETING_VERSION = 1.0.451;
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 = 450;
CURRENT_PROJECT_VERSION = 451;
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.450;
MARKETING_VERSION = 1.0.451;
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 = 450;
CURRENT_PROJECT_VERSION = 451;
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.450;
MARKETING_VERSION = 1.0.451;
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 = 450;
CURRENT_PROJECT_VERSION = 451;
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.450;
MARKETING_VERSION = 1.0.451;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -2,8 +2,8 @@
class BuildData {
static const String name = "ServerBox";
static const int build = 450;
static const int build = 451;
static const String engine = "3.10.6";
static const String buildAt = "2023-08-08 14:47:37.806229";
static const int modifications = 9;
static const String buildAt = "2023-08-08 15:07:48.571249";
static const int modifications = 3;
}

View File

@@ -27,6 +27,8 @@ class ProcessPage extends StatefulWidget {
class _ProcessPageState extends State<ProcessPage> {
late S _s;
late Timer _timer;
late MediaQueryData _media;
SSHClient? _client;
PsResult _result = PsResult(procs: []);
@@ -46,6 +48,13 @@ class _ProcessPageState extends State<ProcessPage> {
_timer = Timer.periodic(const Duration(seconds: 3), (_) => _refresh());
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
_s = S.of(context)!;
_media = MediaQuery.of(context);
}
Future<void> _refresh() async {
if (mounted) {
final result = await _client?.run('ps -aux'.withLangExport).string;
@@ -66,12 +75,6 @@ class _ProcessPageState extends State<ProcessPage> {
_timer.cancel();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
_s = S.of(context)!;
}
@override
Widget build(BuildContext context) {
final actions = <Widget>[
@@ -109,7 +112,18 @@ class _ProcessPageState extends State<ProcessPage> {
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 7),
itemBuilder: (ctx, idx) {
final proc = _result.procs[idx];
return _buildListItem(proc);
return AnimatedSwitcher(
duration: const Duration(milliseconds: 277),
switchInCurve: Curves.easeIn,
switchOutCurve: Curves.easeOut,
transitionBuilder: (child, animation) {
return FadeTransition(
opacity: animation,
child: child,
);
},
child: _buildListItem(proc),
);
},
);
}
@@ -124,46 +138,49 @@ class _ProcessPageState extends State<ProcessPage> {
}
Widget _buildListItem(Proc proc) {
return RoundRectCard(ListTile(
leading: SizedBox(
width: 57,
child: TwoLineText(up: proc.pid.toString(), down: proc.user),
),
title: Text(proc.binary),
subtitle: Text(
proc.command,
style: grey,
maxLines: 3,
overflow: TextOverflow.fade,
),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
TwoLineText(up: proc.cpu.toStringAsFixed(1), down: 'cpu'),
width13,
TwoLineText(up: proc.mem.toStringAsFixed(1), down: 'mem'),
],
),
onTap: () => _lastFocusId = proc.pid,
onLongPress: () {
showRoundDialog(
context: context,
title: Text(_s.attention),
child: Text(_s.sureStop(proc.pid)),
actions: [
TextButton(
onPressed: () async {
await _client?.run('kill ${proc.pid}');
await _refresh();
context.pop();
},
child: Text(_s.ok),
),
return RoundRectCard(
ListTile(
leading: SizedBox(
width: _media.size.width / 6,
child: TwoLineText(up: proc.pid.toString(), down: proc.user),
),
title: Text(proc.binary),
subtitle: Text(
proc.command,
style: grey,
maxLines: 3,
overflow: TextOverflow.fade,
),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
TwoLineText(up: proc.cpu.toStringAsFixed(1), down: 'cpu'),
width13,
TwoLineText(up: proc.mem.toStringAsFixed(1), down: 'mem'),
],
);
},
selected: _lastFocusId == proc.pid,
autofocus: _lastFocusId == proc.pid,
));
),
onTap: () => _lastFocusId = proc.pid,
onLongPress: () {
showRoundDialog(
context: context,
title: Text(_s.attention),
child: Text(_s.sureStop(proc.pid)),
actions: [
TextButton(
onPressed: () async {
await _client?.run('kill ${proc.pid}');
await _refresh();
context.pop();
},
child: Text(_s.ok),
),
],
);
},
selected: _lastFocusId == proc.pid,
autofocus: _lastFocusId == proc.pid,
),
key: ValueKey(proc.pid),
);
}
}

View File

@@ -475,9 +475,9 @@
baseConfigurationReference = C1C758C41C4E208965A68933 /* Pods-RunnerTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CURRENT_PROJECT_VERSION = 450;
CURRENT_PROJECT_VERSION = 451;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.450;
MARKETING_VERSION = 1.0.451;
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 = 450;
CURRENT_PROJECT_VERSION = 451;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.450;
MARKETING_VERSION = 1.0.451;
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 = 450;
CURRENT_PROJECT_VERSION = 451;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.450;
MARKETING_VERSION = 1.0.451;
PRODUCT_BUNDLE_IDENTIFIER = tech.lolli.serverBox.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;