How run code after showDialog is dismissed in Flutter?

前端 未结 7 1443
心在旅途
心在旅途 2021-02-05 01:11

How to update the Homepage just after the showDialog() is dismissed/disposed? Doesn\'t seem like it has an onDispose() function.

Found another

7条回答
  •  粉色の甜心
    2021-02-05 01:22

    Mobile apps typically reveal their contents via full-screen elements called "screens" or "pages". In Flutter these elements are called routes and they're managed by a Navigator widget. The navigator manages a stack of Route objects and provides methods for managing the stack, like Navigator.push and Navigator.pop.

    showDialog(
                context: context,
                child: new AlertDialog(
                    title: const Text("Your Title"),
                    content: const Text(
                      ...
                       Your Message
                      ...),
                    actions: [
                    new FlatButton(
                      child: const Text("Ok"),
                      onPressed: () => Navigator.pop(context),
                    ),
                  ],
                ),
            );
    

    You can check Official Document

提交回复
热议问题