Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- class NewWidget extends StatelessWidget {
- Future<void> showAlertDialog(BuildContext context) async {
- return showDialog<void>(
- context: context,
- barrierDismissible: false, // user must tap button!
- builder: (BuildContext context) {
- return AlertDialog(
- title: const Text('Success Verify'),
- content: SingleChildScrollView(
- child: ListBody(
- children: const <Widget>[
- Text('Are you sure you want to cancel booking?'),
- ],
- ),
- ),
- actions: <Widget>[
- TextButton(
- child: const Text('No'),
- onPressed: () {
- Navigator.push(
- context,
- MaterialPageRoute(builder: (context) => Home()),
- );
- },
- ),
- ],
- );
- },
- );
- }
- @override
- Widget build(BuildContext context) {
- return Container(
- // Add your widget code here
- // For example, you can use a RaisedButton to trigger the dialog:
- child: RaisedButton(
- onPressed: () {
- showAlertDialog(context);
- },
- child: const Text('Open Dialog'),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement