StatefulSheetDelegateFunction<T, S> class
A delegate that holds a function which uses the MultiStateSheetController to compute a dynamic value.
This delegate allows you to provide a callback function that receives the current
MultiStateSheetController with its generic state type S, enabling you to
return a value of type T based on the controller's current state or animation.
Useful for creating dynamic, responsive properties that update as the sheet moves or changes state.
⚠️ Important: You should create this delegate outside the widget's build method —
ideally as a final field in a State class, or within a view model or other persistent scope.
Avoid constructing it inline within build() to ensure consistency and performance.
Example:
final delegate = StatefulSheetDelegateFunction<int, MySheetState>(
function: (controller) {
if (controller.currentState == MySheetState.expanded) {
return 100;
}
return 50;
},
);
- Inheritance
-
- Object
- StatefulSheetDelegate<
T> - StatefulSheetDelegateFunction
Constructors
-
StatefulSheetDelegateFunction({required T? function(MultiStateSheetController<
S> controller)}) -
Creates a delegate with a function
functionthat calculates the value dynamically based on the given MultiStateSheetController.const
Properties
-
function
→ T? Function(MultiStateSheetController<
S> controller) -
A function that receives the current MultiStateSheetController and returns
a value of type
Tor null.final - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getStaticValue(
) → T? -
We need this method to get the value of the delegate if it is a static value.
We want to avoid calling the function every time we need the value and we can use this method in
init()to get the value of the delegate and store it in a variable.inherited -
getValue<
StateType> (MultiStateSheetController< StateType> controller) → T? -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited