From 898ef1c11c88fd609a53aca91bd4d3f821670670 Mon Sep 17 00:00:00 2001 From: Winston Lowe Date: Mon, 26 Jan 2026 10:40:10 -0800 Subject: [PATCH] Refactor autofocus logic in login dialogs for better platform handling --- lib/screens/repeater_hub_screen.dart | 2 +- lib/widgets/repeater_login_dialog.dart | 4 +++- lib/widgets/room_login_dialog.dart | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/screens/repeater_hub_screen.dart b/lib/screens/repeater_hub_screen.dart index 846d0c5..903f89e 100644 --- a/lib/screens/repeater_hub_screen.dart +++ b/lib/screens/repeater_hub_screen.dart @@ -73,7 +73,7 @@ class RepeaterHubScreen extends StatelessWidget { ), const SizedBox(height: 8), Text( - '$repeater.shortPubKeyHex', + repeater.shortPubKeyHex, style: TextStyle(fontSize: 14, color: Colors.grey[600]), ), const SizedBox(height: 8), diff --git a/lib/widgets/repeater_login_dialog.dart b/lib/widgets/repeater_login_dialog.dart index 54c0150..1f767f6 100644 --- a/lib/widgets/repeater_login_dialog.dart +++ b/lib/widgets/repeater_login_dialog.dart @@ -322,7 +322,9 @@ class _RepeaterLoginDialogState extends State { } }, onSubmitted: (_) => _handleLogin(), - autofocus: _passwordController.text.isEmpty, + autofocus: !(defaultTargetPlatform == TargetPlatform.android || + defaultTargetPlatform == TargetPlatform.iOS) && + _passwordController.text.isEmpty, ), const SizedBox(height: 12), CheckboxListTile( diff --git a/lib/widgets/room_login_dialog.dart b/lib/widgets/room_login_dialog.dart index 69f8dc6..1d2554d 100644 --- a/lib/widgets/room_login_dialog.dart +++ b/lib/widgets/room_login_dialog.dart @@ -293,7 +293,9 @@ class _RoomLoginDialogState extends State { ), ), onSubmitted: (_) => _handleLogin(), - //autofocus: _passwordController.text.isEmpty, + autofocus: !(defaultTargetPlatform == TargetPlatform.android || + defaultTargetPlatform == TargetPlatform.iOS) && + _passwordController.text.isEmpty, ), const SizedBox(height: 12), CheckboxListTile(