7
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Flutterでdrawerを利用した遷移時にdrawerを閉じる方法

Posted at

onTap内で下記のようにpopした後、pushする。

            ListTile(
              onTap: () {
                Navigator.of(context).pop();
                Navigator.of(context).push(
                  MaterialPageRoute(
                    builder: (context) {
                      return ContactsPage();
                    },
                  ),
                );
              },

popでdrawerが開く前になり、pushで遷移先のページに移動するため、遷移先のページから戻ってきた際にdrawerが閉じられたページに移動できる。

参考

How to close Scaffold's drawer after an item tap?

7
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?