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