LoadingBlocBuilder<B extends BlocBase<S> , S> constructor
const
LoadingBlocBuilder<B extends BlocBase<S> , S> ({
- required LoadingStatus statusGetter(
- S
- required Widget successBuilder(
- BuildContext,
- S
- Widget initialBuilder(
- BuildContext,
- S
- Widget failureBuilder(
- BuildContext,
- S
- Widget loadingBuilder(
- BuildContext,
- S
- Key? key,
A special BlocBuilder
for displaying the lifecycle of a state with
a LoadingStatus.
Example:
LoadingBlocBuilder<TestingBloc, TestingState>(
statusGetter: (state) => state.status,
initialBuilder: (_, _state) => const Text('Initial'),
loadingBuilder: (_, _state) => const Text('Loading'),
successBuilder: (_, _state) => const Text('Success'),
failureBuilder: (_, _state) => const Text('Failure'),
),
- The successBuilder is the only builder strictly required.
- If loadingBuilder is not supplied, a CircularProgressIndicator will be rendered.
- If initialBuilder is not supplied, a SizedBox will be rendered.
- If failureBuilder is not supplied, an Icon with Icons.error will be rendered.
Implementation
const LoadingBlocBuilder({
required this.statusGetter,
required this.successBuilder,
this.initialBuilder,
this.failureBuilder,
this.loadingBuilder,
Key? key,
}) : super(key: key);