fix buttons UI (#548)
Serhii committed
Oct 20, 2022 at 01:18 UTC
9b4fc8f6082c7560e2ce85bda8322b8b123c32b7
1 file changed
+38
-39
lib/src/widgets/primary_button.dart
+38
-39
@@ -24,22 +24,19 @@ class PrimaryButton extends StatelessWidget {
24
25
@override
26
Widget build(BuildContext context) {
27
- final content = ButtonTheme(
28
- //minWidth: double.infinity,
29
- //height: 52.0,
27
+ final content = SizedBox(
28
+ width: double.infinity,
29
+ height: 52.0,
30
child: TextButton(
31
onPressed: isDisabled
32
- ? (onDisabledPressed != null ? onDisabledPressed : null)
33
- : onPressed,
34
- // FIX-ME: Need to add style
35
- // color: isDisabled ? color.withOpacity(0.5) : color,
36
- //splashColor: Colors.transparent,
37
- //highlightColor: Colors.transparent,
38
- //disabledColor: color.withOpacity(0.5),
39
- //shape: RoundedRectangleBorder(
40
- // borderRadius: BorderRadius.circular(26.0),
41
- //),
42
- style: ButtonStyle(backgroundColor: MaterialStateProperty.all(isDisabled ? color.withOpacity(0.5) : color)),
32
+ ? (onDisabledPressed != null ? onDisabledPressed : null) : onPressed,
33
+ style: ButtonStyle(backgroundColor: MaterialStateProperty.all(isDisabled ? color.withOpacity(0.5) : color),
34
+ shape: MaterialStateProperty.all<RoundedRectangleBorder>(
35
+ RoundedRectangleBorder(
36
+ borderRadius: BorderRadius.circular(26.0),
37
+ ),
38
+ ),
39
+ overlayColor: MaterialStateProperty.all(Colors.transparent)),
40
child: Text(text,
41
textAlign: TextAlign.center,
42
style: TextStyle(
@@ -80,17 +77,18 @@ class LoadingPrimaryButton extends StatelessWidget {
77
78
@override
79
Widget build(BuildContext context) {
83
- return ButtonTheme(
84
- // FIX-ME: styles
85
- //minWidth: double.infinity,
86
- //height: 52.0,
80
+ return SizedBox(
81
+ width: double.infinity,
82
+ height: 52.0,
83
child: TextButton(
84
onPressed: (isLoading || isDisabled) ? null : onPressed,
89
- //color: color,
90
- //disabledColor: color.withOpacity(0.5),
91
- //shape: RoundedRectangleBorder(
92
- //borderRadius: BorderRadius.circular(26.0)),
93
- style: ButtonStyle(backgroundColor: MaterialStateProperty.all(isDisabled ? color.withOpacity(0.5) : color)),
85
+ style: ButtonStyle(backgroundColor: MaterialStateProperty.all(isDisabled ? color.withOpacity(0.5) : color),
86
+ shape: MaterialStateProperty.all<RoundedRectangleBorder>(
87
+ RoundedRectangleBorder(
88
+ borderRadius: BorderRadius.circular(26.0),
89
+ ),
90
+ )),
91
+
92
child: isLoading
93
? CupertinoActivityIndicator(animating: true)
94
: Text(text,
@@ -132,16 +130,17 @@ class PrimaryIconButton extends StatelessWidget {
130
131
@override
132
Widget build(BuildContext context) {
135
- return ButtonTheme(
136
- // FIX-ME: styles
137
- //minWidth: double.infinity,
138
- //height: 52.0,
133
+ return SizedBox(
134
+ width: double.infinity,
135
+ height: 52.0,
136
child: TextButton(
137
onPressed: onPressed,
141
- //color: color,
142
- //shape: RoundedRectangleBorder(
143
- // side: BorderSide(color: borderColor),
144
- // borderRadius: BorderRadius.circular(radius)),
138
+ style: ButtonStyle(backgroundColor: MaterialStateProperty.all(color),
139
+ shape: MaterialStateProperty.all<RoundedRectangleBorder>(
140
+ RoundedRectangleBorder(
141
+ borderRadius: BorderRadius.circular(radius),
142
+ ),
143
+ )),
144
child: Stack(
145
children: <Widget>[
146
Row(
@@ -191,17 +190,17 @@ class PrimaryImageButton extends StatelessWidget {
190
191
@override
192
Widget build(BuildContext context) {
194
- return ButtonTheme(
195
- minWidth: double.infinity,
193
+ return SizedBox(
194
+ width: double.infinity,
195
height: 52.0,
196
child: TextButton(
197
onPressed: onPressed,
199
- // FIX-ME: Style
200
- //color: color,
201
- //shape: RoundedRectangleBorder(
202
- // side: BorderSide(color: borderColor),
203
- // borderRadius: BorderRadius.circular(26.0)),
204
- style: ButtonStyle(backgroundColor: MaterialStateProperty.all(color)),
198
+ style: ButtonStyle(backgroundColor: MaterialStateProperty.all(color),
199
+ shape: MaterialStateProperty.all<RoundedRectangleBorder>(
200
+ RoundedRectangleBorder(
201
+ borderRadius: BorderRadius.circular(26.0),
202
+ ),
203
+ )),
204
child:Center(
205
child: Row(
206
mainAxisSize: MainAxisSize.min,