ToggleSheetDelegateFunction<T> class

A delegate that dynamically computes a value based on the ToggleSheetController state.

Useful when you need to interpolate, animate, or conditionally change sheet visuals depending on the current state of the sheet (e.g., position, snapping progress).

For example:

barrierColorDelegate: ToggleSheetDelegate.func(
  (controller) => Colors.black.withOpacity(controller.interpolation * 0.6),
)

⚠️ Like all ToggleSheetDelegates, this should be created outside of the widget build() method, ideally as a final field inside your State class or a separate function, to prevent unnecessary re-evaluation and performance issues.

Inheritance

Constructors

ToggleSheetDelegateFunction({required T? function(ToggleSheetController controller)})
Creates a ToggleSheetDelegateFunction using a function that takes the sheet controller.
const

Properties

function → T? Function(ToggleSheetController controller)
Function that computes a value from the current controller state.
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<K>(ToggleSheetController 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