diff --git a/lib/app.dart b/lib/app.dart index 4157ee1a..800ea56f 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -22,7 +22,7 @@ class MyApp extends StatelessWidget { listenable: RNodes.app, builder: (context, _) { if (!Stores.setting.useSystemPrimaryColor.fetch()) { - UIs.colorSeed = Color(Stores.setting.primaryColor.fetch()); + UIs.colorSeed = Color(Stores.setting.colorSeed.fetch()); return _buildApp( context, light: ThemeData( @@ -88,6 +88,7 @@ class MyApp extends StatelessWidget { context.setLibL10n(); final appL10n = AppLocalizations.of(context); if (appL10n != null) l10n = appL10n; + UIs.primaryColor = Theme.of(context).colorScheme.primary; final intros = _IntroPage.builders; if (intros.isNotEmpty) { diff --git a/lib/data/store/setting.dart b/lib/data/store/setting.dart index 0ebab4a9..5e9b9ed3 100644 --- a/lib/data/store/setting.dart +++ b/lib/data/store/setting.dart @@ -55,7 +55,8 @@ class SettingStore extends PersistentStore { 1.0, ); - late final primaryColor = property( + /// The seed of color scheme + late final colorSeed = property( 'primaryColor', 4287106639, ); diff --git a/lib/view/page/backup.dart b/lib/view/page/backup.dart index ae6e3401..a52b4c22 100644 --- a/lib/view/page/backup.dart +++ b/lib/view/page/backup.dart @@ -34,6 +34,7 @@ class BackupPage extends StatelessWidget { padding: const EdgeInsets.all(13), children: [ _buildTip(), + CenterGreyTitle(libL10n.sync), if (isMacOS || isIOS) _buildIcloud(context), _buildWebdav(context), _buildFile(context), diff --git a/lib/view/page/container.dart b/lib/view/page/container.dart index 09fd941e..bdec423e 100644 --- a/lib/view/page/container.dart +++ b/lib/view/page/container.dart @@ -413,7 +413,7 @@ class _ContainerPageState extends State { final host = Stores.container.fetch(id); final ctrl = TextEditingController(text: host); await context.showRoundDialog( - title: 'DOCKER_HOST', + title: libL10n.edit, child: Input( maxLines: 2, controller: ctrl, diff --git a/lib/view/page/process.dart b/lib/view/page/process.dart index 43187b5c..958ce67e 100644 --- a/lib/view/page/process.dart +++ b/lib/view/page/process.dart @@ -159,9 +159,11 @@ class _ProcessPageState extends State { '${l10n.stop} ${l10n.process}(${proc.pid})', )), actions: Btn.ok(onTap: (c) async { - await _client?.run('kill ${proc.pid}'); - await _refresh(); context.pop(); + await context.showLoadingDialog(fn: () async { + await _client?.run('kill ${proc.pid}'); + await _refresh(); + }); }).toList, ); }, diff --git a/lib/view/page/server/tab.dart b/lib/view/page/server/tab.dart index a9635663..c877aa46 100644 --- a/lib/view/page/server/tab.dart +++ b/lib/view/page/server/tab.dart @@ -529,7 +529,7 @@ class _ServerPageState extends State borderRadius: BorderRadius.circular(7), onTap: onTap, child: wrapped, - ).paddingOnly(left: 10); + ).paddingOnly(left: 5); } Widget _buildTopRightText(Server s) { diff --git a/lib/view/page/setting/entry.dart b/lib/view/page/setting/entry.dart index e3bda73e..f150950d 100644 --- a/lib/view/page/setting/entry.dart +++ b/lib/view/page/setting/entry.dart @@ -38,9 +38,10 @@ class _SettingPageState extends State { onPressed: () => context.showRoundDialog( title: libL10n.attention, child: SimpleMarkdown( - data: libL10n.askContinue( - '${libL10n.delete} **${libL10n.all}** ${l10n.setting}', - )), + data: libL10n.askContinue( + '${libL10n.delete} **${libL10n.all}** ${l10n.setting}', + ), + ), actions: Btn.ok( onTap: (c) { context.pop(); @@ -223,8 +224,11 @@ class _SettingPageState extends State { return ListTile( leading: const Icon(Icons.colorize), title: Text(l10n.primaryColorSeed), - trailing: ClipOval( - child: Container(color: UIs.primaryColor, height: 27, width: 27), + trailing: _setting.colorSeed.listenable().listenVal( + (val) { + final c = Color(val); + return ClipOval(child: Container(color: c, height: 27, width: 27)); + }, ), onTap: () async { final ctrl = TextEditingController(text: UIs.primaryColor.toHex); @@ -252,7 +256,7 @@ class _SettingPageState extends State { suggestion: false, ), ColorPicker( - color: Color(_setting.primaryColor.fetch()), + color: Color(_setting.colorSeed.fetch()), onColorChanged: (c) => ctrl.text = c.toHex, ) ]); @@ -274,13 +278,10 @@ class _SettingPageState extends State { context.showSnackBar(libL10n.fail); return; } - // Change [primaryColor] first, then change [_selectedColorValue], - // So the [ValueBuilder] will be triggered with the new value UIs.colorSeed = color; - _setting.primaryColor.put(color.value); + _setting.colorSeed.put(color.value); context.pop(); - context.pop(); - RNodes.app.notify(); + Future.delayed(Durations.medium1, RNodes.app.notify); } // Widget _buildLaunchPage() { diff --git a/lib/view/page/ssh/tab.dart b/lib/view/page/ssh/tab.dart index 98e892ce..179a0d4d 100644 --- a/lib/view/page/ssh/tab.dart +++ b/lib/view/page/ssh/tab.dart @@ -73,15 +73,10 @@ class _SSHTabPageState extends State return AlertDialog( title: Text(libL10n.attention), content: Text('${libL10n.close} SSH ${l10n.conn}($name) ?'), - actions: [ - Btn.ok( - onTap: (c) => context.pop(true), - red: true, - ), - Btn.cancel( - onTap: (c) => context.pop(false), - ), - ], + actions: Btn.ok( + onTap: (c) => context.pop(true), + red: true, + ).toList, ); }, ); diff --git a/lib/view/page/storage/local.dart b/lib/view/page/storage/local.dart index d7dcc9df..441e1e73 100644 --- a/lib/view/page/storage/local.dart +++ b/lib/view/page/storage/local.dart @@ -350,10 +350,10 @@ class _LocalStoragePageState extends State { title: libL10n.delete, child: Text(libL10n.askContinue('${libL10n.delete} $fileName')), actions: Btn.ok( - onTap: (c) { + onTap: (c) async { context.pop(); try { - file.deleteSync(recursive: true); + await file.delete(recursive: true); } catch (e) { context.showSnackBar('${libL10n.fail}:\n$e'); return; diff --git a/pubspec.lock b/pubspec.lock index 49324e9d..3cc8c3b0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -385,8 +385,8 @@ packages: dependency: "direct main" description: path: "." - ref: "v1.0.109" - resolved-ref: "27266fdd805a5bb2a9c682ca70aaaef785e609b5" + ref: "v1.0.111" + resolved-ref: c220f27ce606e0a342cf9add6a90ce4c11844972 url: "https://github.com/lppcg/fl_lib" source: git version: "0.0.1" diff --git a/pubspec.yaml b/pubspec.yaml index 08cb5c8a..ddc00939 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -61,7 +61,7 @@ dependencies: fl_lib: git: url: https://github.com/lppcg/fl_lib - ref: v1.0.109 + ref: v1.0.111 dependency_overrides: # dartssh2: