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?

【Flutter】 PopUntilした際に画面が真っ暗になった

Posted at

RouteSettingsを指定していなかったことが原因

quiz_outline.dart
child: AppBar(
                automaticallyImplyLeading: false,
                backgroundColor: AppTheme.gameMainColor,
                iconTheme: const IconThemeData(color: AppTheme.subColor),
                elevation: 0,
                leading: IconButton(
                  icon: const Icon(Icons.arrow_back_ios),
                  onPressed: () {
                    Navigator.popUntil(context, ModalRoute.withName('/gametop'));
                  },
                ),
              ),
top_page.dart
  openQuizPage(BuildContext context) {
    Navigator.of(context).push(MaterialPageRoute(
      settings: const RouteSettings(name: '/gametop'),
      builder: (context) => const GameTopPage()
    ));
  }

quiz_outline.dartでpopUntil()を使用し、正常にGameTopページに遷移するためには、
pushした際にしっかりとsettings: const RouteSettings(name: '/gametop'),
でルートにRouteSettingを渡しておく必要がある。
これがないと、popUntil()で戻る際にページを見つけることができなくなり、真っ黒になっていた

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?