@@ -23,6 +23,7 @@ import 'package:flutter/foundation.dart';
2323import 'package:flutter/rendering.dart' ;
2424import 'package:flutter/widgets.dart' ;
2525
26+ import 'button_style_button.dart' ;
2627import 'ink_well.dart' ;
2728import 'material_state.dart' ;
2829import 'theme_data.dart' ;
@@ -174,6 +175,7 @@ class ButtonStyle with Diagnosticable {
174175 this .maximumSize,
175176 this .iconColor,
176177 this .iconSize,
178+ this .iconAlignment,
177179 this .side,
178180 this .shape,
179181 this .mouseCursor,
@@ -279,6 +281,22 @@ class ButtonStyle with Diagnosticable {
279281 /// The icon's size inside of the button.
280282 final MaterialStateProperty <double ?>? iconSize;
281283
284+ /// The alignment of the button's icon.
285+ ///
286+ /// This property is supported for the following button types:
287+ ///
288+ /// * [ElevatedButton.icon] .
289+ /// * [FilledButton.icon] .
290+ /// * [FilledButton.tonalIcon] .
291+ /// * [OutlinedButton.icon] .
292+ /// * [TextButton.icon] .
293+ ///
294+ /// See also:
295+ ///
296+ /// * [IconAlignment] , for more information about the different icon
297+ /// alignments.
298+ final IconAlignment ? iconAlignment;
299+
282300 /// The color and weight of the button's outline.
283301 ///
284302 /// This value is combined with [shape] to create a shape decorated
@@ -407,6 +425,7 @@ class ButtonStyle with Diagnosticable {
407425 MaterialStateProperty <Size ?>? maximumSize,
408426 MaterialStateProperty <Color ?>? iconColor,
409427 MaterialStateProperty <double ?>? iconSize,
428+ IconAlignment ? iconAlignment,
410429 MaterialStateProperty <BorderSide ?>? side,
411430 MaterialStateProperty <OutlinedBorder ?>? shape,
412431 MaterialStateProperty <MouseCursor ?>? mouseCursor,
@@ -433,6 +452,7 @@ class ButtonStyle with Diagnosticable {
433452 maximumSize: maximumSize ?? this .maximumSize,
434453 iconColor: iconColor ?? this .iconColor,
435454 iconSize: iconSize ?? this .iconSize,
455+ iconAlignment: iconAlignment ?? this .iconAlignment,
436456 side: side ?? this .side,
437457 shape: shape ?? this .shape,
438458 mouseCursor: mouseCursor ?? this .mouseCursor,
@@ -470,6 +490,7 @@ class ButtonStyle with Diagnosticable {
470490 maximumSize: maximumSize ?? style.maximumSize,
471491 iconColor: iconColor ?? style.iconColor,
472492 iconSize: iconSize ?? style.iconSize,
493+ iconAlignment: iconAlignment ?? style.iconAlignment,
473494 side: side ?? style.side,
474495 shape: shape ?? style.shape,
475496 mouseCursor: mouseCursor ?? style.mouseCursor,
@@ -500,6 +521,7 @@ class ButtonStyle with Diagnosticable {
500521 maximumSize,
501522 iconColor,
502523 iconSize,
524+ iconAlignment,
503525 side,
504526 shape,
505527 mouseCursor,
@@ -537,6 +559,7 @@ class ButtonStyle with Diagnosticable {
537559 && other.maximumSize == maximumSize
538560 && other.iconColor == iconColor
539561 && other.iconSize == iconSize
562+ && other.iconAlignment == iconAlignment
540563 && other.side == side
541564 && other.shape == shape
542565 && other.mouseCursor == mouseCursor
@@ -566,6 +589,7 @@ class ButtonStyle with Diagnosticable {
566589 properties.add (DiagnosticsProperty <MaterialStateProperty <Size ?>>('maximumSize' , maximumSize, defaultValue: null ));
567590 properties.add (DiagnosticsProperty <MaterialStateProperty <Color ?>>('iconColor' , iconColor, defaultValue: null ));
568591 properties.add (DiagnosticsProperty <MaterialStateProperty <double ?>>('iconSize' , iconSize, defaultValue: null ));
592+ properties.add (EnumProperty <IconAlignment >('iconAlignment' , iconAlignment, defaultValue: null ));
569593 properties.add (DiagnosticsProperty <MaterialStateProperty <BorderSide ?>>('side' , side, defaultValue: null ));
570594 properties.add (DiagnosticsProperty <MaterialStateProperty <OutlinedBorder ?>>('shape' , shape, defaultValue: null ));
571595 properties.add (DiagnosticsProperty <MaterialStateProperty <MouseCursor ?>>('mouseCursor' , mouseCursor, defaultValue: null ));
@@ -597,6 +621,7 @@ class ButtonStyle with Diagnosticable {
597621 maximumSize: MaterialStateProperty .lerp <Size ?>(a? .maximumSize, b? .maximumSize, t, Size .lerp),
598622 iconColor: MaterialStateProperty .lerp <Color ?>(a? .iconColor, b? .iconColor, t, Color .lerp),
599623 iconSize: MaterialStateProperty .lerp <double ?>(a? .iconSize, b? .iconSize, t, lerpDouble),
624+ iconAlignment: t < 0.5 ? a? .iconAlignment : b? .iconAlignment,
600625 side: _lerpSides (a? .side, b? .side, t),
601626 shape: MaterialStateProperty .lerp <OutlinedBorder ?>(a? .shape, b? .shape, t, OutlinedBorder .lerp),
602627 mouseCursor: t < 0.5 ? a? .mouseCursor : b? .mouseCursor,
0 commit comments