Tags
Flutter
Asked 2 years ago
18 Oct 2021
Views 639
Etha

Etha posted

Flutter : AlertDialog box

Flutter : AlertDialog box
chirag

chirag
answered Oct 18 '21 00:00

AlertDialog show the alert box as the javascript alert works
it will prompt dialogbox from showDialog , in that we use AlertDialog which have title , content , and actions .
title : title should be title of the AlertDialog
content : content will be the content of the AlertDialog
actions :action can be button which can be used to trigger actions


  Padding(
                  padding: EdgeInsets.only(right: 20.0),
                  child: GestureDetector(
                    onTap: () {
                      showDialog(
                          context: context,
                          builder: (ctx) => AlertDialog(
                                title: Text('This is test'),
                                content: Text('This is test so dont worry '),
                                actions: <Widget>[
                                  TextButton(
                                    onPressed: () {
                                      Navigator.of(ctx).pop();
                                    },
                                    child: Text("okay"),
                                  ),
                                ],
                              ));
                    },
                    child: Icon(
                      Icons.search,
                      size: 26.0,
                    ),
                  )),
Post Answer