Flutter Close Dialog

Návrhy budoucích změn v modulu a diskuze o provedených změnách.

Flutter Close Dialog

Příspěvekod ABakhsh » 20 črc 2022 12:46

Flutter Close Dialog
The Dialog widget in Flutter pops up on the screen to get confirmation regarding the critical/irreversible task or let users know about the crucial information about the app. The dialog widget quickly draws the user’s attention by appearing in the center of the screen. When it appears it may or may not allow users to interact with other UI elements of your app and can be dismissed by clicking outside of a dialog. So in this tutorial, we’ll see how you can show 2 types of Flutter Dialog that include AlertDialog and SimpleDialog with practical examples.

https://codeprozone.com/code/dart/147803/flutter-close-dialog.html
flutter close dialog
Kód: Vybrat vše
showDialog(
    context: context,
    builder: (_) {
      return AlertDialog(
        title: Text('Wanna Exit?'),
        actions: [
          FlatButton(
            onPressed: () => Navigator.pop(context, false), // passing false
            child: Text('No'),
          ),
          FlatButton(
            onPressed: () => Navigator.pop(context, true), // passing true
            child: Text('Yes'),
          ),
        ],
      );
    }).then((exit) {
  if (exit == null) return;

  if (exit) {
    // user pressed Yes button
  } else {
    // user pressed No button
  }
});



show dialog close flutter
Kód: Vybrat vše
BuildContext dialogContext; // <<----
  showDialog(
    context: context, // <<----
    barrierDismissible: false,
    builder: (BuildContext context) {
      dialogContext = context;
      return Dialog(
        child: new Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            new CircularProgressIndicator(),
            new Text("Loading"),
          ],
        ),
      );
    },
  );

  await _longOperation();
  Navigator.pop(dialogContext); // <<----
ABakhsh
Level 2
 
Příspěvky: 2
Registrován: 20 črc 2022 12:44

Re: Flutter Close Dialog

Příspěvekod weslo » 09 zář 2023 16:28

weslo
Level Spam Master
 
Příspěvky: 782126
Registrován: 13 říj 2021 07:50


Zpět na Diskuse o úpravách v modulu

Kdo je online

Uživatelé procházející toto fórum: Žádní registrovaní uživatelé a 3 návštevníků