creative_ui_button 0.0.2
creative_ui_button: ^0.0.2 copied to clipboard
Theme-aware, animated buttons for Flutter: contained, outlined, text, and animated variants with async and smart back.
π¨ Creative UI Button #
A beautifully animated, theme-aware, and highly customizable button library for Flutter.
It supports multiple variants, async actions, built-in sound and haptic feedback, and smart navigation helpers β all with Material-3-ready design.
β¨ Features #
β Multiple button variants:
- Contained
- Outlined
- Text
- Animated
β Built-in animations:
- Pulse
- Floating
- Scale-Tap feedback
β Async support:
AsyncButtonautomatically handles loading states and disables double taps.
β Smart navigation:
CreativeUIBackButtonpops from the stack, or auto-redirects to a fallback route if the stack is empty.
β Theme-aware defaults:
- Automatically adapts to
Theme.of(context).colorScheme(light or dark).
β Plug-and-play customization:
- Gradients, borders, shadows, haptics, SFX, and more.
π Installation #
Add to your project:
flutter pub add creative_ui_button
or manually include in pubspec.yaml:
dependencies:
creative_ui_button: ^1.0.0
Then import it:
import 'package:creative_ui_button/creative_ui_button.dart';
π§± Usage #
π¦ Contained Button #
CreativeUIButton(
options: CreativeUIButtonOptions(
variant: ButtonVariant.contained,
labelText: 'Play',
icon: const Icon(Icons.play_arrow, color: Colors.white),
style: const CreativeUIButtonStyle(
backgroundColor: Colors.blue,
borderRadius: 12,
textStyle: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
onPressed: () => print('Play tapped'),
),
);
π§ Outlined Button #
CreativeUIButton(
options: CreativeUIButtonOptions(
variant: ButtonVariant.outlined,
labelText: 'Cancel',
style: CreativeUIButtonStyle(
borderColor: Colors.orange,
borderWidth: 2,
textStyle: const TextStyle(color: Colors.orange),
),
onPressed: () => print('Cancelled'),
),
);
π Async Button #
AsyncButton(
options: CreativeUIButtonOptions(
labelText: 'Submit',
variant: ButtonVariant.contained,
style: const CreativeUIButtonStyle(
backgroundColor: Colors.green,
textStyle: TextStyle(color: Colors.white),
),
),
onAsyncSubmit: () async {
await Future.delayed(const Duration(seconds: 2));
print('Submitted');
},
);
The button will show a spinner and disable itself until the async task completes.
β¬ οΈ Smart Back Button #
CreativeUIBackButton(
fallbackRoute: '/home', // If stack is empty, navigates to home
options: CreativeUIButtonOptions(
variant: ButtonVariant.text,
style: const CreativeUIButtonStyle(
textStyle: TextStyle(color: Colors.blue),
),
),
);
βοΈ Button Variants #
| Variant | Description |
|---|---|
contained |
Filled button (default) |
outlined |
Border-only button |
text |
Minimal text-only button |
animated |
Pulse & floating animations with gradient support |
πͺ Advanced Configuration #
Animation Options
CreativeUIButtonOptions(
animationOptions: CreativeUIButtonAnimationOptions(
animationOptions: {
AnimationType.pulsing: AnimationOptions(
duration: const Duration(milliseconds: 800),
pause: const Duration(seconds: 1),
),
AnimationType.floating: AnimationOptions(
from: -5.0,
to: 5.0,
duration: const Duration(seconds: 2),
),
},
),
);
Sound & Haptics
CreativeUIButtonOptions(
soundOptions: const CreativeUIButtonSoundOptions(
sfxPath: 'assets/click.mp3',
enableSFX: true,
disableVibration: false,
),
);
π§© Example #
A complete example app lives in /example.
Run it:
cd example
flutter run
π§ Architecture Highlights #
- No theme access in
initStateβ safe in all build phases - Adaptive to
ThemeDatachanges and dark mode - Ripple + hover + focus layers follow Material guidelines
- Easily extendable for new variants or shapes
π§ͺ Testing #
Run widget tests:
flutter test
Youβll find test coverage for:
CreativeUIButtonAsyncButtonCreativeUIBackButton
π§° Requirements #
| Platform | Minimum |
|---|---|
| Flutter | 3.13+ |
| Dart | 3.2+ |
π§βπ» Author #
Ollie Ogunlade
Flutter & Node.js Engineer
GitHub β’ LinkedIn
π License #
MIT Β© 2025 Ollie Ogunlade