mirror of https://github.com/flutter/samples.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
37 lines
1.0 KiB
import 'package:flutter/cupertino.dart';
|
|
|
|
class AlertDialogPage extends StatelessWidget {
|
|
const AlertDialogPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return CupertinoPageScaffold(
|
|
navigationBar: const CupertinoNavigationBar(
|
|
middle: Text('Alert Dialog'),
|
|
),
|
|
child: Center(
|
|
child: CupertinoButton(
|
|
child: const Text('Show Alert Dialog'),
|
|
onPressed: () {
|
|
showCupertinoDialog<void>(
|
|
context: context,
|
|
builder: (BuildContext context) => CupertinoAlertDialog(
|
|
title: const Text('Alert'),
|
|
content: const Text('This is a sample alert dialog.'),
|
|
actions: <CupertinoDialogAction>[
|
|
CupertinoDialogAction(
|
|
child: const Text('OK'),
|
|
onPressed: () {
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|