Files
prosappco/lib/components/general_primary_button.dart
2024-04-05 11:56:45 -05:00

43 lines
1.0 KiB
Dart

import 'package:flutter/material.dart';
class GeneralPrimaryButton extends StatelessWidget {
final VoidCallback onPressed;
final String label;
final bool isEnabled;
final Color? color;
const GeneralPrimaryButton({
super.key,
required this.onPressed,
required this.label,
this.isEnabled = true,
this.color,
});
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: isEnabled ? onPressed : null,
style: ElevatedButton.styleFrom(
backgroundColor: color ?? Theme.of(context).colorScheme.primary,
elevation: 5,
minimumSize: Size(
MediaQuery.of(context).size.width * 0.5,
55,
),
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(50)),
),
),
child: Text(
label,
style: TextStyle(
color: isEnabled ? Colors.white : Colors.black,
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
);
}
}