func<T, S> static method
Creates a StatefulSheetDelegate using a custom function that takes a MultiStateSheetController
and returns an optional value of type T. This allows for dynamic control of the sheet's behavior
based on the controller's 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.
The function parameter is a callback that receives the current MultiStateSheetController
and returns a value of type T or null.
Implementation
static StatefulSheetDelegate<T> func<T, S>(
StatefulFunctionDelegate<T, S> function) =>
StatefulSheetDelegateFunction<T, S>(function: function);