fix: dpad focus for dialogs and buttons

This commit is contained in:
edde746
2026-02-22 14:50:59 +01:00
parent 1536feb034
commit 7f8d4c7946
20 changed files with 450 additions and 161 deletions
+35 -12
View File
@@ -16,6 +16,7 @@ import '../i18n/strings.g.dart';
import '../theme/mono_tokens.dart';
import '../utils/app_logger.dart';
import '../utils/platform_detector.dart';
import '../focus/focusable_button.dart';
import 'main_screen.dart';
class AuthScreen extends StatefulWidget {
@@ -398,7 +399,7 @@ class _AuthScreenState extends State<AuthScreen> {
children: [
if (isTV) ...[
// On TV: QR is primary, browser is secondary
ElevatedButton(
FocusableButton(
autofocus: true,
onPressed: () {
setState(() {
@@ -406,14 +407,25 @@ class _AuthScreenState extends State<AuthScreen> {
});
_startAuthentication();
},
style: ElevatedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 16)),
child: Text(t.auth.showQRCode),
child: ElevatedButton(
onPressed: () {
setState(() {
_useQrFlow = true;
});
_startAuthentication();
},
style: ElevatedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 16)),
child: Text(t.auth.showQRCode),
),
),
const SizedBox(height: 12),
OutlinedButton(
FocusableButton(
onPressed: _startAuthentication,
style: OutlinedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 16)),
child: Text(t.auth.useBrowser),
child: OutlinedButton(
onPressed: _startAuthentication,
style: OutlinedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 16)),
child: Text(t.auth.useBrowser),
),
),
] else ...[
// On other platforms: Browser is primary, QR is secondary
@@ -500,22 +512,33 @@ class _AuthScreenState extends State<AuthScreen> {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
OutlinedButton(
FocusableButton(
autofocus: true,
onPressed: _retryAuthentication,
style: OutlinedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24)),
child: Text(t.common.retry),
child: OutlinedButton(
onPressed: _retryAuthentication,
style: OutlinedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24)),
child: Text(t.common.retry),
),
),
const SizedBox(width: 16),
OutlinedButton(
FocusableButton(
onPressed: () {
setState(() {
_useQrFlow = false;
});
_startAuthentication();
},
style: OutlinedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24)),
child: Text(t.auth.useBrowser),
child: OutlinedButton(
onPressed: () {
setState(() {
_useQrFlow = false;
});
_startAuthentication();
},
style: OutlinedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24)),
child: Text(t.auth.useBrowser),
),
),
],
),