41 lines
956 B
Dart
41 lines
956 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
// ignore: must_be_immutable
|
|
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: ButtonStyle(
|
|
backgroundColor:
|
|
MaterialStateColor.resolveWith((states) => backgroundColor),
|
|
),
|
|
child: Text(
|
|
title,
|
|
style: TextStyle(color: textColor, fontSize: fontsize ?? 24.0),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|