widget/kaeru_widget/kaeru_widget library

Classes

KaeruWidget<W extends StatefulWidget>
A widget that provides a reactive context for its children.
KaeruWidgetState<T extends StatefulWidget>
The state for a KaeruWidget.
LoadMoreController<T>
Manages the state and lifecycle of a "load more" request.
PaginationController<T>
Manages the state and lifecycle of a paginated request.
PaginationOptions<T>
Options for configuring the behavior of usePagination.
PaginationResult<T>
Represents the result of a paginated request.
RequestController<T>
Manages the state and lifecycle of an asynchronous request.
RequestOptions<T>
Options for configuring the behavior of useRequest.
UseDark
A reactive utility to determine if the current theme is dark.
UseWidgetBox
A data class holding the reactive box constraints and the builder function.
UseWidgetSize
A data class holding the reactive size and the builder function.

Functions

asyncComputed<T>(Future<T> compute()) AsyncComputed<T>
Creates an instance of AsyncComputed with the given async function.
computed<T>(T compute()) Computed<T>
Creates a reactive Computed with the provided getter function.
onActivated(VoidCallback callback) → void
Registers a callback to be called when the widget is activated.
onBeforeBuild(void callback(BuildContext context)) → void
Registers a callback to be called before the widget is built.
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.
onDebugFillProperties(void callback(DiagnosticPropertiesBuilder properties)) → void
Registers a callback to be called when the widget's properties are being filled for debugging.
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(StatefulWidget)) → void
Registers a callback to be called when the widget is updated.
ref<T>(T initialValue) Ref<T>
Creates a reactive Ref with the given initial value.
useAnimationController({TickerProvider? vsync, Duration? duration, String? debugLabel, double? lowerBound, double? upperBound, double? value, AnimationBehavior animationBehavior = AnimationBehavior.normal}) AnimationController
Creates an AnimationController.
useContext() BuildContext
Retrieves the current BuildContext from the KaeruWidget.
useDark() Ref<bool>
A composable that returns a reactive boolean Ref indicating if the current theme is dark.
useFocusNode({String? debugLabel, bool canRequestFocus = true, FocusOnKeyEventCallback? onKeyEvent, bool skipTraversal = false}) FocusNode
Creates a FocusNode.
useFocusScopeNode({String? debugLabel}) FocusScopeNode
Creates a FocusScopeNode.
useKaeruContext() KaeruMixin<StatefulWidget>?
Returns the current KaeruMixin instance.
useKeepAliveClient({bool wantKeepAlive = true}) AutomaticKeepAliveClientMixin<StatefulWidget>
A hook that provides an AutomaticKeepAliveClientMixin for keeping a widget alive even when it is not visible.
useLifeContext() KaeruLifeMixin<StatefulWidget>?
Returns the current KaeruLifeMixin instance.
useLoadMore<T>(Future<List<T>> service(int page, T? lastItem)) LoadMoreController<T>
A composable for managing "load more" or infinite scrolling data fetching.
useNotifier<T extends ChangeNotifier>(T notifier) → T
Creates a ChangeNotifier.
useOverlayEntry(WidgetBuilder builder) OverlayEntry
Creates an OverlayEntry.
usePageController({int initialPage = 0, bool keepPage = true, double viewportFraction = 1.0}) PageController
Creates a PageController.
usePagination<T>(Future<PaginationResult<T>> service(int page, int pageSize), {PaginationOptions<T> options = const PaginationOptions()}) PaginationController<T>
A composable for managing paginated data fetching.
usePolling<T>(Future<T> service(), {Duration interval = const Duration(seconds: 5)}) RequestController<T>
A composable for managing polling requests.
useRequest<T>(Future<T> service(), {RequestOptions<T> options = const RequestOptions()}) RequestController<T>
A composable for managing asynchronous data fetching.
useRestoration({String? restorationId, required void restoreState(RestorationBucket? oldBucket, bool initialRestore), required void didToggleBucket(RestorationBucket? oldBucket), void registerForRestoration(RestorableProperty<Object?> property, String restorationId)?, void unregisterFromRestoration(RestorableProperty<Object?> property)?, VoidCallback? didUpdateRestorationId}) RestorationMixin<StatefulWidget>
A hook that provides restoration capabilities for widgets.
useScrollController({double initialScrollOffset = 0.0, bool keepScrollOffset = true, String? debugLabel}) ScrollController
Creates a ScrollController.
useSingleTickerState() TickerProvider
Provides a hook to create a single ticker state for animations.
useStream<T>(Stream<T> stream) Ref<T?>
Subscribes to a Stream and returns a Ref that is updated with the latest value from the stream.
useStreamController<T>({bool sync = false}) StreamController<T>
Creates a StreamController.
useStreamDefault<T>(Stream<T> stream, {required T defaultValue}) Ref<T>
Subscribes to a Stream and returns a Ref that is updated with the latest value from the stream.
useStreamSubscription<T>(Stream<T> stream, void onData(T event)?, {Function? onError, void onDone()?, bool? cancelOnError}) StreamSubscription<T>
Creates a StreamSubscription.
useTabController({required int length, TickerProvider? vsync, int initialIndex = 0, Duration? animationDuration}) TabController
Creates a TabController.
useTextEditingController([String? text]) TextEditingController
Creates a TextEditingController.
useTheme() ThemeData
A composable that returns the current ThemeData from the widget tree.
useTimer(Duration duration, void callback(), {bool periodic = false}) Timer
Creates a Timer.
useTransformationController([Matrix4? value]) TransformationController
Creates a TransformationController.
useValueNotifier<T>(T value) ValueNotifier<T>
Creates a ValueNotifier.
useWidget<T extends Widget>() → T
A custom hook to retrieve the current widget of a specific type from the context.
useWidgetBox() UseWidgetBox
A composable that provides the BoxConstraints of a widget reactively.
useWidgetSize() UseWidgetSize
A composable that provides the Size of a widget reactively.
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.
watchEffect(VoidCallback effect) VoidCallback
Sets up a reactive effect triggered by callback.

Typedefs

Setup = Widget Function()
A function that returns a widget.