49 lines
1.2 KiB
Dart
49 lines
1.2 KiB
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),
|
|
// ),
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor:
|
|
MaterialStateColor.resolveWith((states) => backgroundColor),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(10), // <-- Radius
|
|
),
|
|
),
|
|
|
|
child: Text(
|
|
title,
|
|
style: TextStyle(color: textColor, fontSize: fontsize ?? 24.0),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|