textButton method
customized text button with default option
Implementation
Widget textButton({
required void Function()? onPressed,
required String text,
double? elevation,
EdgeInsetsGeometry? padding,
Color? backgroundColor,
Color? overlayColor,
double? fontSize,
TextStyle? style,
double? borderRadius,
Widget? child,
}) {
return ElevatedButton(
onPressed: onPressed,
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(backgroundColor ?? themeColor),
surfaceTintColor: MaterialStateProperty.all(primaryColor),
foregroundColor: MaterialStateProperty.all(Colors.transparent),
padding: MaterialStateProperty.all(padding ??
(kIsWeb || Platform.isWindows
? const EdgeInsets.only(
left: 20, right: 20, bottom: 15, top: 10)
: const EdgeInsets.symmetric(horizontal: 20, vertical: 8))),
elevation: MaterialStateProperty.all(elevation ?? 4),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(borderRadius ?? 8),
),
),
overlayColor: MaterialStateProperty.all(
overlayColor ?? Colors.black.withOpacity(0.04)),
),
child: child ??
Text(
text,
style: style ??
TextStyle(
fontSize: fontSize ?? 18,
fontWeight: FontWeight.bold,
color: primaryColor),
),
);
}