How ashiqu-ali/state_button works
state_button is a Flutter UI library for an animated button that moves through idle, loading, success, and failure phases. The documented workflow is a user tap invoking the app’s callback, which updates an SbController; StateButton reflects that phase, shows a loader or outcome indicator, and returns to idle after success or failure. The README also documents six loader styles and CustomPainter-drawn tick and cross icons. No source excerpts were provided, so relationships below are limited to those explicitly described in the README.
Main entry points: state_button.dart StateButton · sb_controller.dart SbController · sb_success_indicator.dart Success Indicator · sb_failure_indicator.dart Failure Indicator
Components 10
Button UI
- StateButton
lib/src/widgets/state_button.dart
Phase Control
- SbController
lib/src/core/sb_controller.dart - Phase Types
lib/src/core/sb_types.dart - Loader Types
lib/src/core/sb_loader_type.dart
Indicators
- Loading Styles
lib/src/indicators/loaders - Success Indicator
lib/src/indicators/sb_success_indicator.dart - Failure Indicator
lib/src/indicators/sb_failure_indicator.dart - Tick and Cross
lib/src/painters
Other components
- User
- App Callback
Connections 12
- User → StateButton: taps
README.md - StateButton → App Callback: invokes callback
README.md - App Callback → SbController: sets phase
README.md - StateButton → SbController: reads phase
README.md - StateButton → Loader Types: selects style
README.md - StateButton → Loading Styles: shows loader
README.md - StateButton → Success Indicator: shows success
README.md - StateButton → Failure Indicator: shows failure
README.md - Success Indicator → Tick and Cross: draws tick
README.md - Failure Indicator → Tick and Cross: draws cross
README.md - SbController → Phase Types: uses phases
README.md - SbController → SbController: auto-resets
README.md