When I use scaffoldmessenger to show snackbar it is shown behind the bottom sheet. When I wrap my bottom sheet with scaffold it is working fine .. but the bottom sheet is stretched for a full screen instead of showing at the bottom for a fixed height.. I know there are a lot of questions with same concept but nothing worked for me
onPressed: () {
showModalBottomSheet(
isScrollControlled: true,
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(25),
topRight: Radius.circular(25),
),
),
builder: (BuildContext context) {
return Scaffold(
body: Stack(children: [
Positioned(
bottom: 0,
top: 0,
right: 0,
child: SingleChildScrollView(
child: AnimatedPadding(
padding: MediaQuery.of(context).viewInsets,
duration: const Duration(milliseconds: 100),
curve: Curves.decelerate,
child: AddContactSection(myUID: myUID),
),
),
),
]),
);
});
},
2
Answers
Something like this, use
_isBottomSheetVisible
to determine whether to show the bottom sheet:Just add another
Scaffold()
to yourBottom Sheet
and pass it to your newscaffold key