Sitemap
Complete Flutter Guide

Flutter complete course from absolute beginner to advance topics

Member-only story

BottomSheet in Flutter

--

A Bottom Sheet is a UI element that slides up from the bottom of the screen. It’s a versatile way to present supplementary content or actions to the user without completely obscuring the main app content. They are commonly used for things like filters, settings menus, or sharing options.

Types of Bottom Sheets

There are two main types of Bottom Sheets in Flutter:

  1. Modal Bottom Sheet: This type of bottom sheet disables interaction with the main content behind it. It requires user interaction (like button clicks) to dismiss it.
  2. Persistent Bottom Sheet: This type of bottom sheet allows the user to interact with the content behind it. It can be dragged up or down to dismiss or reveal more content.

Showing a Modal Bottom Sheet with Button Press

Here’s an example of showing a modal bottom sheet with a button press event:

import 'package:flutter/material.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo'),
);
}
}

class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;

@override
State<MyHomePage>…

--

--

Haider Ali
Haider Ali

Written by Haider Ali

With an MSc in Computer Science earned in 1993, I bring over three decades of expertise in Java, Python, Django, PHP, and Flutter.

Complete Flutter Guide
Complete Flutter Guide

Published in Complete Flutter Guide

Flutter complete course from absolute beginner to advance topics