I would like to know if there is a way to dock a floating action button in a CupertinoTabBar. I would like to get the results as in the picture below
My screen is organized as follow
- CupertinoTabScaffold
- CupertinoTabView
- CupertinoPageScaffold
- CupertinoNavigationBar
- Scaffold
- CupertinoPageScaffold
- CupertinoTabBar
- CupertinoTabView
I have tried to add the following code to my Scaffold but the result is not what I want. I understand the issue is that the TabBar is not inside the scaffold hence it is not docked however I am wondering if there is a way to put the floating button somewhere else to get to the result I want
Here is the code
child: Scaffold(
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: FloatingActionButton.extended(
backgroundColor: kColorAccent,
onPressed: () {},
label: Text('To my Favorites!'),
icon: Icon(Icons.favorite),
),
And here is the result I get...




For some of you looking for a code snippet, I'll give you a working example.
Point is
use
scaffold. If you useCupertinoTabScaffold, then you'll not be able to useFloatingActionbutton.you can move
FABinto whatever position usingfloatingActionButtonLocation.you need
StatefulWidgetor something similar to that to handleindexchange.