CNNavigationBar.scrollable constructor
const
CNNavigationBar.scrollable({
- Key? key,
- List<
CNNavigationBarAction> ? leading, - String? title,
- double? titleSize,
- VoidCallback? onTitlePressed,
- List<
CNNavigationBarAction> ? trailing, - required Widget? scrollableContent,
- bool largeTitle = true,
- bool transparent = false,
- Color? tint,
- double? height,
- List<
String> ? segmentedControlLabels, - int? segmentedControlSelectedIndex,
- ValueChanged<
int> ? onSegmentedControlValueChanged, - double? segmentedControlHeight,
- double? segmentedControlLabelSize,
- Color? segmentedControlTint,
Creates a navigation bar with native UINavigationController and scroll view.
This enables proper iOS large title behavior where the title automatically collapses into the center when scrolling up. The navigation bar is embedded in a native UINavigationController with the provided content in a UIScrollView.
Note: This is only available on iOS. On other platforms, it falls back to a standard navigation bar.
Example:
CNNavigationBar.scrollable(
title: 'Settings',
largeTitle: true, // Will collapse on scroll
content: ListView(
children: [
// Your scrollable content
],
),
leading: [CNNavigationBarAction(icon: CNSymbol('chevron.left'), onPressed: () {})],
)
Implementation
const CNNavigationBar.scrollable({
super.key,
this.leading,
this.title,
this.titleSize,
this.onTitlePressed,
this.trailing,
required this.scrollableContent,
this.largeTitle = true,
this.transparent = false,
this.tint,
this.height,
this.segmentedControlLabels,
this.segmentedControlSelectedIndex,
this.onSegmentedControlValueChanged,
this.segmentedControlHeight,
this.segmentedControlLabelSize,
this.segmentedControlTint,
}) : searchConfig = null,
_isSearchEnabled = false,
_isScrollable = true;