diff --git a/packages/flutter/lib/src/material/bottom_navigation_bar.dart b/packages/flutter/lib/src/material/bottom_navigation_bar.dart index 5857c792506..24b62927764 100644 --- a/packages/flutter/lib/src/material/bottom_navigation_bar.dart +++ b/packages/flutter/lib/src/material/bottom_navigation_bar.dart @@ -631,9 +631,9 @@ class _Tile extends StatelessWidget { heightFactor: 1, child: Row( mainAxisSize: MainAxisSize.min, + spacing: 8, children: [ icon, - const SizedBox(width: 8), // Flexible lets the overflow property of // label to work and IntrinsicWidth gives label a // reasonable width preventing extra space before it. diff --git a/packages/flutter/lib/src/material/elevated_button.dart b/packages/flutter/lib/src/material/elevated_button.dart index 73b572c11c1..7b6ae535295 100644 --- a/packages/flutter/lib/src/material/elevated_button.dart +++ b/packages/flutter/lib/src/material/elevated_button.dart @@ -539,7 +539,6 @@ class _ElevatedButtonWithIconChild extends StatelessWidget { buttonStyle?.textStyle?.resolve(const {})?.fontSize ?? 14.0; final double scale = clampDouble(MediaQuery.textScalerOf(context).scale(defaultFontSize) / 14.0, 1.0, 2.0) - 1.0; - final double gap = lerpDouble(8, 4, scale)!; final ElevatedButtonThemeData elevatedButtonTheme = ElevatedButtonTheme.of(context); final IconAlignment effectiveIconAlignment = iconAlignment ?? @@ -548,10 +547,11 @@ class _ElevatedButtonWithIconChild extends StatelessWidget { IconAlignment.start; return Row( mainAxisSize: MainAxisSize.min, + spacing: lerpDouble(8, 4, scale)!, children: effectiveIconAlignment == IconAlignment.start - ? [icon, SizedBox(width: gap), Flexible(child: label)] - : [Flexible(child: label), SizedBox(width: gap), icon], + ? [icon, Flexible(child: label)] + : [Flexible(child: label), icon], ); } } diff --git a/packages/flutter/lib/src/material/filled_button.dart b/packages/flutter/lib/src/material/filled_button.dart index 6c776c551b6..5b1e06743c5 100644 --- a/packages/flutter/lib/src/material/filled_button.dart +++ b/packages/flutter/lib/src/material/filled_button.dart @@ -588,9 +588,7 @@ class _FilledButtonWithIconChild extends StatelessWidget { buttonStyle?.textStyle?.resolve(const {})?.fontSize ?? 14.0; final double scale = clampDouble(MediaQuery.textScalerOf(context).scale(defaultFontSize) / 14.0, 1.0, 2.0) - 1.0; - // Adjust the gap based on the text scale factor. Start at 8, and lerp - // to 4 based on how large the text is. - final double gap = lerpDouble(8, 4, scale)!; + final FilledButtonThemeData filledButtonTheme = FilledButtonTheme.of(context); final IconAlignment effectiveIconAlignment = iconAlignment ?? @@ -599,10 +597,11 @@ class _FilledButtonWithIconChild extends StatelessWidget { IconAlignment.start; return Row( mainAxisSize: MainAxisSize.min, + spacing: lerpDouble(8, 4, scale)!, children: effectiveIconAlignment == IconAlignment.start - ? [icon, SizedBox(width: gap), Flexible(child: label)] - : [Flexible(child: label), SizedBox(width: gap), icon], + ? [icon, Flexible(child: label)] + : [Flexible(child: label), icon], ); } } diff --git a/packages/flutter/lib/src/material/outlined_button.dart b/packages/flutter/lib/src/material/outlined_button.dart index 82191c60b73..3a32c6915fe 100644 --- a/packages/flutter/lib/src/material/outlined_button.dart +++ b/packages/flutter/lib/src/material/outlined_button.dart @@ -487,7 +487,7 @@ class _OutlinedButtonWithIconChild extends StatelessWidget { buttonStyle?.textStyle?.resolve(const {})?.fontSize ?? 14.0; final double scale = clampDouble(MediaQuery.textScalerOf(context).scale(defaultFontSize) / 14.0, 1.0, 2.0) - 1.0; - final double gap = lerpDouble(8, 4, scale)!; + final OutlinedButtonThemeData outlinedButtonTheme = OutlinedButtonTheme.of(context); final IconAlignment effectiveIconAlignment = iconAlignment ?? @@ -496,10 +496,11 @@ class _OutlinedButtonWithIconChild extends StatelessWidget { IconAlignment.start; return Row( mainAxisSize: MainAxisSize.min, + spacing: lerpDouble(8, 4, scale)!, children: effectiveIconAlignment == IconAlignment.start - ? [icon, SizedBox(width: gap), Flexible(child: label)] - : [Flexible(child: label), SizedBox(width: gap), icon], + ? [icon, Flexible(child: label)] + : [Flexible(child: label), icon], ); } } diff --git a/packages/flutter/lib/src/material/text_button.dart b/packages/flutter/lib/src/material/text_button.dart index d665ec7170d..59a549f1423 100644 --- a/packages/flutter/lib/src/material/text_button.dart +++ b/packages/flutter/lib/src/material/text_button.dart @@ -516,7 +516,6 @@ class _TextButtonWithIconChild extends StatelessWidget { buttonStyle?.textStyle?.resolve(const {})?.fontSize ?? 14.0; final double scale = clampDouble(MediaQuery.textScalerOf(context).scale(defaultFontSize) / 14.0, 1.0, 2.0) - 1.0; - final double gap = lerpDouble(8, 4, scale)!; final TextButtonThemeData textButtonTheme = TextButtonTheme.of(context); final IconAlignment effectiveIconAlignment = iconAlignment ?? @@ -525,10 +524,11 @@ class _TextButtonWithIconChild extends StatelessWidget { IconAlignment.start; return Row( mainAxisSize: MainAxisSize.min, + spacing: lerpDouble(8, 4, scale)!, children: effectiveIconAlignment == IconAlignment.start - ? [icon, SizedBox(width: gap), Flexible(child: label)] - : [Flexible(child: label), SizedBox(width: gap), icon], + ? [icon, Flexible(child: label)] + : [Flexible(child: label), icon], ); } }