fix: profile switcher screen focus

close #415
This commit is contained in:
edde746
2026-02-08 08:01:28 +01:00
parent 0c44a35eb8
commit fab73a0bc0
3 changed files with 16 additions and 10 deletions
+5 -1
View File
@@ -628,6 +628,11 @@ class _DiscoverScreenState extends State<DiscoverScreen>
}
});
// Focus hero section now that it's visible, but only if no modal route is on top
if (onDeck.isNotEmpty && (ModalRoute.of(context)?.isCurrent ?? false)) {
_heroFocusNode.requestFocus();
}
// Sync to Android TV Watch Next row
if (Platform.isAndroid) {
_syncWatchNext(onDeck);
@@ -1244,7 +1249,6 @@ class _DiscoverScreenState extends State<DiscoverScreen>
return SliverToBoxAdapter(
child: Focus(
focusNode: _heroFocusNode,
autofocus: true,
onKeyEvent: _handleHeroKeyEvent,
child: SizedBox(
height: heroHeight,
@@ -13,7 +13,6 @@ class ProfileListTile extends StatelessWidget {
final VoidCallback onTap;
final bool isCurrentUser;
final bool showTrailingIcon;
final bool autofocus;
const ProfileListTile({
super.key,
@@ -21,7 +20,6 @@ class ProfileListTile extends StatelessWidget {
required this.onTap,
this.isCurrentUser = false,
this.showTrailingIcon = true,
this.autofocus = false,
});
@override
@@ -29,7 +27,6 @@ class ProfileListTile extends StatelessWidget {
final theme = Theme.of(context);
return ListTile(
autofocus: autofocus,
leading: UserAvatarWidget(user: user, size: 40, showIndicators: false),
title: Text(user.displayName),
subtitle: _hasUserAttributes() ? Row(children: _buildUserAttributes(theme)) : null,
+11 -6
View File
@@ -6,6 +6,7 @@ import '../../providers/user_profile_provider.dart';
import '../../utils/provider_extensions.dart';
import '../../utils/snackbar_helper.dart';
import 'profile_list_tile.dart';
import '../../focus/focusable_wrapper.dart';
import '../../widgets/focused_scroll_scaffold.dart';
import '../libraries/state_messages.dart';
import '../../i18n/strings.g.dart';
@@ -78,12 +79,16 @@ class _ProfileSwitchScreenState extends State<ProfileSwitchScreen> {
return Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 0, bottom: 8),
child: Card(
child: ProfileListTile(
user: user,
isCurrentUser: isCurrentUser,
autofocus: isFirstSelectable,
onTap: () => _switchToUser(context, user),
child: FocusableWrapper(
autofocus: isFirstSelectable,
disableScale: true,
onSelect: isCurrentUser ? null : () => _switchToUser(context, user),
child: Card(
child: ProfileListTile(
user: user,
isCurrentUser: isCurrentUser,
onTap: () => _switchToUser(context, user),
),
),
),
);