A sleek, production-ready Flutter button widget with built-in loading states, progress indicators, and tap feedback.
📦 Ready for pub.dev! Drop-in replacement for Flutter's ElevatedButton, OutlinedButton, and TextButton with superpowers.
- ⏳ Loading State — Built-in circular progress indicator, disables button while loading
- 🎨 Customizable — Colors, radius, elevation, borders, icons, shadows
- 🚫 Disabled State — Auto-disabled during loading with configurable opacity
- 🔄 Loading Text — Swap label with "Processing..." while loading
- 🎯 Ripple Effect — Material ripple on tap
- 💫 Scale Animation — Shrinks slightly on press for tactile feedback
- 📱 Platform Ready — Android, iOS, Web, macOS, Windows, Linux
flutter pub add on_process_button_widgetOr add manually to pubspec.yaml:
dependencies:
on_process_button_widget: ^1.0.0import 'package:on_process_button_widget/on_process_button_widget.dart';
// Basic usage — just wrap your async action
OnProcessButton(
onPressed: () async {
await Future.delayed(Duration(seconds: 2));
print('Action complete!');
},
child: Text('Submit'),
)
// With custom text during loading
OnProcessButton(
loadingText: 'Submitting...',
child: Text('Submit'),
onPressed: () => submitForm(),
)
// With icon
OnProcessButton.icon(
icon: Icons.send,
label: 'Send',
onPressed: () => sendMessage(),
)| Property | Type | Default | Description |
|---|---|---|---|
onPressed |
AsyncCallback? |
required |
Async press handler |
child |
Widget |
required |
Button content |
loadingText |
String? |
null |
Text shown while loading |
loadingColor |
Color |
Colors.white |
Spinner color |
loadingSize |
double |
20.0 |
Spinner diameter |
borderRadius |
double |
8.0 |
Button radius |
backgroundColor |
Color |
null |
Button background |
foregroundColor |
Color |
null |
Text/icon color |
elevation |
double |
2.0 |
Shadow elevation |
enabled |
bool |
true |
Enable/disable |
height |
double |
48.0 |
Button height |
width |
double |
null |
Button width (full if null) |
OnProcessButton(
width: double.infinity,
backgroundColor: Color(0xFF6C63FF),
borderRadius: 12,
child: Text(
'Sign In',
style: TextStyle(color: Colors.white, fontSize: 16),
),
onPressed: () => signIn(),
)OnProcessButton(
backgroundColor: Colors.transparent,
foregroundColor: Color(0xFF6C63FF),
border: Border.all(color: Color(0xFF6C63FF), width: 2),
borderRadius: 12,
child: Text('View Details'),
onPressed: () => openDetails(),
)OnProcessButton.icon(
width: 56,
height: 56,
borderRadius: 28,
backgroundColor: Color(0xFF2196F3),
icon: Icons.favorite,
loadingIcon: Icons.favorite_border,
onPressed: () => toggleLike(),
)OnProcessButton(
icon: Icons.cloud_upload,
label: 'Upload Document',
loadingLabel: 'Uploading...',
backgroundColor: Color(0xFF4CAF50),
borderRadius: 8,
onPressed: () => uploadFile(),
)| Default | Loading | Disabled |
|---|---|---|
![]() |
![]() |
![]() |
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing) - Open a Pull Request
MIT License
Copyright (c) 2024 Shajedur Rahman Panna
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Made with ❤️ by Shajedur Rahman Panna


