56 lines
1.5 KiB
Dart
56 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class CommanButton extends StatelessWidget {
|
|
final String text;
|
|
final VoidCallback onPressed;
|
|
final bool isPrimary;
|
|
final Color backgroundColor;
|
|
final Color borderColor;
|
|
final Color textColor;
|
|
final double width;
|
|
final double height;
|
|
final double borderRadius;
|
|
final TextStyle? textStyle;
|
|
|
|
// ignore: use_super_parameters
|
|
const CommanButton({
|
|
Key? key,
|
|
required this.text,
|
|
required this.onPressed,
|
|
this.isPrimary = true,
|
|
this.backgroundColor = const Color(0xFF0066FF),
|
|
this.borderColor = const Color(0xFFAAAAAA),
|
|
this.textColor = Colors.white,
|
|
this.width = 311.1557922363281,
|
|
this.height = 64.22110748291016,
|
|
this.borderRadius = 36.18,
|
|
this.textStyle,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final Color bgColor = isPrimary ? backgroundColor : Colors.white;
|
|
final Color txtColor = isPrimary ? textColor : borderColor;
|
|
|
|
return SizedBox(
|
|
width: width,
|
|
height: height,
|
|
child: ElevatedButton(
|
|
onPressed: onPressed,
|
|
style: ElevatedButton.styleFrom(
|
|
elevation: 0,
|
|
backgroundColor: bgColor,
|
|
side: BorderSide(color: borderColor, width: 1),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(borderRadius),
|
|
),
|
|
),
|
|
child: Text(
|
|
text,
|
|
style: textStyle ?? TextStyle(color: txtColor, fontSize: 16),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|