From 5a812e3b2f44a41d91c75bc565bd06d9cb426df2 Mon Sep 17 00:00:00 2001 From: fufesou <13586388+fufesou@users.noreply.github.com> Date: Mon, 3 Nov 2025 23:23:08 +0800 Subject: [PATCH] fix: ui issues (#13381) Signed-off-by: fufesou --- .../lib/desktop/pages/desktop_setting_page.dart | 2 +- flutter/lib/mobile/pages/remote_page.dart | 15 +++++++++++---- flutter/lib/mobile/pages/view_camera_page.dart | 15 +++++++++++---- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index d39bafe6e..baea475cc 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -1177,7 +1177,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin { ], ), enabled: tmpEnabled && !locked), - numericOneTimePassword, + if (usePassword) numericOneTimePassword, if (usePassword) radios[1], if (usePassword) _SubButton('Set permanent password', setPasswordDialog, diff --git a/flutter/lib/mobile/pages/remote_page.dart b/flutter/lib/mobile/pages/remote_page.dart index 346f060c1..4aef2c5cb 100644 --- a/flutter/lib/mobile/pages/remote_page.dart +++ b/flutter/lib/mobile/pages/remote_page.dart @@ -1130,6 +1130,14 @@ void showOptions( if (pi.displays.length > 1 && pi.currentDisplay != kAllDisplayValue) { final cur = pi.currentDisplay; final children = []; + final isDarkTheme = MyTheme.currentThemeMode() == ThemeMode.dark; + final numColorSelected = Colors.white; + final numColorUnselected = isDarkTheme ? Colors.grey : Colors.black87; + // We can't use `Theme.of(context).primaryColor` here, the color is: + // - light theme: 0xff2196f3 (Colors.blue) + // - dark theme: 0xff212121 (the canvas color?) + final numBgSelected = + Theme.of(context).colorScheme.primary.withOpacity(0.6); for (var i = 0; i < pi.displays.length; ++i) { children.add(InkWell( onTap: () { @@ -1143,13 +1151,12 @@ void showOptions( decoration: BoxDecoration( border: Border.all(color: Theme.of(context).hintColor), borderRadius: BorderRadius.circular(2), - color: i == cur - ? Theme.of(context).primaryColor.withOpacity(0.6) - : null), + color: i == cur ? numBgSelected : null), child: Center( child: Text((i + 1).toString(), style: TextStyle( - color: i == cur ? Colors.white : Colors.black87, + color: + i == cur ? numColorSelected : numColorUnselected, fontWeight: FontWeight.bold)))))); } displays.add(Padding( diff --git a/flutter/lib/mobile/pages/view_camera_page.dart b/flutter/lib/mobile/pages/view_camera_page.dart index 53af56267..87fa8aa66 100644 --- a/flutter/lib/mobile/pages/view_camera_page.dart +++ b/flutter/lib/mobile/pages/view_camera_page.dart @@ -590,6 +590,14 @@ void showOptions( if (pi.displays.length > 1 && pi.currentDisplay != kAllDisplayValue) { final cur = pi.currentDisplay; final children = []; + final isDarkTheme = MyTheme.currentThemeMode() == ThemeMode.dark; + final numColorSelected = Colors.white; + final numColorUnselected = isDarkTheme ? Colors.grey : Colors.black87; + // We can't use `Theme.of(context).primaryColor` here, the color is: + // - light theme: 0xff2196f3 (Colors.blue) + // - dark theme: 0xff212121 (the canvas color?) + final numBgSelected = + Theme.of(context).colorScheme.primary.withOpacity(0.6); for (var i = 0; i < pi.displays.length; ++i) { children.add(InkWell( onTap: () { @@ -603,13 +611,12 @@ void showOptions( decoration: BoxDecoration( border: Border.all(color: Theme.of(context).hintColor), borderRadius: BorderRadius.circular(2), - color: i == cur - ? Theme.of(context).primaryColor.withOpacity(0.6) - : null), + color: i == cur ? numBgSelected : null), child: Center( child: Text((i + 1).toString(), style: TextStyle( - color: i == cur ? Colors.white : Colors.black87, + color: + i == cur ? numColorSelected : numColorUnselected, fontWeight: FontWeight.bold)))))); } displays.add(Padding(