main.dart
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
void main() => runApp(new CupertinoApp(
home: Home(),
debugShowCheckedModeBanner: false,
));
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text("Alert Dialog"),
),
child: Container(
child: Center(
child: CupertinoButton(
onPressed: () {
showCupertinoDialog(
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: Text("Warning"),
content: Text("Are you sure want to delete this data?"),
actions: <Widget>[
CupertinoDialogAction(
child: Text("No"),
onPressed: () {
},
),
CupertinoDialogAction(
child: Text("Yes"),
onPressed: () {
},
isDestructiveAction: true,
),
],
);
});
},
child: Text("Tap me"),
),
),
),
);
}
}