flutterx_application library

Application foundation for Flutter apps: fragment navigation with optional go_router sync, view models with task tracking, token handling and common widgets.

Classes

ActionButton<T>
A button that runs onAction and reports its result, staying disabled while the action is running.
AppBarLoader
A linear progress bar that grows in and out of its parent, typically the app bar, while loading is true.
FloatingMenu
An anchor with an overlay menu that opens next to it, driven by an OverlayPortalController.
FooterView
Lays out a body with a footer that sticks to the bottom when the body is short.
Fragment
A page of a FragmentHost, identified by a FragmentKey that is unique inside its host.
FragmentEntry
A step of the navigation of a FragmentHost: the fragment to show and its args.
FragmentHost
Shows one of its fragments at a time, moving between them as its manager navigates.
FragmentHostState
State of a FragmentHost: lays out the fragments in pages and runs the transitions between them.
FragmentKey<T extends FragmentState<Fragment>>
Key of a Fragment, equal to any other key with the same name.
FragmentManager
Controls the navigation of the FragmentHost it is given to, and tells the entry being shown.
FragmentStack
The entry being shown by a FragmentHost and the history of the previous ones.
FragmentState<T extends Fragment>
State of a Fragment: it knows whether the fragment is shown and receives its arguments.
Initializer<T>
Runs initialize once and builds with its result, showing a placeholder meanwhile and an error if it fails.
KeepAliveBuilder
Builds its child and asks the enclosing lazy list to keep it alive while wantKeepAlive is true.
Message
A message shown as a material banner: an icon, a title, an optional body and its actions.
MessageAction
An action of a Message: a label and what to do when it is tapped.
NiceDialog<T>
An AlertDialog with a scrollable or constrained content and cancel, close and submit actions.
OverlayData
Where the anchor sits relative to the overlay of a floating menu, to point the arrow of its shape at it.
ScopedData<T>
Creates a value once, when its state is created, and builds with it.
SimpleLoader
A circular progress indicator of a fixed size.
SystemUiOverlayStyleTheme
Applies a SystemUiOverlayStyle to the system bars and to the app bars of its subtree.
TaskInfo
A task tracked by a TaskViewModel, identified by its id and tag: args do not take part in the equality.
TokenHandler<T extends Object>
Keeps an authentication token, refreshes it when it expires and turns it into an authorization header value.
TooltipShape
A rounded rectangle with an arrow on the side facing the anchor of a floating menu.
ViewModel
Logic and state of a screen, kept by a ViewModelProvider until it is cleared.
ViewModelProvider
Creates and holds the view models of a ViewModelScope.
ViewModelScope
Holds the view models of its subtree and clears them when it leaves the tree.

Enums

Side of the anchor where a floating menu opens.

Mixins

FragmentStateObserver<T extends Fragment>
Keeps the observers of a fragment registered only while it is FragmentState.active.
TaskViewModel
Tracks the tasks a ViewModel is running, to drive loaders and to forward their result to dependent view models.

Extensions

FutureExt on Future<T>
Runs a future as a task of a TaskViewModel.
OffsetExt on Offset
Geometry helpers for positioning overlays.
ViewModelContextX on BuildContext
Access to the view models of the closest ViewModelScope.

Typedefs

ActionButtonBuilder = Widget Function({required bool autofocus, required Widget child, required VoidCallback? onPressed})
Builds the button of an ActionButton around its content.
RefreshToken<T extends Object> = FutureOr<T> Function(T token)
Obtains a new token from the expired token.
RouteArgs = Map<String, dynamic>
Arguments handed to a fragment when it is shown.
UnknownEntryStrategy = FragmentEntry? Function(FragmentManager manager, FragmentEntry entry)
Chooses what a FragmentHost shows when it receives an entry for a fragment it does not have.
ViewModelFactory<T extends ViewModel> = T Function(ViewModelProvider provider)
Creates a view model of type T owned by provider.

Exceptions / Errors

TokenException<T extends Object>
A token that is missing, expired or could not be refreshed.