CNTabBarNative class
A configurable native iOS 26 tab bar — the full-screen native take-over
(UITabBarController via SwiftUI), with search, minimize-on-scroll,
a bottom accessory, native lists, and optional Flutter content
per tab — all driven from Dart.
A tab that wants the minimize behavior must supply a CNNativeList
(CNTab(..., nativeList: ...)) so iOS has a real native scroll view to
observe. A tab with no list and no search role hosts your Flutter content
(root mode) or a placeholder (modal). Native on iOS 26 and later and on
macOS; a no-op elsewhere.
On macOS the tabs become the window's native sidebar: the window's
content is put in an NSSplitViewController, with the tabs as sidebar
rows (their symbols, badges and selection) and the Flutter view beside
them, where it keeps working as before: the system's sidebar, Liquid
Glass on macOS 26 and later. The search tab becomes the sidebar's search
field:
typing selects the search tab and reports the text to onSearchChanged,
clearing it goes back to the previous tab. A tab with a CNNativeList
shows that list in place of the Flutter content, under the tab's title;
clicking a row calls onListItemTap. Every other tab shows the Flutter
content, whatever asRoot says, and the sidebar is always there
(sidebarOnWideScreens is implied). The callbacks are the same as on
iOS. bottomAccessory, minimizeBehavior and unselectedTintColor
have no Mac counterpart and are ignored, and a chevron row pushes no
detail page.
disable (or the close button with showCloseButton) puts the window
back as it was. The View menu gets the standard Show Sidebar command
(Control-Command-S) when the app's menu has none; with a CNToolbar, its
sidebar toggle and tracking separator apply to this sidebar.
On iPhone Duo (iOS 27.1, app built with Xcode 27.1) the tab bar moves to
the system vertical bar on its own — on the outer display, and in
landscape on the inner display. Pass sidebarOnWideScreens: true to turn
the tabs into a native sidebar on the open inner display: beside the
content in landscape, behind a sidebar button in portrait.
CNTabBarNative.enable(
tabs: [
CNTab(title: 'Feed', sfSymbol: CNSymbol('list.bullet'),
nativeList: CNNativeList(items: myItems)),
CNTab(title: 'Profile', sfSymbol: CNSymbol('person')),
CNTab(title: 'Search', isSearchTab: true),
],
minimizeBehavior: CNTabMinimizeBehavior.onScrollDown,
bottomAccessory: CNTabAccessory(text: 'Now playing', sfSymbol: CNSymbol('music.note')),
);
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
activateSearch(
) → Future< void> - Select the search tab.
-
deactivateSearch(
) → Future< void> - Clear the current search query.
-
disable(
) → Future< void> - Dismiss the native tab bar and return to the Flutter app.
-
enable(
{required List< CNTab> tabs, int selectedIndex = 0, CNTabMinimizeBehavior minimizeBehavior = CNTabMinimizeBehavior.onScrollDown, CNTabAccessory? bottomAccessory, Color? tintColor, Color? unselectedTintColor, bool? isDark, bool asRoot = false, bool nativeSearchFilter = true, bool sidebarOnWideScreens = false, bool showCloseButton = true, void onTabSelected(int index)?, void onListItemTap(int tabIndex, int itemIndex)?, void onSearchChanged(String query)?, VoidCallback? onAccessoryTap, VoidCallback? onDismissed}) → Future<void> -
Present the native tab bar configured from
tabs. -
setBadgeCounts(
List< int?> badgeCounts) → Future<void> - Update badge counts per tab (null/0 clears a badge).
-
setBottomAccessory(
CNTabAccessory? accessory) → Future< void> - Show, update, or hide the bottom accessory (pass null to hide).
-
setBrightness(
{required bool isDark}) → Future< void> - Switch between light and dark appearance.
-
setItems(
{required int tabIndex, required List< CNListItem> items}) → Future<void> -
Replace the native list items of the tab at
tabIndex. -
setMinimizeBehavior(
CNTabMinimizeBehavior behavior) → Future< void> - Change when the tab bar minimizes.
-
setSearchText(
String text) → Future< void> - Set the search field's text programmatically.
-
setSelectedIndex(
int index) → Future< void> -
Programmatically select the tab at
index. -
setStyle(
{Color? tintColor}) → Future< void> - Update the selected-tab tint color.