I have a bottom tab bar.
When some conditions are met, I need to display a widget abode a given tab as follows:
For simplicity, I display a Text("ALERT") here, but in the real app it’ll be a tapable widget.
Text("ALERT")
How can I do that?
2
I finally found a solution in two steps:
Column
extendBody:true
Scaffold( extendBody: true, bottomNavigationBar: Column( mainAxisSize: MainAxisSize.min, children: [ Chip( label: Text("Draft pending"), backgroundColor: Colors.amber, ), bottomTabBar, ] ) // blah blah ),
Just wrap whatever widget you have (in your case Text widget for example) with a GestureDetector widget like this:
GestureDetector( onTap: () { setState(() { // What happens with the tap }); }, ),
Click here to cancel reply.
2
Answers
I finally found a solution in two steps:
Column
and insert the widget first, and the tabbar last: but this makes your bottom app appears taller than what one wants. This gives you:extendBody:true
which makes the area above the actual TabBar transparent so that removes the unwanted area:Just wrap whatever widget you have (in your case Text widget for example) with a GestureDetector widget like this: