composables/define_widget/main library

This library is deprecated and will be removed in a future version. Please use KaeruWidget instead.

Classes

WidgetBounding
Represents the bounding box of a widget.

Enums

HoverMode
Defines the hover detection mode.

Functions

$asyncComputed<U>(Future<U> getValue(), {U? defaultValue, U? beforeUpdate()?, bool notifyBeforeUpdate = true, void onError(dynamic error)?, dynamic immediate = false}) AsyncComputed<U>
Creates an instance of AsyncComputed with the given async function.
$computed<U>(U getter()) Computed<U>
Creates a reactive Computed with the provided getter function. The value is recomputed only when dependencies change and is guaranteed to notify listeners when it is updated.
$onBeforeUnmount(VoidCallback callback) → void
Registers a callback to be called before the widget is unmounted.
$onDeactivated(VoidCallback callback) → void
Registers a callback to be called when the widget is deactivated.
$onDependenciesChanged(VoidCallback callback) → void
Registers a callback to be called when the widget's dependencies change.
$onMounted(VoidCallback callback) → void
Registers a callback to be called when the widget is first mounted.
$onUpdated(void callback(DefineWidgetBuilder)) → void
Registers a callback to be called when the widget is updated.
$ref<U>(U value) Ref<U>
Creates a reactive Ref with the given initial value. This can be used to store and notify changes to a mutable value over the lifetime of the widget.
$watch(Iterable<Listenable?> source, VoidCallback callback, {bool immediate = false}) VoidCallback
Sets up a watcher on the given source and triggers the callback when any of the Listenable objects in the source change. If immediate is true, the callback is triggered immediately after setting up the listener.
$watchEffect(VoidCallback callback) VoidCallback
Sets up a reactive effect triggered by callback and returns a function to dispose of the effect when it’s no longer needed.
autoContextDispose<T extends ChangeNotifier>(T notifier) → T
Schedules a ChangeNotifier to be disposed automatically when the widget is unmounted.
autoContextDisposeFn(VoidCallback fn) VoidCallback
Schedules a function to be called automatically when the widget is unmounted.
defineWidget<T>(FunctionRender builder(T args), {List? dependencies}) Widget Function(T args)
Defines a widget with a setup function that returns a render function.
getCurrentState() DefineWidgetBuilderState?
Gets the current DefineWidgetBuilderState.
restoreCurrentState(DefineWidgetBuilderState? state) → void
Restores the current DefineWidgetBuilderState.
setCurrentState(DefineWidgetBuilderState state) DefineWidgetBuilderState?
Sets the current DefineWidgetBuilderState and returns the old one.
useContext() BuildContext
Returns the BuildContext of the current widget.
useHoverWidget({HoverMode mode = HoverMode.atomic}) UseHoverWidgetReturn
A hook that provides hover detection for a widget.
useRef() GlobalKey<State<StatefulWidget>>
Creates a GlobalKey for a widget.
useState() DefineWidgetBuilderState
Returns the DefineWidgetBuilderState of the current widget.
useWidgetBounding() UseWidgetBoundingReturn
A hook that provides the bounding box of a widget.
useWidgetSize(GlobalKey<State<StatefulWidget>> key) UseWidgetSizeReturn
A hook that provides the size of a widget.

Typedefs

UseHoverWidgetReturn = ({Widget Function(WidgetBuilder builder) hoverWrap, Ref<bool> isHover})
Return type for useHoverWidget.
UseWidgetBoundingReturn = ({Computed<double?> bottom, Computed<double?> height, GlobalKey<State<StatefulWidget>> key, Computed<double?> left, Computed<double?> right, Computed<double?> top, Computed<double?> width, Computed<double?> x, Computed<double?> y})
Return type for useWidgetBounding.
UseWidgetSizeReturn = ({Ref<double?> height, GlobalKey<State<StatefulWidget>> key, Ref<double?> width})
Return type for useWidgetSize.