@@ -23,7 +23,7 @@ class GFIconButton extends StatefulWidget {
2323 this .tooltip,
2424 this .type = GFButtonType .solid,
2525 this .shape = GFIconButtonShape .standard,
26- this .color = GFColor .primary ,
26+ this .color = GFColors . PRIMARY ,
2727 this .borderShape,
2828 this .boxShadow,
2929 this .size = GFSize .MEDIUM ,
@@ -60,17 +60,17 @@ class GFIconButton extends StatefulWidget {
6060 /// Button type of [GFIconButtonShape] i.e, standard, pills, square, shadow, icons
6161 final GFIconButtonShape shape;
6262
63- /// Pass [GFColor ] or [Color]
64- final dynamic color;
63+ /// Pass [GFColors ] or [Color]
64+ final Color color;
6565
66- /// Pass [GFColor ] or [Color] . The primary color of the button when the button is in the down (pressed) state.
67- final dynamic splashColor;
66+ /// Pass [GFColors ] or [Color] . The primary color of the button when the button is in the down (pressed) state.
67+ final Color splashColor;
6868
69- /// Pass [GFColor ] or [Color] . The secondary color of the button when the button is in the down (pressed) state.
70- final dynamic highlightColor;
69+ /// Pass [GFColors ] or [Color] . The secondary color of the button when the button is in the down (pressed) state.
70+ final Color highlightColor;
7171
72- /// Pass [GFColor ] or [Color] . The color to use for the icon inside the button, if the icon is disabled.
73- final dynamic disabledColor;
72+ /// Pass [GFColors ] or [Color] . The color to use for the icon inside the button, if the icon is disabled.
73+ final Color disabledColor;
7474
7575 /// The callback that is called when the button is tapped or otherwise activated.
7676 final VoidCallback onPressed;
@@ -115,7 +115,7 @@ class _GFIconButtonState extends State<GFIconButton> {
115115
116116 @override
117117 void initState () {
118- color = GFColors . getGFColor ( widget.color) ;
118+ color = widget.color;
119119 onPressed = widget.onPressed;
120120 type = widget.type;
121121 shape = widget.shape;
@@ -162,16 +162,12 @@ class _GFIconButtonState extends State<GFIconButton> {
162162 widget.type == GFButtonType .outline ||
163163 widget.type == GFButtonType .outline2x) {
164164 return widget.onPressed != null
165- ? color == GFColors .getGFColor (GFColor .transparent)
166- ? GFColors .getGFColor (GFColor .dark)
167- : color
165+ ? color == GFColors .TRANSPARENT ? GFColors .DARK : color
168166 : color.withOpacity (0.48 );
169- } else if (color == GFColors .getGFColor (GFColor .transparent)) {
170- return widget.onPressed != null
171- ? GFColors .getGFColor (GFColor .dark)
172- : GFColors .getGFColor (GFColor .white);
167+ } else if (color == GFColors .TRANSPARENT ) {
168+ return widget.onPressed != null ? GFColors .DARK : GFColors .WHITE ;
173169 } else {
174- return GFColors .getGFColor ( GFColor .white) ;
170+ return GFColors .WHITE ;
175171 }
176172 }
177173
@@ -193,12 +189,11 @@ class _GFIconButtonState extends State<GFIconButton> {
193189 final BorderSide shapeBorder = widget.type == GFButtonType .outline ||
194190 widget.type == GFButtonType .outline2x
195191 ? outlineBorder
196- : widget.borderSide != null
197- ? widget.borderSide
198- : BorderSide (
199- color: color,
200- width: 0 ,
201- );
192+ : widget.borderSide ??
193+ BorderSide (
194+ color: color,
195+ width: 0 ,
196+ );
202197
203198 ShapeBorder shapeBorderType;
204199
@@ -288,14 +283,13 @@ class _GFIconButtonState extends State<GFIconButton> {
288283 spreadRadius: 2 ,
289284 offset: Offset .zero,
290285 )
291- : widget.boxShadow != null
292- ? widget.boxShadow
293- : BoxShadow (
294- color: Theme .of (context).canvasColor,
295- blurRadius: 0 ,
296- spreadRadius: 0 ,
297- offset: Offset .zero,
298- )
286+ : widget.boxShadow ??
287+ BoxShadow (
288+ color: Theme .of (context).canvasColor,
289+ blurRadius: 0 ,
290+ spreadRadius: 0 ,
291+ offset: Offset .zero,
292+ )
299293 ]);
300294 }
301295 }
@@ -321,9 +315,7 @@ class _GFIconButtonState extends State<GFIconButton> {
321315 child: Material (
322316 shape: widget.type == GFButtonType .transparent
323317 ? null
324- : widget.borderShape == null
325- ? shapeBorderType
326- : widget.borderShape,
318+ : widget.borderShape ?? shapeBorderType,
327319 color: widget.onPressed != null
328320 ? getColor ()
329321 : getDisabledFillColor (),
@@ -333,18 +325,12 @@ class _GFIconButtonState extends State<GFIconButton> {
333325 child: InkResponse (
334326 onTap: widget.onPressed,
335327 child: result,
336- focusColor: widget.focusColor != null
337- ? GFColors .getGFColor (widget.focusColor)
338- : Theme .of (context).focusColor,
339- hoverColor: widget.hoverColor != null
340- ? GFColors .getGFColor (widget.hoverColor)
341- : Theme .of (context).hoverColor,
342- highlightColor: widget.highlightColor != null
343- ? GFColors .getGFColor (widget.highlightColor)
344- : Theme .of (context).highlightColor,
345- splashColor: widget.splashColor != null
346- ? GFColors .getGFColor (widget.splashColor)
347- : Theme .of (context).splashColor,
328+ focusColor: widget.focusColor ?? Theme .of (context).focusColor,
329+ hoverColor: widget.hoverColor ?? Theme .of (context).hoverColor,
330+ highlightColor:
331+ widget.highlightColor ?? Theme .of (context).highlightColor,
332+ splashColor:
333+ widget.splashColor ?? Theme .of (context).splashColor,
348334 radius: math.max (
349335 Material .defaultSplashRadius,
350336 (widget.iconSize +
0 commit comments