To synchronize the ConvexAppBar with a TabBarView or PageView (allowing swipe gestures to update the bar), you can provide a TabController to the ConvexAppBar via the controller property.
Using DefaultTabController
You can wrap your widget tree in a DefaultTabController to simplify implementation. The ConvexAppBar will automatically pick up the controller from the context.
Using a manual TabController
For more control, create your own TabController and pass it explicitly to both the TabBarView and the ConvexAppBar.
// Example 1: Using DefaultTabController
DefaultTabController(
length: 5,
child: Scaffold(
appBar: AppBar(title: const Text('Custom ConvexAppBar')),
body: TabBarView(
children: ['A','B','C','D','E']
.map((i) => Center(child: Text('$i')))
.toList(growable: false),
),
bottomNavigationBar: ConvexAppBar(/* some config*/),
),
);
// Example 2: Using a manual TabController
Scaffold(
appBar: AppBar(title: const Text('Custom ConvexAppBar')),
body: TabBarView(
controller: _tabController,
children: ['A','B','C','D','E']
.map((i) => Center(child: Text('$i')))
.toList(growable: false),
),
bottomNavigationBar: ConvexAppBar(controller: _tabController/* some config*/),
);