How to create a persistent bottom sheet in Flutter?

This Article is posted by seven.srikanth at 05-06-2019 03:45:02

Click here to support us by Subscribing to our youtube channel.

In this article, I'm going to share an example code for persistent bottom sheet in Flutter.
Before seeing this code, here is the output of this app. 
Key things to note here are that touches on the empty area of the screen don't take away the bottom sheet. 
Before going further, let's get some basics on bottom sheets.
There are two kinds of bottom sheets in material design: Persistent and Modal. 
In this example, we are going to see Persistent type. 
For Modal bottom sheet, check this article. 
This gives an alternate behavior, where touches on the empty area of the screen should take away the bottom sheet
Another example, showing how to send data to the model sheet. 
Here is the full code of this sample. In order to run this, copy paste this code into main.dart file in your newly created flutter project. 
import 'package:flutter/material.dart';
void main() {
class MyApp extends StatefulWidget {
_MyAppState createState() => _MyAppState();
class _MyAppState extends State<MyApp> {
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
void _showBottomSheetCallback() {
_scaffoldKey.currentState.showBottomSheet<void>((BuildContext context) {
return Container(
decoration: BoxDecoration(
border: Border(top: BorderSide(color:,
color: Colors.grey
child: Padding(
padding: const EdgeInsets.all(32.0),
child: Text('This is a Material persistent bottom sheet. Drag downwards to dismiss it.',
style: TextStyle(
fontSize: 24.0,
Widget build(BuildContext context) {
return MaterialApp(
key: _scaffoldKey,
appBar: AppBar(
title: const Text('Persistent bottom sheet')
body: Center(
child: RaisedButton(
onPressed: _showBottomSheetCallback,
child: const Text('Show Persistent Bottom Sheet')
Hope this is helpful.

Tags: persistent bottom sheet; Bottom sheet that requires dragging to minimize or dismiss it;

Click here to support us by Subscribing to our youtube channel.

Login to comment.
Recent Comments

Be the first to Comment. You can ask a Query or Share your toughts or Just say thanks.

Wave animation in Flutter

Search Results

©2018 - Fluttercentral | Email to me -