material_async_button library

Drop-in async wrappers for Flutter Material buttons.

See ElevatedAsyncButton, FilledAsyncButton, OutlinedAsyncButton, TextAsyncButton, IconAsyncButton, and FloatingActionAsyncButton for the named-constructor variants. Use AsyncButton when you need a custom non-Material button.

Classes

AsyncButton
Low-level async-loading shell for arbitrary buttons.
AsyncButtonController
A read-only ValueListenable of an AsyncButton's loading state (true while onPressed is in flight), plus imperative trigger / reset.
AsyncButtonSpinner
The default loading indicator — a sized, indeterminate CircularProgressIndicator. Used as the fallback loading view, and exposed so you can tweak it and return it from a loadingBuilder:
AsyncButtonTheme
App-wide defaults for material_async_button widgets, attached as a ThemeExtension on ThemeData. Complements ButtonStyle / ButtonThemeData — it carries only async behaviour (the loading view, its transition, its footprint, minimum duration and whether loading disables the button), never styling knobs.
AsyncMaterialButton
Sealed base for the Material wrapper widgets shipped with this package (ElevatedAsyncButton, FilledAsyncButton, OutlinedAsyncButton, TextAsyncButton, IconAsyncButton, FloatingActionAsyncButton).
AsyncStandardMaterialButton
Sub-base for the four AsyncMaterialButtons that share the standard ButtonStyleButton surface (ElevatedAsyncButton, FilledAsyncButton, OutlinedAsyncButton, TextAsyncButton). Centralises the common Material parameters and the .icon constructor pieces so each concrete subclass only has to render its specific button widget via _buildButton / _buildIconButton.
ElevatedAsyncButton
Async-aware ElevatedButton. While onPressed is running the label is swapped for the loading widget.
FilledAsyncButton
Async-aware FilledButton with all four Material 3 flavors: FilledAsyncButton.new, FilledAsyncButton.tonal, FilledAsyncButton.icon, FilledAsyncButton.tonalIcon.
FloatingActionAsyncButton
Async-aware FloatingActionButton. While onPressed is running the child (or label, for .extended) is swapped for the loading widget.
IconAsyncButton
Async-aware IconButton. Includes all four Material 3 flavors: IconAsyncButton.new, IconAsyncButton.filled, IconAsyncButton.filledTonal, IconAsyncButton.outlined.
OutlinedAsyncButton
Async-aware OutlinedButton.
TextAsyncButton
Async-aware TextButton.

Typedefs

AsyncButtonTransitionBuilder = Widget Function(BuildContext context, Widget child, bool isLoading)
Signature for AsyncButton.transitionBuilder.
AsyncButtonWidgetBuilder = Widget Function(BuildContext context, Widget child, AsyncCallback? callback, bool isLoading)
Signature for AsyncButton.builder.