Phil
0
Q:

hud flutter

Used to add loading..... when logging in and during registration
1

  bool spooner = false;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: ModalProgressHUD(
        inAsyncCall: spooner,
        child: RoundedButton(
                title: 'Register',
                color: Colors.lightBlueAccent,
                onPressed: () async {
                  setState(() {
                    spooner = true;
                  });
                  try {
                    final newUser = await _auth.createUserWithEmailAndPassword(
                        email: email, password: password);
                    if (newUser != null) {
                      Navigator.pushNamed(context, ChatScreen.id);
                    }
                    setState(() {
                      spooner = false;
                    });
                  } catch (e) {
                    print(e);
                  }
                },
              ),
            ],
}
0

New to Communities?

Join the community