build method
dynamic
build
(- dynamic context
)
Implementation
@override
Widget build(BuildContext context) {
return Scaffold(
body: BlocListener<AuthenticationBloc, AuthenticationState>(
listener: (context, state) {
if (state is AuthenticationFailure) {
final SnackBar snackbar = SnackBar(
content: Text(
state.errorMessage,
textAlign: TextAlign.center,
));
Scaffold.of(context).showSnackBar(snackbar);
} else if (state is AwaitEmailVerify) {
final SnackBar snackbar = SnackBar(
content: Text(
"Please check your email for verification",
textAlign: TextAlign.center,
));
Scaffold.of(context).showSnackBar(snackbar);
}
}, child: BlocBuilder<AuthenticationBloc, AuthenticationState>(
builder: (context, state) {
if (state is AuthenticationInit) {
return Theme(
data: Theme.of(context).copyWith(canvasColor: Colors.transparent),
child: SignupUI());
} else if (state is AuthenticationSuccess) {
return homePage;
} else if (state is AuthenticationFailure) {
return Theme(
data: Theme.of(context).copyWith(canvasColor: Colors.transparent),
child: SignupUI());
} else if (state is AwaitEmailVerify) {
return Theme(
data: Theme.of(context).copyWith(canvasColor: Colors.transparent),
child: SignupUI());
} else {
return Center(child: Text("bruh moment occured"));
}
})));
}