view library
This library provides view builders.
Classes
- RefreshView
-
A widget that wraps a
widgetwith a RefreshIndicator designed to be used with BLoC pattern. -
ViewStateBuilder<
T, B extends BlocBase< ViewState< >T> > -
ViewStateBuilder is responsible for building the UI based on the
ViewState. It's a wrapper over theBlocBuilderwidget so it accepts ablocobject and a set of handy callbacks, which corresponds to each possible state:initialbuilder for the the initial state,loadingbuilder for the data loading state,refreshingbuilder for the data refreshing state,databuilder for the data state,emptybuilder for for no result state,errorbuilder function for an error state.buildWhena condition to determine whether to rebuild theviewwith the currentstate -
ViewStateListener<
T, B extends BlocBase< ViewState< >T> > -
ViewStateListener is responsible for performing an action based on the
ViewState.
Typedefs
-
DataBuilder<
T> = Widget Function(BuildContext context, T data) - Builder function for a success state. The data was fetched and nonnull element was returned.
-
DataCallback<
T> = void Function(BuildContext context, T data) - Callback function for a success. The data was fetched and nonnull element was returned.
- EmptyBuilder = Widget Function(BuildContext context)
- Builder function for no result. The data was fetched successfully, but a null element was returned.
- EmptyCallback = void Function(BuildContext context)
- Callback function for no result. The data was fetched successfully, but a null element was returned.
- ErrorBuilder = Widget Function(BuildContext context, Object error)
-
Builder function for an error. It contains an
errorthat has caused which may allow a view to react differently on different errors. - ErrorCallback = void Function(BuildContext context, Object error)
-
Callback function for an error. It contains an
errorthat has caused which may allow a view to react differently on different errors. - InitialBuilder = Widget Function(BuildContext context)
- Builder function for the the initial state.
- LoadingBuilder = Widget Function(BuildContext context)
- Builder function for the data loading state.
- LoadingCallback = void Function(BuildContext context)
- Callback function for the data loading state.
-
RefreshingBuilder<
T> = Widget Function(BuildContext context, T data) - Builder function for the data refreshing state. Can only occur after DataBuilder.
-
RefreshingCallback<
T> = void Function(BuildContext context, T data) - Callback function for the data refreshing state
-
SuccessBuilder<
T> = Widget Function(BuildContext context, T data) - Builder function for a success state. The data was fetched and nonnull element was returned.
-
SuccessCallback<
T> = void Function(BuildContext context, T data) - Callback function for a success. The data was fetched and nonnull element was returned.
-
ViewStateBuilderCondition<
T> = bool Function(ViewState< T> previous, ViewState<T> current) -
Signature for the
buildWhenfunction which takes the previousViewStateand the currentViewStateand returns a bool which determines whether to rebuild theviewwith the currentstate. - ViewStateListenerCondition = bool Function(ViewState previous, ViewState current)
-
Signature for the
listenWhenfunction which takes the previousViewStateand the currentViewStateand is responsible for returning a bool which determines whether or not to call thelistenerfunction.