Try this:
InkWell(
onTap: () async {
showModalBottomSheet(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16.0),
),
backgroundColor: Colors.white,
builder: (BuildContext context) {
return Column(
children: [
ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
child: Text('Botton 1')),
SizedBox(
height: 20,
),
ElevatedButton(
onPressed: () {}, child: Text('Botton 2'))
],
);
},
context: context);
},
child: Text('show'),
),
For keeping state in `BottomNavigationBar`, you can use `IndexedStack`
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: BottomNavigationBar(
onTap: (index) {
setState(() {
current_tab = index;
});
},
currentIndex: current_tab,
items: [
BottomNavigationBarItem(
...
),
BottomNavigationBarItem(
...
),
],
),
body: IndexedStack(
children: <Widget>[
PageOne(),
PageTwo(),
],
index: current_tab,
),
);
}