From 588168f63863f0a495c2c04d1f8840e6af718bd6 Mon Sep 17 00:00:00 2001 From: dignow Date: Sat, 1 Jul 2023 14:43:00 +0800 Subject: [PATCH 1/2] replace close button to inkwell Signed-off-by: dignow --- flutter/lib/common/widgets/login.dart | 24 ++++-------------------- libs/hbb_common/src/config.rs | 2 +- src/flutter_ffi.rs | 2 +- src/ipc.rs | 2 +- 4 files changed, 7 insertions(+), 23 deletions(-) diff --git a/flutter/lib/common/widgets/login.dart b/flutter/lib/common/widgets/login.dart index bfc62825a..0fbd506f2 100644 --- a/flutter/lib/common/widgets/login.dart +++ b/flutter/lib/common/widgets/login.dart @@ -506,31 +506,15 @@ Future loginDialog() async { Text( translate('Login'), ).marginOnly(top: MyTheme.dialogPadding), - TextButton( - style: ButtonStyle( - overlayColor: MaterialStateProperty.resolveWith( - (Set states) { - if (states.contains(MaterialState.hovered)) { - return Colors.red; - } - return null; - }, - ), - padding: MaterialStateProperty.all( - EdgeInsets.all(5)), - minimumSize: MaterialStateProperty.all( - Size(0, 0), - ), - shape: MaterialStateProperty.all(RoundedRectangleBorder( - side: BorderSide.none, - borderRadius: BorderRadius.all(Radius.circular(5)))), - ), + InkWell( child: Icon( Icons.close, size: 22, color: Colors.black54, ), - onPressed: onDialogCancel, + onTap: onDialogCancel, + hoverColor: Colors.red, + borderRadius: BorderRadius.circular(5), ).marginOnly(top: 5, right: 5), ], ); diff --git a/libs/hbb_common/src/config.rs b/libs/hbb_common/src/config.rs index 785be96ee..39b40046e 100644 --- a/libs/hbb_common/src/config.rs +++ b/libs/hbb_common/src/config.rs @@ -310,7 +310,7 @@ pub struct TransferSerde { } #[inline] -pub fn get_online_statue() -> i64 { +pub fn get_online_state() -> i64 { *ONLINE.lock().unwrap().values().max().unwrap_or(&0) } diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index cc0a4f59a..e54168249 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -685,7 +685,7 @@ pub fn main_get_connect_status() -> String { } #[cfg(any(target_os = "android", target_os = "ios"))] { - let mut state = hbb_common::config::get_online_statue(); + let mut state = hbb_common::config::get_online_state(); if state > 0 { state = 1; } diff --git a/src/ipc.rs b/src/ipc.rs index 6a426e37d..526761c8b 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -347,7 +347,7 @@ async fn handle(data: Data, stream: &mut Connection) { } } Data::OnlineStatus(_) => { - let x = config::get_online_statue(); + let x = config::get_online_state(); let confirmed = Config::get_key_confirmed(); allow_err!(stream.send(&Data::OnlineStatus(Some((x, confirmed)))).await); } From b5bd62848818f99b65e65836bd1f9c5742bf2853 Mon Sep 17 00:00:00 2001 From: dignow Date: Sat, 1 Jul 2023 15:06:56 +0800 Subject: [PATCH 2/2] apply current theme mode Signed-off-by: dignow --- flutter/lib/common/widgets/login.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flutter/lib/common/widgets/login.dart b/flutter/lib/common/widgets/login.dart index 0fbd506f2..5cffd9f6f 100644 --- a/flutter/lib/common/widgets/login.dart +++ b/flutter/lib/common/widgets/login.dart @@ -510,7 +510,9 @@ Future loginDialog() async { child: Icon( Icons.close, size: 22, - color: Colors.black54, + color: MyTheme.currentThemeMode() == ThemeMode.dark + ? Colors.white70 + : Colors.black54, ), onTap: onDialogCancel, hoverColor: Colors.red,