Skip to content

Fixes/tabbar focus shifting - #2372

Open
usmanvrtx wants to merge 4 commits into
android_TV_implementationfrom
fixes/tabbar-focus-shifting
Open

usmanvrtx wants to merge 4 commits into
android_TV_implementationfrom
fixes/tabbar-focus-shifting

Conversation

@usmanvrtx

@usmanvrtx usmanvrtx commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Description

This PR improves TV focus scrolling and TabBar navigation, and adds bounded content sizing for TV ListViews.

Related Issue

N/A

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring

What Has Changed

TV focus scrolling

  • Preserved legacy visibility scrolling for existing widgets.
  • Added route-scoped tracking of the active vertical scrollable.
  • Added resetScrollOnFocus for resetting page scroll when a configured widget receives focus.
  • Cleared remembered scrollables when routes are removed, replaced, or popped.
  • Preserved vertical and horizontal scrolling behavior without changing focus row/order semantics.

TabBar focus behavior

  • Added revealTabBarOnFocus as an opt-in TV option.
  • Preserved legacy behavior by default.
  • When enabled, focusing a tab reveals the enclosing TabBar instead of only the tab.
  • Added horizontal tab-strip scrolling.
  • Respects verticalScrollPadding.
  • TabBar autofocus now follows the configured autofocus value.
  • Added regression coverage for legacy TabBar reveal behavior.

ListView sizing

  • Added minHeight support to ListView styles and schema.
  • Added bounded content fitting for:
    shrinkWrap: true
    minHeight: ...
    maxHeight: ...
  • ListView height is calculated as:
    clamp(contentHeight, minHeight, maxHeight)
    
  • Preserved the existing TV scrollbar Row layout.
  • Removed the previous fitContent/minHeight measurement implementation in favor of the new bounded sizing behavior.

Usage

ListView:
  styles:
    minHeight: ${device.height * 0.2}
    maxHeight: ${device.height * 0.6}
    shrinkWrap: true
    flexMode: none
    tvOptions:
      row: 1
      order: 0
      revealTabBarOnFocus: true

For scroll reset:

tvOptions:
  resetScrollOnFocus: true

How to Test

cd modules/ensemble

flutter test test/widget/list_view_core_test.dart

flutter test test/widget/tab_bar_index_test.dart \
  --plain-name 'TabBar does not reveal the whole bar unless enabled'

flutter analyze \
  lib/layout/list_view.dart \
  lib/framework/tv/tv_scrollbar_widget.dart

Also verify the ListView and TV focus behavior on the target TV host layout.

Screenshots / Videos

N/A

Checklist

  • Focused tests pass
  • Schema JSON validation passes
  • git diff --check passes
  • Tested on the relevant TV platform
  • Added dedicated ListView sizing regression tests
  • No new analyzer warnings introduced

@usmanvrtx usmanvrtx self-assigned this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant