In our app we're using a bottomSheet along with a bottomNavigationBar.
The bottomSheet appears above the bottomNavigationBar, is there a way to make it appear underneath?
Here's a sample app:
import 'package:flutter/material.dart';
void main() {
runApp(SampleApp());
}
class SampleApp extends StatefulWidget {
@override
_SampleAppState createState() => new _SampleAppState();
}
class _SampleAppState extends State<SampleApp> {
final _scaffoldKey = GlobalKey<ScaffoldState>();
PersistentBottomSheetController _sheetController;
@override
Widget build(BuildContext context) {
final _showBottomSheet = () {
_sheetController = _scaffoldKey.currentState.showBottomSheet((context) {
return Container(
color: Colors.grey[200],
child: Column(mainAxisSize: MainAxisSize.min, children: [
RadioListTile(dense: true, title: Text('Test'), groupValue: 'test', onChanged: (value) {}, value: true),
RadioListTile(dense: true, title: Text('Test'), groupValue: 'test', onChanged: (value) {}, value: true),
]));
});
};
return MaterialApp(
home: Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: Text('Sample App'),
),
bottomNavigationBar: Container(
child: IconButton(
icon: Icon(Icons.edit),
onPressed: _showBottomSheet,
),
),
),
);
}
}
add : useRootNavigator: true,
showModalBottomSheet(
context: context,
useRootNavigator: true,
builder: (context) {},
);
Noticed your question. Had same problem and found better solution. Use showModalBottomSheet()
. It will overlay bottom navigation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With