"Fossies" - the Fresh Open Source Software Archive 
Member "flutter-3.7.1/examples/api/lib/material/dialog/alert_dialog.0.dart" (1 Feb 2023, 1405 Bytes) of package /linux/misc/flutter-3.7.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Dart source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the last
Fossies "Diffs" side-by-side code changes report for "alert_dialog.0.dart":
3.3.10_vs_3.7.0.
1 // Copyright 2014 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /// Flutter code sample for [AlertDialog].
6
7 import 'package:flutter/material.dart';
8
9 void main() => runApp(const MyApp());
10
11 class MyApp extends StatelessWidget {
12 const MyApp({super.key});
13
14 @override
15 Widget build(BuildContext context) {
16 return MaterialApp(
17 home: Scaffold(
18 appBar: AppBar(title: const Text('AlertDialog Sample')),
19 body: const Center(
20 child: DialogExample(),
21 ),
22 ),
23 );
24 }
25 }
26
27 class DialogExample extends StatelessWidget {
28 const DialogExample({super.key});
29
30 @override
31 Widget build(BuildContext context) {
32 return TextButton(
33 onPressed: () => showDialog<String>(
34 context: context,
35 builder: (BuildContext context) => AlertDialog(
36 title: const Text('AlertDialog Title'),
37 content: const Text('AlertDialog description'),
38 actions: <Widget>[
39 TextButton(
40 onPressed: () => Navigator.pop(context, 'Cancel'),
41 child: const Text('Cancel'),
42 ),
43 TextButton(
44 onPressed: () => Navigator.pop(context, 'OK'),
45 child: const Text('OK'),
46 ),
47 ],
48 ),
49 ),
50 child: const Text('Show Dialog'),
51 );
52 }
53 }