Unverified Commit f3fad81b authored by Alabhya's avatar Alabhya Committed by GitHub

[Api docs] Dartpad demo for alert dialog. (#75291)

* Alert dialog dartpad demo

* Updated description
parent 66659229
......@@ -218,6 +218,39 @@ class Dialog extends StatelessWidget {
/// ```
/// {@end-tool}
///
/// {@tool dartpad --template=stateless_widget_scaffold_center}
///
/// This demo shows a [TextButton] which when pressed, calls [showDialog]. When called, this method
/// displays a Material dialog above the current contents of the app and returns
/// a [Future] that completes when the dialog is dismissed.
///
/// ```dart
/// Widget build(BuildContext context) {
/// return TextButton(
/// onPressed: () => showDialog<String>(
/// context: context,
/// builder: (BuildContext context) => AlertDialog(
/// title: const Text('AlertDialog Tilte'),
/// content: const Text('AlertDialog description'),
/// actions: [
/// TextButton(
/// onPressed: () => Navigator.pop(context, 'Cancel'),
/// child: const Text('Cancel'),
/// ),
/// TextButton(
/// onPressed: () => Navigator.pop(context, 'OK'),
/// child: const Text('OK'),
/// ),
/// ],
/// ),
/// ),
/// child: Text('Show Dialog'),
/// );
/// }
///
/// ```
/// {@end-tool}
///
/// See also:
///
/// * [SimpleDialog], which handles the scrolling of the contents but has no [actions].
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment