@@ -35,7 +35,7 @@ class GFButton extends StatefulWidget {
3535 this .child,
3636 this .type = GFButtonType .solid,
3737 this .shape = GFButtonShape .standard,
38- this .color = GFColor .primary ,
38+ this .color = GFColors . PRIMARY ,
3939 this .textColor,
4040 this .position = GFPosition .start,
4141 this .size = GFSize .MEDIUM ,
@@ -78,17 +78,17 @@ class GFButton extends StatefulWidget {
7878 /// The box shadow for the button's [Material] , if GFButtonType is solid
7979 final BoxShadow boxShadow;
8080
81- /// Pass [GFColor ] or [Color] . The color for the button's [Material] when it has the input focus.
82- final dynamic focusColor;
81+ /// Pass [GFColors ] or [Color] . The color for the button's [Material] when it has the input focus.
82+ final Color focusColor;
8383
84- /// Pass [GFColor ] or [Color] . The color for the button's [Material] when a pointer is hovering over it.
85- final dynamic hoverColor;
84+ /// Pass [GFColors ] or [Color] . The color for the button's [Material] when a pointer is hovering over it.
85+ final Color hoverColor;
8686
87- /// Pass [GFColor ] or [Color] . The highlight color for the button's [InkWell] .
88- final dynamic highlightColor;
87+ /// Pass [GFColors ] or [Color] . The highlight color for the button's [InkWell] .
88+ final Color highlightColor;
8989
90- /// Pass [GFColor ] or [Color] . The splash color for the button's [InkWell] .
91- final dynamic splashColor;
90+ /// Pass [GFColors ] or [Color] . The splash color for the button's [InkWell] .
91+ final Color splashColor;
9292
9393 /// The elevation for the button's [Material] when the button is [enabled] but not pressed.
9494 final double elevation;
@@ -141,8 +141,8 @@ class GFButton extends StatefulWidget {
141141 /// Button type of [GFButtonShape] i.e, standard, pills, square, shadow, icons
142142 final GFButtonShape shape;
143143
144- /// Pass [GFColor ] or [Color]
145- final dynamic color;
144+ /// Pass [GFColors ] or [Color]
145+ final Color color;
146146
147147 /// The fill color of the button when the button is disabled.
148148 ///
@@ -152,10 +152,10 @@ class GFButton extends StatefulWidget {
152152 /// See also:
153153 ///
154154 /// * [color] - the fill color of the button when the button is [enabled] .
155- final dynamic disabledColor;
155+ final Color disabledColor;
156156
157- /// Pass [GFColor ] or [Color]
158- final dynamic textColor;
157+ /// Pass [GFColors ] or [Color]
158+ final Color textColor;
159159
160160 /// The color to use for this button's text when the button is disabled.
161161 ///
@@ -171,7 +171,7 @@ class GFButton extends StatefulWidget {
171171 /// See also:
172172 ///
173173 /// * [textColor] - The color to use for this button's text when the button is [enabled] .
174- final dynamic disabledTextColor;
174+ final Color disabledTextColor;
175175
176176 /// size of [double] or [GFSize] i.e, 1.2, small, medium, large etc.
177177 final double size;
@@ -247,17 +247,17 @@ class _GFButtonState extends State<GFButton> {
247247
248248 @override
249249 void initState () {
250- color = GFColors . getGFColor ( widget.color) ;
251- textColor = GFColors . getGFColor ( widget.textColor) ;
250+ color = widget.color;
251+ textColor = widget.textColor;
252252 child = widget.text != null ? Text (widget.text) : widget.child;
253253 icon = widget.icon;
254254 onPressed = widget.onPressed;
255255 type = widget.type;
256256 shape = widget.shape;
257257 size = widget.size;
258258 position = widget.position;
259- disabledColor = GFColors . getGFColor ( widget.disabledColor) ;
260- disabledTextColor = GFColors . getGFColor ( widget.disabledTextColor) ;
259+ disabledColor = widget.disabledColor;
260+ disabledTextColor = widget.disabledTextColor;
261261 _updateState (
262262 MaterialState .disabled,
263263 ! widget.enabled,
@@ -348,8 +348,7 @@ class _GFButtonState extends State<GFButton> {
348348
349349 Color getBorderColor () {
350350 if (widget.enabled) {
351- final Color fillColor =
352- color == null ? GFColors .getGFColor (GFColor .primary) : color;
351+ final Color fillColor = color ?? GFColors .PRIMARY ;
353352 if (fillColor != null ) {
354353 return fillColor;
355354 }
@@ -360,7 +359,7 @@ class _GFButtonState extends State<GFButton> {
360359 return color.withOpacity (0.48 );
361360 }
362361 }
363- return color == null ? GFColors .getGFColor ( GFColor .primary) : color ;
362+ return color ?? GFColors .PRIMARY ;
364363 }
365364
366365 Color getDisabledFillColor () {
@@ -382,8 +381,7 @@ class _GFButtonState extends State<GFButton> {
382381 widget.type == GFButtonType .outline2x) {
383382 return Colors .transparent;
384383 }
385- final Color fillColor =
386- color == null ? GFColors .getGFColor (GFColor .primary) : color;
384+ final Color fillColor = color ?? GFColors .PRIMARY ;
387385 return fillColor;
388386 }
389387
@@ -395,7 +393,7 @@ class _GFButtonState extends State<GFButton> {
395393 widget.type == GFButtonType .transparent) {
396394 return color;
397395 } else {
398- return GFColors .getGFColor ( GFColor .dark) ;
396+ return GFColors .DARK ;
399397 }
400398 }
401399
@@ -405,17 +403,15 @@ class _GFButtonState extends State<GFButton> {
405403 widget.type == GFButtonType .transparent) {
406404 return widget.enabled
407405 ? textColor == null
408- ? color == GFColors .getGFColor (GFColor .transparent)
409- ? GFColors .getGFColor (GFColor .dark)
410- : color
406+ ? color == GFColors .TRANSPARENT ? GFColors .DARK : color
411407 : textColor
412408 : getDisabledTextColor ();
413409 }
414410 if (textColor == null ) {
415- if (color == GFColors .getGFColor ( GFColor .transparent) ) {
416- return GFColors .getGFColor ( GFColor .dark) ;
411+ if (color == GFColors .TRANSPARENT ) {
412+ return GFColors .DARK ;
417413 } else {
418- return GFColors .getGFColor ( GFColor .white) ;
414+ return GFColors .WHITE ;
419415 }
420416 } else {
421417 return textColor;
@@ -453,12 +449,11 @@ class _GFButtonState extends State<GFButton> {
453449 final BorderSide shapeBorder = widget.type == GFButtonType .outline ||
454450 widget.type == GFButtonType .outline2x
455451 ? outlineBorder
456- : widget.borderSide != null
457- ? widget.borderSide
458- : BorderSide (
459- color: color == null ? themeColor : getBorderColor (),
460- width: 0 ,
461- );
452+ : widget.borderSide ??
453+ BorderSide (
454+ color: color == null ? themeColor : getBorderColor (),
455+ width: 0 ,
456+ );
462457
463458 if (shape == GFButtonShape .pills) {
464459 shapeBorderType = RoundedRectangleBorder (
@@ -574,10 +569,10 @@ class _GFButtonState extends State<GFButton> {
574569 onTap: widget.onPressed,
575570 onLongPress: widget.onLongPress,
576571 enableFeedback: widget.enableFeedback,
577- splashColor: GFColors . getGFColor ( widget.splashColor) ,
578- highlightColor: GFColors . getGFColor ( widget.highlightColor) ,
579- focusColor: GFColors . getGFColor ( widget.focusColor) ,
580- hoverColor: GFColors . getGFColor ( widget.hoverColor) ,
572+ splashColor: widget.splashColor,
573+ highlightColor: widget.highlightColor,
574+ focusColor: widget.focusColor,
575+ hoverColor: widget.hoverColor,
581576 customBorder: widget.type == GFButtonType .transparent
582577 ? null
583578 : widget.borderShape ?? shapeBorderType,
0 commit comments