flutter progresshud code example
Example: hud flutter
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);
}
},
),
],
}