@@ -345,6 +345,50 @@ class FilledButton extends ButtonStyleButton {
345345 /// shape's [OutlinedBorder.side] . Typically the default value of an
346346 /// [OutlinedBorder] 's side is [BorderSide.none] , so an outline is not drawn.
347347 ///
348+ /// ## Material 3 defaults
349+ ///
350+ /// If [ThemeData.useMaterial3] is set to true the following defaults will
351+ /// be used:
352+ ///
353+ /// * `textStyle` - Theme.textTheme.labelLarge
354+ /// * `backgroundColor`
355+ /// * disabled - Theme.colorScheme.onSurface(0.12)
356+ /// * others - Theme.colorScheme.secondaryContainer
357+ /// * `foregroundColor`
358+ /// * disabled - Theme.colorScheme.onSurface(0.38)
359+ /// * others - Theme.colorScheme.onSecondaryContainer
360+ /// * `overlayColor`
361+ /// * hovered - Theme.colorScheme.onSecondaryContainer(0.08)
362+ /// * focused or pressed - Theme.colorScheme.onSecondaryContainer(0.12)
363+ /// * `shadowColor` - Theme.colorScheme.shadow
364+ /// * `surfaceTintColor` - Colors.transparent
365+ /// * `elevation`
366+ /// * disabled - 0
367+ /// * default - 1
368+ /// * hovered - 3
369+ /// * focused or pressed - 1
370+ /// * `padding`
371+ /// * `textScaleFactor <= 1` - horizontal(24)
372+ /// * `1 < textScaleFactor <= 2` - lerp(horizontal(24), horizontal(12))
373+ /// * `2 < textScaleFactor <= 3` - lerp(horizontal(12), horizontal(6))
374+ /// * `3 < textScaleFactor` - horizontal(6)
375+ /// * `minimumSize` - Size(64, 40)
376+ /// * `fixedSize` - null
377+ /// * `maximumSize` - Size.infinite
378+ /// * `side` - null
379+ /// * `shape` - StadiumBorder()
380+ /// * `mouseCursor`
381+ /// * disabled - SystemMouseCursors.basic
382+ /// * others - SystemMouseCursors.click
383+ /// * `visualDensity` - Theme.visualDensity
384+ /// * `tapTargetSize` - Theme.materialTapTargetSize
385+ /// * `animationDuration` - kThemeChangeDuration
386+ /// * `enableFeedback` - true
387+ /// * `alignment` - Alignment.center
388+ /// * `splashFactory` - Theme.splashFactory
389+ ///
390+ /// For the [FilledButton.icon] factory, the start (generally the left) value of
391+ /// [padding] is reduced from 24 to 16.
348392 @override
349393 ButtonStyle defaultStyleOf (BuildContext context) {
350394 switch (_variant) {
@@ -364,10 +408,12 @@ class FilledButton extends ButtonStyleButton {
364408}
365409
366410EdgeInsetsGeometry _scaledPadding (BuildContext context) {
411+ final bool useMaterial3 = Theme .of (context).useMaterial3;
412+ final double padding1x = useMaterial3 ? 24.0 : 16.0 ;
367413 return ButtonStyleButton .scaledPadding (
368- const EdgeInsets .symmetric (horizontal: 16 ),
369- const EdgeInsets .symmetric (horizontal: 8 ),
370- const EdgeInsets .symmetric (horizontal: 4 ),
414+ EdgeInsets .symmetric (horizontal: padding1x ),
415+ EdgeInsets .symmetric (horizontal: padding1x / 2 ),
416+ EdgeInsets .symmetric (horizontal: padding1x / 2 / 2 ),
371417 MediaQuery .textScaleFactorOf (context),
372418 );
373419}
@@ -463,7 +509,13 @@ class _FilledButtonWithIcon extends FilledButton {
463509
464510 @override
465511 ButtonStyle defaultStyleOf (BuildContext context) {
466- final EdgeInsetsGeometry scaledPadding = ButtonStyleButton .scaledPadding (
512+ final bool useMaterial3 = Theme .of (context).useMaterial3;
513+ final EdgeInsetsGeometry scaledPadding = useMaterial3 ? ButtonStyleButton .scaledPadding (
514+ const EdgeInsetsDirectional .fromSTEB (16 , 0 , 24 , 0 ),
515+ const EdgeInsetsDirectional .fromSTEB (8 , 0 , 12 , 0 ),
516+ const EdgeInsetsDirectional .fromSTEB (4 , 0 , 6 , 0 ),
517+ MediaQuery .textScaleFactorOf (context),
518+ ) : ButtonStyleButton .scaledPadding (
467519 const EdgeInsetsDirectional .fromSTEB (12 , 0 , 16 , 0 ),
468520 const EdgeInsets .symmetric (horizontal: 8 ),
469521 const EdgeInsetsDirectional .fromSTEB (8 , 0 , 4 , 0 ),
0 commit comments