title: NavigatorPush is not working on my Flutter App
body: <p>I try to build simple login with laravel but then got stuck. After login success I can't redirect to another page with Navigator.push. I think I've followed the tutorial right.</p>
  <p>this is login.dart</p>
  <pre><code>class LoginScreen extends StatefulWidget {
    static const routeName = '/login-screen';
    const LoginScreen({Key? key}) : super(key: key);
  
    @override
    _LoginScreenState createState() =&gt; _LoginScreenState();
  }
  
  
  class _LoginScreenState extends State&lt;LoginScreen&gt; {
    TextEditingController txtUsername = new TextEditingController();
    TextEditingController txtPassword = new TextEditingController();
  
    @override
    Widget build(BuildContext context) {
      Size size = MediaQuery.of(context).size; //provide total height and width
      return Scaffold(
        body: Background(
          child1: SingleChildScrollView(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: &lt;Widget&gt;[
                Positioned(
                  top: 0,
                  left: 0,
                  child: Image.asset('assets/images/wedding.png', width: 250),
                ),
                SizedBox(height: size.height * 0.01),
                roundedInputField(
                  hintText: 'Email',
                  controller: txtUsername,
                  onChanged: (value) {},
                ),
                PasswordField(
                  hintText: 'Password',
                  controller: txtPassword,
                  onChanged: (value) {},
                ),
                Button(
                  text: 'LOGIN',
                  press: () {
                    this.doLogin();
                  },
                )
              ],
            ),
          ),
        ),
      );
    }
  
  
    void showToast(msg) =&gt; Fluttertoast.showToast(msg: msg);
  
    Future doLogin() async {
      WidgetsBinding.instance.focusManager.primaryFocus?.unfocus();
      if(txtUsername.text.isEmpty || txtPassword.text.isEmpty) {
        showToast('email/password kosong');
      }else {
        showDialog(
            context: context,
            builder: (context) {
              return Center(
                child: CircularProgressIndicator(),
              );
            });
  
        final response = await http.post(
            Uri.parse('http://10.0.2.2/flutter/api/login'),
            body: {'email': txtUsername.text, 'password': txtPassword.text},
            headers: {'Accept': 'application/json'}
        );
        final responseData = json.decode(response.body);
  
        if (response.statusCode == 200) {
          showToast('berhasil login');
           Navigator.push(
               context,
               MaterialPageRoute(
                 builder: (BuildContext context) =&gt; const NavbarScreen(),
               ));
          // Navigator.of(context).push(
          //  MaterialPageRoute(builder: (_){
          //      return NavbarScreen();
          //    },
          //  ),
          // );
          //print(responseData);
        } else {
          showToast('gagal login');
        }
        Navigator.of(context).pop(); //end loading
      }
    }
  
  
  
  }
  </code></pre>
  <p>This is the login logic in <strong>login.dart</strong></p>
  <pre><code>if (response.statusCode == 200) {
      showToast('berhasil login');
      Navigator.push(
          context,
          MaterialPageRoute(
            builder: (BuildContext context) =&gt; const NavbarScreen(),
          ));
      //print(responseData);
    } else {
      showToast('gagal login');
    }
  </code></pre>
  <p>This is main.dart</p>
  <pre><code>void main() {
    runApp(const MyApp());
  }
  
  class MyApp extends StatelessWidget {
    const MyApp({Key? key}) : super(key: key);
  
  
    // This widget is the root of your application.
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Breeze',
        theme: ThemeData(
          primaryColor: kPrimaryColor,
          scaffoldBackgroundColor: Colors.white,
        ),
        //home: DashboardScreen(),
        initialRoute: '/',
        routes: {
          '/': (ctx) =&gt; LoginScreen(),
          LoginScreen.routeName: (ctx) =&gt; LoginScreen(),
          NavbarScreen.routeName: (ctx) =&gt; NavbarScreen(),
          CheckinScreen.routeName: (ctx) =&gt; CheckinScreen(),
          CheckoutScreen.routeName: (ctx) =&gt; CheckoutScreen(),
        },
      );
    }
  }
  </code></pre>