LidBuilder<T> class

LidBuilder handles building a widget in response to new states. LidBuilder is analogous to StreamBuilder but has simplified API to reduce the amount of boilerplate code needed. Specify the stateNotifier. Please refer to LidListener if you want to "do" anything in response to state changes such as navigation, showing a dialog, etc...

LidBuilder<StateType>(
  stateNotifier: stateNotifier,
  builder: (context, state) {
  // return widget here based on State Notifier's state
  }
)

An optional buildWhen can be implemented for more granular control over how often LidBuilder rebuilds. buildWhen will be invoked on each stateNotifier state change. buildWhen takes the previous state and current state and must return a bool which determines whether or not the builder function will be invoked. The previous state will be initialized to the state of the stateNotifier when the LidBuilder is initialized. buildWhen is optional and if omitted, it will default true if previous state is different current state, otherwise is false, however the first time does not have an effect, always true.

LidBuilder<StateType>(
  stateNotifier: stateNotifier,
  buildWhen: (previous, current) {
    // return true/false to determine whether or not
    // to rebuild the widget with state
  },
  builder: (context, state) {
  // return widget here based on State Notifier's state
  }
)
Inheritance

Constructors

LidBuilder({Key? key, required LidWidgetBuilder<T> builder, required StateNotifier<T> stateNotifier, BuilderCondition<T>? buildWhen, bool animate = false, AnimatedSwitcherTransitionBuilder transitionBuilder = AnimatedSwitcher.defaultTransitionBuilder, Duration duration = const Duration(milliseconds: 300)})
LidBuilder handles building a widget in response to new states. LidBuilder is analogous to StreamBuilder but has simplified API to reduce the amount of boilerplate code needed. Specify the stateNotifier. Please refer to LidListener if you want to "do" anything in response to state changes such as navigation, showing a dialog, etc...
const

Properties

animate bool
Animates when change state, using AnimatedSwitcher
final
builder LidWidgetBuilder<T>
The builder function which will be invoked on each widget build. The builder takes the BuildContext and current state and must return a widget. This is analogous to the builder function in StreamBuilder.
final
buildWhen BuilderCondition<T>?
An optional buildWhen can be implemented for more granular control over how often LidBuilder rebuilds. buildWhen will be invoked on each stateNotifier state change. buildWhen takes the previous state and current state and must return a bool which determines whether or not the builder function will be invoked. The previous state will be initialized to the state of the stateNotifier when the LidBuilder is initialized. buildWhen is optional and if omitted, it will default true if previous state is different current state, otherwise is false, however the first time does not have an effect, always true.
final
duration Duration
The duration of the animation
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateNotifier → StateNotifier<T>
The stateNotifier that the LidBuilder will interact with true.
final
transitionBuilder AnimatedSwitcherTransitionBuilder
Type of the animation, the default animation is FadeIn
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _LidBuilderState<T>
Creates the mutable state for this widget at a given location in the tree.
override
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.
override
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}) 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