AppStateBuilder<T extends AppStateManager> class
Виджет AppStateBuilder позволяет строить UI в зависимости от текущего состояния, предоставляемого AppStateManager. Для каждого типа состояния можно задать отдельный обработчик. Если для конкретного состояния обработчик не задан, используется базовый builder.
Для использования этого виджета наследуйте свою ViewModel от AppStateManager и передавайте ее через Provider. Затем используйте AppStateBuilder для построения UI, которое будет реагировать на изменения состояния.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- AppStateBuilder
Constructors
- AppStateBuilder({Key? key, required Widget builder(T vm), Widget initialState(T vm)?, Widget loadingState(T vm)?, Widget apiErrorState(T vm, ApiException error)?, Widget badRequestState(T vm, ApiException error)?, Widget noInternetState(T vm, ApiException error)?, Widget internalState(T vm, Object error)?})
-
Конструктор AppStateBuilder.
const
Properties
- apiErrorState → Widget Function(T vm, ApiException error)?
-
Обработчик состояния ApiErrorState.
Принимает ViewModel и объект ApiException с информацией об ошибке API.
final
- badRequestState → Widget Function(T vm, ApiException error)?
-
Обработчик состояния BadRequestState.
Принимает ViewModel и объект ApiException с информацией о плохом запросе.
final
- builder → Widget Function(T vm)
-
Базовый строитель виджета, используемый по умолчанию,
если не задан специальный обработчик для текущего состояния.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialState → Widget Function(T vm)?
-
Обработчик состояния InitialState.
final
- internalState → Widget Function(T vm, Object error)?
-
Обработчик состояния InternalErrorState.
Принимает ViewModel и объект ошибки для внутренних ошибок приложения.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingState → Widget Function(T vm)?
-
Обработчик состояния LoadingState.
final
- noInternetState → Widget Function(T vm, ApiException error)?
-
Обработчик состояния NoInternetState.
Принимает ViewModel и объект ApiException с информацией об отсутствии интернет-соединения.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited