CNNavigationBar.scrollable constructor

const CNNavigationBar.scrollable({
  1. Key? key,
  2. List<CNNavigationBarAction>? leading,
  3. String? title,
  4. double? titleSize,
  5. VoidCallback? onTitlePressed,
  6. List<CNNavigationBarAction>? trailing,
  7. required Widget? scrollableContent,
  8. bool largeTitle = true,
  9. bool transparent = false,
  10. Color? tint,
  11. double? height,
  12. List<String>? segmentedControlLabels,
  13. int? segmentedControlSelectedIndex,
  14. ValueChanged<int>? onSegmentedControlValueChanged,
  15. double? segmentedControlHeight,
  16. double? segmentedControlLabelSize,
  17. 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;