Flutter Navigator not working

前端 未结 6 1102
死守一世寂寞
死守一世寂寞 2020-12-09 11:04

I have app with two screens, and I want to make push from 1st to second screen by pressing button.

Screen 1

import \'package:flutter/m         


        
6条回答
  •  长情又很酷
    2020-12-09 11:59

    Make sure route table mentioned in same context:

      @override
      Widget build(BuildContext context) {
    
        return MaterialApp(
           home: FutureBuilder(future: _isUserLoggedIn(),
                       builder: (ctx, loginSnapshot) => 
                       loginSnapshot.connectionState == ConnectionState.waiting ?
                       SplashScreen() : loginSnapshot.data == true ?  AppLandingScreen(): SignUpScreen()
                    ),
           routes: {
             AppLandingScreen.routeName: (ctx) => AppLandingScreen(),
          },
    
        );
    
    
    
      }
    

    I faced this issue because i define route table in different build method.

提交回复
热议问题