0
0

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 1 year has passed since last update.

【persistent_bottom_nav_bar】pushAndRemoveUntil で BottomNavigationBar を非表示にし画面遷移する方法

Posted at

発生事象

下記 Flutter のパッケージ「persistent_bottom_nav_bar」を使用している状態で、pushAndRemoveUntil を使用し画面遷移を実施したが、BottomNavigationBar が非表示にならない

また、pushNewScreen メソッドにある withNavBar プロパティを使用することで BottomNavigationBar の制御を実施することができるが、pushNewScreen メソッドはページをスタックに追加するため、前の画面に戻れてしまう問題も発生しているため、pushNewScreen メソッドを使用することはできなかった

回避策

「rootNavigator: true」を使用することで回避可能

Navigator.of(context, rootNavigator: true).pushAndRemoveUntil(
    MaterialPageRoute(
        builder: (BuildContext context) {
        return LoginScreen();
        },
    ),
    (_) => false,
);

参考ドキュメント

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?