widgetInfo function
Implementation
Widget widgetInfo(
String widgetId,
AppUserModel appUserModel,
) {
return Center(
child: Column(children: [
BlocConsumer<WidgetBloc, WidgetBlocState>(
listener: (context, state) {
if (state is GetWidgetInfoErrorState) {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (BuildContext context) => const ErrorPage(
title: 'Error initializing widget',
message: 'Please check your widget configuration',
)));
}
},
builder: (context, state) {
if (state is GetWidgetInfoLoadedState) {
var data = state.data;
return LoginScreen(
widgetId: data.widgetUuid ?? '',
data: data,
appUserModel: appUserModel);
} else if (state is GetWidgetInfoLoadingState ||
state is WidgetInitialState) {
return const Column(
children: [
SizedBox(
height: 300,
),
Center(child: CircularProgressIndicator())
],
);
} else {
return Container();
}
},
),
]),
);
}