Files
kent_logistics_app/lib/widgets/primary_button.dart

63 lines
1.6 KiB
Dart
Raw Normal View History

2025-11-28 10:14:30 +05:30
import 'package:flutter/material.dart';
2025-12-11 18:36:11 +05:30
2025-11-28 10:14:30 +05:30
class PrimaryButton extends StatelessWidget {
final String label;
final VoidCallback onTap;
final bool busy;
2025-12-11 18:36:11 +05:30
const PrimaryButton({
super.key,
required this.label,
required this.onTap,
this.busy = false,
});
2025-11-28 10:14:30 +05:30
@override
Widget build(BuildContext context) {
return SizedBox(
width: double.infinity,
2025-12-11 18:36:11 +05:30
child: Container(
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [
Color(0xFF0D47A1), // Blue
Color(0xFF6A1B9A), // Purple
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(12),
),
child: ElevatedButton(
onPressed: busy ? null : onTap,
style: ElevatedButton.styleFrom(
backgroundColor: Colors
.transparent, // IMPORTANT: keep transparent to see gradient
shadowColor: Colors.transparent,
padding: const EdgeInsets.symmetric(vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: busy
? const SizedBox(
height: 18,
width: 18,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.white,
),
)
: Text(
label,
style: const TextStyle(fontSize: 16, color: Colors.white),
),
),
2025-11-28 10:14:30 +05:30
),
);
}
}