47 lines
1.1 KiB
Dart
47 lines
1.1 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class CustomButton extends StatelessWidget {
|
||
|
String title;
|
||
|
Color textColor;
|
||
|
Color backgroundColor;
|
||
|
VoidCallback onPressed;
|
||
|
double? width = 200;
|
||
|
double? height = 45.0;
|
||
|
double? fontsize = 45.0;
|
||
|
CustomButton(
|
||
|
{super.key,
|
||
|
required this.backgroundColor,
|
||
|
required this.onPressed,
|
||
|
required this.textColor,
|
||
|
required this.title,
|
||
|
this.fontsize,
|
||
|
this.height,
|
||
|
this.width});
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return SizedBox(
|
||
|
height: height,
|
||
|
width: width,
|
||
|
child: ElevatedButton(
|
||
|
onPressed: onPressed,
|
||
|
style: ElevatedButton.styleFrom(
|
||
|
shape: RoundedRectangleBorder(
|
||
|
borderRadius: BorderRadius.circular(5.0),
|
||
|
),
|
||
|
backgroundColor: backgroundColor,
|
||
|
),
|
||
|
// style: ButtonStyle(
|
||
|
// backgroundColor:
|
||
|
// MaterialStateColor.resolveWith((states) => backgroundColor),
|
||
|
|
||
|
// ),
|
||
|
child: Text(
|
||
|
title,
|
||
|
style: TextStyle(color: textColor, fontSize: fontsize ?? 24.0),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|