Package selection guidance compiled from public package information, community data, and project usage.
AnyAnimatedButton is a Flutter package that provides a customizable button with smooth animations across idle, progress, success, and error states. It visually indicates ongoing background processes, enhancing user feedback during actions like form submissions or data loading. The button supports various customizations including colors, icons, labels, and animation durations. Designed for cross-platform use, it works seamlessly on Android, iOS, Web, macOS, Windows, and Linux. Ideal for improving UX in apps requiring real-time feedback.
Use cases
Form submission with loading state
File upload progress indicator
Authentication flow with success/error feedback
Onboarding process with animated transitions
Background task status visualization
Key features
Smooth state transition animations
Customizable success and error states
Supports icons and text changes per state
Cross-platform compatibility
Configurable animation duration and easing
Extensible styling options
Suitable for
Developers seeking intuitive UI feedback
Apps with frequent async operations
UX-focused mobile and web applications
Prototyping interactive buttons quickly
Projects requiring minimal boilerplate for progress indicators
Considerations
Requires understanding of Flutter's state management
May need additional logic to trigger state changes
Performance impact with multiple instances
Limited to predefined animation types
Not suitable for complex custom animations beyond provided states
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
any_animated_button
Very often after tapping a button we send some data or form to remote API and we need to signalize it to the user. This package makes it easy for us by creating expandable AnyAnimatedButton and AnyAnimatedButtonBloc.
Easy usage
AnyAnimatedButton depends on bloc pattern. To create custom button we need to create new bloc and
widget.
AnyAnimatedButtonBloc
We need to create class, which extends AnyAnimatedButtonBloc and override asyncAction.
AnyAnimatedButton is based on AnimatedContainer. To create our own button we need to create class, which extends CustomAnyAnimatedButton. CustomAnyAnimatedButton consists of 2 fields, which needs to be overridden:
bloc - AnyAnimatedButtonBloc? - bloc which should be connected with the button. If we won't pass it, the button won't animate
defaultParams - AnyAnimatedButtonParams - params object, which describes how button should look and behave
and 3 optional fields:
progressParams - AnyAnimatedButtonParams - params object for describing button in progress state
successParams - AnyAnimatedButtonParams - params object for describing button in success state
errorParams - AnyAnimatedButtonParams - params object for describing button in error state
AnyAnimatedButtonParams
The class that holds all the data about button look and behavior. All properties that we want to animate should be put directly inside all corresponding fields. Rest of them (like Text) should go to child field, which takes Widget.
The only required field is height, rest of them are optional.
We have got also 3 factory constructors, which describe default progress, error and success button state. We can reuse them with changed colors and size.
double.infinity - the button expands as much as he can
null - the button is as small as it can - it fits its content
fixed - we can set fixed width i.e. 200 and the button will always be this wide
Splash effect
There is one problem with InkWell splash effect. If we want the splash effect to work we need to put in child field firstly Material with transparent color → InkWell → rest of the child.
The package has built-in BlocListener, which makes it easier for you to listen to the state changes. AnyAnimatedButtonBlocListener<Input, Output, Failure> takes 3 generic types,Input is type of data that goes into the bloc, Output is type of data returned on success and Failure is the error which will be returned, when any error occurs in bloc.
updating text on button with width set to null does not work properly. The button width will adjust only to the first text width. The workaround is to set fixed width of the longer text instead of null.