11import 'package:flutter/material.dart' ;
22
3+ const double buttonHeightDefault = 50.0 ;
4+
35class ActionButton extends StatelessWidget {
46 final String text;
57 final VoidCallback onPressed;
68 final Color ? backgroundColor;
79 final Color ? textColor;
810 final bool matchParentWidth;
11+ final double height;
912
1013 const ActionButton ({
1114 super .key,
@@ -14,6 +17,7 @@ class ActionButton extends StatelessWidget {
1417 this .backgroundColor,
1518 this .textColor,
1619 this .matchParentWidth = false ,
20+ this .height = buttonHeightDefault,
1721 });
1822
1923 @override
@@ -23,21 +27,21 @@ class ActionButton extends StatelessWidget {
2327 backgroundColor ?? (darkModeEnabled ? Colors .white : Colors .black);
2428
2529 final textC = textColor ?? (darkModeEnabled ? Colors .black : Colors .white);
26- return SizedBox (
27- width: matchParentWidth ? double .infinity : null ,
28- height: 50 ,
29- child: ElevatedButton (
30- onPressed: onPressed,
31- style: ElevatedButton .styleFrom (
32- backgroundColor: backgroundC,
33- shape: const RoundedRectangleBorder (
34- borderRadius: BorderRadius .all (Radius .circular (50 )),
30+ return InkWell (
31+ onTap: onPressed,
32+ child: Container (
33+ padding: const EdgeInsets .symmetric (horizontal: 8 ),
34+ width: matchParentWidth ? double .infinity : null ,
35+ height: height,
36+ decoration: BoxDecoration (
37+ color: backgroundC,
38+ borderRadius: BorderRadius .all (Radius .circular (height / 2 ))),
39+ child: Center (
40+ child: Text (
41+ text,
42+ style: TextStyle (color: textC, fontWeight: FontWeight .bold),
3543 ),
3644 ),
37- child: Text (
38- text,
39- style: TextStyle (color: textC, fontWeight: FontWeight .bold),
40- ),
4145 ),
4246 );
4347 }
0 commit comments