You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
car_customer_app/lib/widgets/show_fill_button.dart

72 lines
1.8 KiB
Dart

import 'package:car_customer_app/extensions/string_extensions.dart';
import 'package:car_customer_app/theme/colors.dart';
import 'package:flutter/material.dart';
import '../classes/colors.dart';
class ShowFillButton extends StatelessWidget {
String title;
VoidCallback onPressed;
Color txtColor;
double elevation, radius, maxWidth, maxHeight, fontSize, horizontalPadding, horizontalMargin, verticalMargin;
bool isFlatButton, isBold;
ShowFillButton({
required this.title,
required this.onPressed,
this.txtColor = Colors.white,
this.elevation = 0,
this.radius = 0,
this.maxWidth = 88,
this.maxHeight = 45,
this.fontSize = 16,
this.horizontalPadding = 16,
this.isFlatButton = false,
this.isBold = true,
this.horizontalMargin = 0,
this.verticalMargin = 0,
});
@override
Widget build(BuildContext context) {
return isFlatButton
? Container(
child: showButton(),
height: maxHeight,
padding: const EdgeInsets.only(
left: 20,
right: 20,
),
)
: ConstrainedBox(
constraints: BoxConstraints(
minHeight: maxHeight,
minWidth: maxWidth,
maxHeight: maxHeight,
maxWidth: maxWidth,
),
child: showButton(),
);
}
Widget showButton() {
return Container(
// decoration: isFlatButton ? null : MyColors.gradientButton,
color:isFlatButton ? null : MyColors.darkPrimaryColor,
margin: EdgeInsets.symmetric(horizontal: horizontalMargin, vertical: verticalMargin),
child: MaterialButton(
onPressed: onPressed,
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(radius),
),
child: title.toText(
fontSize: fontSize,
isBold: isBold,
color: txtColor,
),
),
);
}
}