@@ -116,6 +116,18 @@ class GFButton extends StatefulWidget {
116116 /// on true state default box shadow appears around button
117117 final bool buttonBoxShadow;
118118
119+ /// A set of thirteen colors that can be used to derive the button theme's
120+ /// colors.
121+ ///
122+ /// This property was added much later than the theme's set of highly
123+ /// specific colors, like [ThemeData.buttonColor] , [ThemeData.highlightColor] ,
124+ /// [ThemeData.splashColor] etc.
125+ ///
126+ /// The colors for new button classes can be defined exclusively in terms
127+ /// of [colorScheme] . When it's possible, the existing buttons will
128+ /// (continue to) gradually migrate to it.
129+ final ColorScheme colorScheme;
130+
119131 /// Create buttons of all types. check out [GFIconButton] for icon buttons, and [GFBadge] for badges
120132 const GFButton ({
121133 Key key,
@@ -144,7 +156,7 @@ class GFButton extends StatefulWidget {
144156 this .child,
145157 this .type = GFType .solid,
146158 this .shape = GFShape .standard,
147- this .color = GFColor .primary ,
159+ this .color,
148160 this .textColor = GFColor .dark,
149161 this .position = GFPosition .start,
150162 this .size = GFSize .medium,
@@ -153,6 +165,7 @@ class GFButton extends StatefulWidget {
153165 this .icon,
154166 this .blockButton,
155167 this .fullWidthButton,
168+ this .colorScheme,
156169 }) : materialTapTargetSize =
157170 materialTapTargetSize ?? MaterialTapTargetSize .padded,
158171 assert (shape != null , 'Button shape can not be null' ),
@@ -333,7 +346,6 @@ class _GFButtonState extends State<GFButton> {
333346 borderRadius: BorderRadius .circular (50.0 ), side: shapeBorder);
334347 }
335348
336-
337349 return Semantics (
338350 container: true ,
339351 button: true ,
@@ -368,9 +380,9 @@ class _GFButtonState extends State<GFButton> {
368380 ),
369381 child: Material (
370382 textStyle: widget.textStyle == null ? TextStyle (color: this .textColor, fontSize: 14 ) : widget.textStyle,
371- shape: widget.type == GFType .transparent ? null : widget.borderShape== null ? shape : widget.borderShape,
372- color: widget.type != GFType .outline || widget.type == null ? this .color : Theme . of (context).canvasColor ,
373- type: widget.type == GFType .transparent ? MaterialType .transparency : MaterialType .button,
383+ shape: widget.type == GFType .transparent ? null : widget.borderShape == null ? shape : widget.borderShape,
384+ color: widget.type != GFType .transparent ? this .color : null ,
385+ // type: widget.type == GFType.transparent ? null : MaterialType.button,
374386 animationDuration: widget.animationDuration,
375387 clipBehavior: widget.clipBehavior,
376388 child: InkWell (
0 commit comments