Alert Dialog box in Flutter Last Updated : 28 Feb, 2025 Comments Improve Suggest changes Like Article Like Report Alert Dialog box informs the user about the situation that requires acknowledgment. Alert Box is a prompt that takes user confirmation. The very basic use of the alert box is used when we close the app, usually, we are notified with a prompt whether we want to exit or not. That's an alert box.The below-added code shows how to perform alert Dialog box in flutter. I have used a button (Elevated Button in flutter ) to trigger the alert dialog box. In its onPressed property, we have to use the showDialog widget of flutter. It takes context and a builder. In builder, we provide the AlertDialog widget with title, content(Description of a title), and actions (Yes or no buttons), and our alert dialog box is ready to use.Key Properties of Alter Dialog BoxPropertyDescriptionactionsThe set of actions that are displayed at the bottom of the dialog boxtitleThe title of the dialog is displayed in a large font at the top of the dialogcontentThis gives a message/ description about the title which you have provided to the Alert Dialog boxbackgroundColorIt provides the background color to the widget which is being used inelevationElevation provided height to the widget, It gives a default shadow to the widgetFlutter provides its own show Dialog widget which is used to show Dialog box.Example: Dart import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return const MaterialApp( home: HomePage(), ); } } class HomePage extends StatefulWidget { const HomePage({Key? key}) : super(key: key); @override // ignore: library_private_types_in_public_api _HomePageState createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text("GeeksForGeeks"), foregroundColor: Colors.white, backgroundColor: Colors.green, ), body: Center( child: ElevatedButton( style: ElevatedButton.styleFrom( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(0), ), ), onPressed: () { // Show an alert dialog when the button is pressed showDialog( context: context, builder: (ctx) => AlertDialog( title: const Text("Alert Dialog Box"), content: const Text("You have raised an Alert Dialog Box"), actions: <Widget>[ TextButton( onPressed: () { Navigator.of(ctx).pop(); }, child: const Text("okay"), ), ], ), ); }, child: const Text("Show alert Dialog box"), ), ), ); } } Output: Implementing Simple and Custom Alert Dialog in Flutter Application Comment More infoAdvertise with us A AkashDubey3 Follow Improve Article Tags : Flutter Flutter Flutter UI-components Explore BasicsFlutter Tutorial7 min readFlutter | An introduction to the open source SDK by Google5 min readFlutter - Architecture Application3 min readAndroid Studio Setup for Flutter Development3 min readGetting Started with Cross-Platform Mobile Application using Flutter7 min readFlutter Development in Ubuntu 20.045 min readKey WidgetsWhat is Widgets in Flutter?5 min readContainer class in Flutter8 min readScaffold class in Flutter with Examples8 min readMaterialApp class in Flutter7 min readDrawer Widget in Flutter5 min readFlutter - AppBar Widget7 min readFlutter - RichText Widget3 min readUI ComponentsFlutter - Tabs2 min readFlutter - Horizontal List3 min readFlutter - Expansion Tile Card3 min readIcon Class in Flutter2 min readExpanded Class in Flutter3 min readFlutter - Dialogs5 min readFlutter - Circular & Linear Progress Indicators4 min readFlutter - Staggered Grid View4 min readDesign & AnimationsCustomizing Fonts in Flutter4 min readFlutter - Skeleton Text3 min readFlutter - Themes3 min readFlutter - Lazy Loader5 min readFlutter - UI Orientation2 min readFlutter - Animation in Route Transition3 min readFlutter - Physics Simulation in Animation4 min readFlutter - Radial Hero Animation3 min readFlutter - Hinge Animation4 min readFlutter - Lottie Animation3 min readForms & GesturesForm Validation in Flutter3 min readDesigning a Form Submission Page in Flutter3 min readFlutter - Gestures3 min readNavigation & RoutingURLs in Flutter5 min readRoutes and Navigator in Flutter4 min readFlutter - WebSockets3 min readFlutter - Named Routes3 min readFlutter - Arguments in Named Routes4 min readMulti Page Applications in Flutter5 min readFlutter - Updating Data on the Internet5 min readFlutter - Fetching Data From the Internet4 min readFlutter - Deleting Data On The Internet4 min readFlutter - Sending Data To The Internet5 min readFlutter - Send Data to Screen4 min readHardware InteractionGallery Access and Camera in Flutter3 min readCamera Access in Flutter3 min readBackground local notifications in Flutter6 min readRestrict Landscape mode in Flutter2 min readSample Flutter AppsBasic Quiz App In Flutter8 min readA Hello World App using Flutter3 min readFlutter - Simple PDF Generating App9 min readFlutter - Magic 8 Ball App3 min readAdvance ConceptsFlutter - Read and Write Data on Firebase4 min readMail and SMS in Flutter5 min readMaking Calls in Flutter7 min readFAB - Speed Dial in Flutter5 min readFlutter Wakelock3 min readHTTP GET Request in Flutter3 min read Like