diff --git a/lib/src/widgets/buttons/button.dart b/lib/src/widgets/buttons/button.dart index 416e5d6a..0cf91727 100644 --- a/lib/src/widgets/buttons/button.dart +++ b/lib/src/widgets/buttons/button.dart @@ -355,12 +355,14 @@ class MoonButton extends StatelessWidget { final EdgeInsets resolvedDirectionalPadding = effectivePadding.resolve(Directionality.of(context)); - final EdgeInsetsDirectional correctedPadding = EdgeInsetsDirectional.fromSTEB( - leading == null && label != null ? resolvedDirectionalPadding.left : 0, - resolvedDirectionalPadding.top, - trailing == null && label != null ? resolvedDirectionalPadding.right : 0, - resolvedDirectionalPadding.bottom, - ); + final EdgeInsetsGeometry correctedPadding = padding == null + ? EdgeInsetsDirectional.fromSTEB( + leading == null && label != null ? resolvedDirectionalPadding.left : 0, + resolvedDirectionalPadding.top, + trailing == null && label != null ? resolvedDirectionalPadding.right : 0, + resolvedDirectionalPadding.bottom, + ) + : resolvedDirectionalPadding; final Duration effectiveHoverEffectDuration = hoverEffectDuration ?? context.moonEffects?.controlHoverEffect.hoverDuration ?? diff --git a/lib/src/widgets/chips/chip.dart b/lib/src/widgets/chips/chip.dart index f5601d9c..2908d781 100644 --- a/lib/src/widgets/chips/chip.dart +++ b/lib/src/widgets/chips/chip.dart @@ -229,12 +229,14 @@ class MoonChip extends StatelessWidget { final EdgeInsets resolvedDirectionalPadding = effectivePadding.resolve(Directionality.of(context)); - final EdgeInsetsDirectional correctedPadding = EdgeInsetsDirectional.fromSTEB( - leading == null && label != null ? resolvedDirectionalPadding.left : 0, - resolvedDirectionalPadding.top, - trailing == null && label != null ? resolvedDirectionalPadding.right : 0, - resolvedDirectionalPadding.bottom, - ); + final EdgeInsetsGeometry correctedPadding = padding == null + ? EdgeInsetsDirectional.fromSTEB( + leading == null && label != null ? resolvedDirectionalPadding.left : 0, + resolvedDirectionalPadding.top, + trailing == null && label != null ? resolvedDirectionalPadding.right : 0, + resolvedDirectionalPadding.bottom, + ) + : resolvedDirectionalPadding; return MoonBaseControl( autofocus: autofocus, isFocusable: isFocusable, diff --git a/lib/src/widgets/popover/popover.dart b/lib/src/widgets/popover/popover.dart index d09d88d6..8870784d 100644 --- a/lib/src/widgets/popover/popover.dart +++ b/lib/src/widgets/popover/popover.dart @@ -366,6 +366,8 @@ class MoonPopoverState extends State with RouteAware, SingleTickerP final EdgeInsetsGeometry effectiveContentPadding = widget.contentPadding ?? context.moonTheme?.popoverTheme.properties.contentPadding ?? const EdgeInsets.all(12); + final EdgeInsets resolvedContentPadding = effectiveContentPadding.resolve(Directionality.of(context)); + final List effectivePopoverShadows = widget.popoverShadows ?? context.moonTheme?.popoverTheme.shadows.popoverShadows ?? MoonShadows.light.sm; @@ -448,7 +450,7 @@ class MoonPopoverState extends State with RouteAware, SingleTickerP child: Container( key: _popoverKey, constraints: BoxConstraints(maxWidth: popoverPositionParameters.popoverMaxWidth), - padding: effectiveContentPadding, + padding: resolvedContentPadding, decoration: ShapeDecoration( color: effectiveBackgroundColor, shadows: effectivePopoverShadows, diff --git a/lib/src/widgets/tag/tag.dart b/lib/src/widgets/tag/tag.dart index c2cee54a..959f4393 100644 --- a/lib/src/widgets/tag/tag.dart +++ b/lib/src/widgets/tag/tag.dart @@ -121,12 +121,14 @@ class MoonTag extends StatelessWidget { final EdgeInsets resolvedDirectionalPadding = effectivePadding.resolve(Directionality.of(context)); - final EdgeInsetsDirectional correctedPadding = EdgeInsetsDirectional.fromSTEB( - leading == null && label != null ? resolvedDirectionalPadding.left : 0, - resolvedDirectionalPadding.top, - trailing == null && label != null ? resolvedDirectionalPadding.right : 0, - resolvedDirectionalPadding.bottom, - ); + final EdgeInsetsGeometry correctedPadding = padding == null + ? EdgeInsetsDirectional.fromSTEB( + leading == null && label != null ? resolvedDirectionalPadding.left : 0, + resolvedDirectionalPadding.top, + trailing == null && label != null ? resolvedDirectionalPadding.right : 0, + resolvedDirectionalPadding.bottom, + ) + : resolvedDirectionalPadding; return Semantics( label: semanticLabel, diff --git a/lib/src/widgets/toast/toast.dart b/lib/src/widgets/toast/toast.dart index c5482081..bb29d989 100644 --- a/lib/src/widgets/toast/toast.dart +++ b/lib/src/widgets/toast/toast.dart @@ -126,6 +126,8 @@ class MoonToast { final EdgeInsetsGeometry effectiveContentPadding = padding ?? context.moonTheme?.toastTheme.properties.contentPadding ?? EdgeInsets.all(MoonSizes.sizes.x2s); + final EdgeInsets resolvedContentPadding = effectiveContentPadding.resolve(Directionality.of(context)); + final List effectiveToastShadows = toastShadows ?? context.moonTheme?.toastTheme.shadows.toastShadows ?? MoonShadows.light.lg; @@ -170,8 +172,8 @@ class MoonToast { duration: effectiveTransitionDuration, style: DefaultTextStyle.of(context).style.copyWith(color: effectiveElementColor), child: Container( - margin: margin ?? effectiveContentPadding, - padding: effectiveContentPadding, + margin: margin ?? resolvedContentPadding, + padding: resolvedContentPadding, decoration: ShapeDecoration( color: effectiveBackgroundColor, shadows: effectiveToastShadows, diff --git a/lib/src/widgets/tooltip/tooltip.dart b/lib/src/widgets/tooltip/tooltip.dart index b7c1bf29..b03543f2 100644 --- a/lib/src/widgets/tooltip/tooltip.dart +++ b/lib/src/widgets/tooltip/tooltip.dart @@ -416,6 +416,8 @@ class _MoonTooltipState extends State with RouteAware, SingleTicker final EdgeInsetsGeometry effectiveContentPadding = widget.contentPadding ?? context.moonTheme?.tooltipTheme.properties.contentPadding ?? const EdgeInsets.all(12); + final EdgeInsets resolvedContentPadding = effectiveContentPadding.resolve(Directionality.of(context)); + final List effectiveTooltipShadows = widget.tooltipShadows ?? context.moonTheme?.tooltipTheme.shadows.tooltipShadows ?? MoonShadows.light.sm; @@ -504,7 +506,7 @@ class _MoonTooltipState extends State with RouteAware, SingleTicker child: Container( key: _tooltipKey, constraints: BoxConstraints(maxWidth: tooltipPositionParameters.tooltipMaxWidth), - padding: effectiveContentPadding, + padding: resolvedContentPadding, decoration: ShapeDecoration( color: effectiveBackgroundColor, shadows: effectiveTooltipShadows,