Skip to content

v1.4.2

@gunumdogdu gunumdogdu tagged this 17 Apr 22:06
CNTabBar auto-hide while full-screen sheet is presented (Issue #31)

Adds `CNTabBarRouteObserver` (NavigatorObserver) and `CNTabBar.autoHideOnModal`.
With one line of setup the tab bar disappears while a full-screen sheet
(CupertinoSheetRoute, ModalBottomSheetRoute) is on top and reappears
when dismissed — matching iOS UITabBarController's native behaviour and
fixing the z-order bug where Flutter-rendered TextFields inside the
sheet were invisible behind the tab bar's native UIView.

Auto-hide is intentionally narrow: only routes whose runtime type name
contains `Sheet`. Action-sheet popups, dialogs, and regular page pushes
do NOT trigger auto-hide — those don't fully cover the bar and the
platform-view recreate animation would look ugly on quick popups.

Setup:
  CupertinoApp(
    navigatorObservers: [CNTabBarRouteObserver()],
    ...
  )

Opt-out per-bar: CNTabBar(autoHideOnModal: false, ...)

Also fixes a related bug in `_onCreated`: the order of the post-create
calls was `refresh -> setSelectedIndex`, but native `refresh` captures
`bar.selectedItem` at start and asynchronously cycles + restores. That
restored the stale creationParams selectedIndex (0) over the
setSelectedIndex we'd just sent. Swapped the order to setSelectedIndex
-> refresh; refresh now captures the correct index.

Pana: 160/160.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Assets 2
Loading