Flutter Bottom Sheet - Creating a Bottom Sheet in Flutter

 If you're building a Flutter app and need to display some additional content or options without taking up too much space on the screen, a bottom sheet can be a great solution. In this guide, we'll walk you through the steps of creating a bottom sheet in Flutter. here is the full code. 


Widget showModalBottomSheet(BuildContext context) {
return Container(
height: Get.height / 3,
decoration: BoxDecoration(
color: cardbackgroundColor,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10), topRight: Radius.circular(10))),
child: Center(
child: Stack(children: [
Positioned(
top: 5,
left: 19,
right: 19,
child: Center(
child: InkWell(
onTap: () {
Get.back();
},
child: Container(
height: 5,
width: Get.width / 4,
decoration: const BoxDecoration(color: Color(0xFFE6E9ED)),
),
))),
Positioned(
top: 25,
left: 20,
right: 20,
child: Center(
child: Text("Close_Account".tr,
style: AppUtility.closeTextStyle2),
)),
Positioned(
top: 70,
left: 20,
right: 20,
child: Column(children: [
Text(
"Dummy content lorem velit qui adipisicing sunt"
 "do reprehenderit ad laborum tempor ullamco exercitation.",
style: AppUtility.closeTextStyle3),
const SizedBox(
height: spaceHeight,
),
SizedBox(
width: Get.width,
height: 40,
child: TextButton(
style: ButtonStyle(
maximumSize: MaterialStateProperty.all(Size(200, 100)),
backgroundColor: MaterialStateProperty.all<Color>(red),
shape:
MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0),
),
),
),
onPressed: () {},
child: const Text(
"Close Account",
style: TextStyle(color: white),
),
),
),
const SizedBox(
height: spaceHeight,
),
InkWell(
onTap: () {
Get.back();
},
child: Text(
"Cancel",
style: AppUtility.smallTextStyle6,
),
)
])),
]),
));
}
   

just call showModalBottomSheet from button click .






1 Comments

Thank you

Previous Post Next Post