buildEditorHandler method
Implementation
@nonVirtual
Widget buildEditorHandler(BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback(
(_) => BlocProvider.of<EditorBloc>(context).add(AppStartedEvent()));
return BlocBuilder<EditorBloc, BaseState>(
buildWhen: (prevState, currState) {
return currState is LoadScreenState ||
currState is LoadComponentState ||
currState is ComponentUpdatedState;
},
builder: (context, state) {
if (state is LoadScreenState) {
log("Loading screen ${state.screenId}");
Navigator.of(context).popUntil((route) => route.isFirst);
return buildScreen(context, state.screenId, state: state.state);
} else if (state is LoadComponentState) {
log("Loading component ${state.componentId}");
Navigator.of(context).popUntil((route) => route.isFirst);
return _buildComponent(context, state.componentId);
} else if (state is ComponentUpdatedState) {
log("Updating component ${state.componentId}");
return _buildComponent(context, state.componentId);
}
return Container();
},
);
}