Skip to content

Instantly share code, notes, and snippets.

@hazzo
Created November 14, 2022 10:07
Show Gist options
  • Save hazzo/02a9e70431494925e492dbbc411a4dbe to your computer and use it in GitHub Desktop.
Save hazzo/02a9e70431494925e492dbbc411a4dbe to your computer and use it in GitHub Desktop.
Alert dialog
import 'package:flutter/material.dart';
void main() => runApp(App());
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Home(),
),
);
}
}
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return const AlertDialog(
title: Text('Alert Dialog'),
);
},
);
return Center(
child: Column(
children: const <Widget>[
Text('Show Material Dialog'),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment