From 73ee30e5fd4839718c867fbf2c72add1ad8f8b50 Mon Sep 17 00:00:00 2001 From: tmaihoff Date: Sun, 1 Sep 2024 11:30:46 +0200 Subject: [PATCH 1/2] fix: remove annotated region for FlashPosition.top --- lib/src/flash.dart | 141 ++++++++++++++++++++++++++++++--------------- 1 file changed, 93 insertions(+), 48 deletions(-) diff --git a/lib/src/flash.dart b/lib/src/flash.dart index 45b483e..407cf01 100644 --- a/lib/src/flash.dart +++ b/lib/src/flash.dart @@ -57,16 +57,25 @@ class Flash extends StatefulWidget { /// Called to create the animation that exposes the current progress of the transition /// controlled by the animation controller created by [FlashController.createAnimationController]. final Animation Function( - BuildContext context, FlashPosition? position, Animation parent, Curve curve, Curve? reverseCurve) - slideAnimationCreator; + BuildContext context, + FlashPosition? position, + Animation parent, + Curve curve, + Curve? reverseCurve) slideAnimationCreator; static Animation _defaultSlideAnimationCreator( - BuildContext context, FlashPosition? position, Animation parent, Curve curve, Curve? reverseCurve) { + BuildContext context, + FlashPosition? position, + Animation parent, + Curve curve, + Curve? reverseCurve) { Animatable animatable; if (position == FlashPosition.top) { - animatable = Tween(begin: const Offset(0.0, -1.0), end: Offset.zero); + animatable = + Tween(begin: const Offset(0.0, -1.0), end: Offset.zero); } else if (position == FlashPosition.bottom) { - animatable = Tween(begin: const Offset(0.0, 1.0), end: Offset.zero); + animatable = + Tween(begin: const Offset(0.0, 1.0), end: Offset.zero); } else { animatable = Tween(begin: Offset.zero, end: Offset.zero); } @@ -94,11 +103,14 @@ class _FlashState extends State> { return box.size.height; } - bool get enableVerticalDrag => widget.dismissDirections.contains(FlashDismissDirection.vertical); + bool get enableVerticalDrag => + widget.dismissDirections.contains(FlashDismissDirection.vertical); - bool get enableEndToStartDrag => widget.dismissDirections.contains(FlashDismissDirection.endToStart); + bool get enableEndToStartDrag => + widget.dismissDirections.contains(FlashDismissDirection.endToStart); - bool get enableStartToEndDrag => widget.dismissDirections.contains(FlashDismissDirection.startToEnd); + bool get enableStartToEndDrag => + widget.dismissDirections.contains(FlashDismissDirection.startToEnd); bool get enableHorizontalDrag => enableEndToStartDrag || enableStartToEndDrag; @@ -141,7 +153,8 @@ class _FlashState extends State> { } bool get _dismissUnderway => - animationController.status == AnimationStatus.reverse || animationController.status == AnimationStatus.dismissed; + animationController.status == AnimationStatus.reverse || + animationController.status == AnimationStatus.dismissed; @override Widget build(BuildContext context) { @@ -150,9 +163,12 @@ class _FlashState extends State> { position: _moveAnimation, child: GestureDetector( behavior: HitTestBehavior.deferToChild, - onHorizontalDragUpdate: enableHorizontalDrag ? _handleHorizontalDragUpdate : null, - onHorizontalDragEnd: enableHorizontalDrag ? _handleHorizontalDragEnd : null, - onVerticalDragUpdate: enableVerticalDrag ? _handleVerticalDragUpdate : null, + onHorizontalDragUpdate: + enableHorizontalDrag ? _handleHorizontalDragUpdate : null, + onHorizontalDragEnd: + enableHorizontalDrag ? _handleHorizontalDragEnd : null, + onVerticalDragUpdate: + enableVerticalDrag ? _handleVerticalDragUpdate : null, onVerticalDragEnd: enableVerticalDrag ? _handleVerticalDragEnd : null, child: widget.child, excludeFromSemantics: true, @@ -212,7 +228,8 @@ class _FlashState extends State> { setState(() => _moveAnimation = _animation); } if (details.velocity.pixelsPerSecond.dx.abs() > _kMinFlingVelocity) { - final double flingVelocity = details.velocity.pixelsPerSecond.dx / _childHeight; + final double flingVelocity = + details.velocity.pixelsPerSecond.dx / _childHeight; switch (_describeFlingGesture(details.velocity.pixelsPerSecond.dx)) { case _FlingGestureKind.none: animationController.forward(); @@ -246,16 +263,24 @@ class _FlashState extends State> { } else if (enableEndToStartDrag) { switch (Directionality.of(context)) { case TextDirection.rtl: - return dragExtent < 0 ? _FlingGestureKind.none : _FlingGestureKind.forward; + return dragExtent < 0 + ? _FlingGestureKind.none + : _FlingGestureKind.forward; case TextDirection.ltr: - return dragExtent > 0 ? _FlingGestureKind.none : _FlingGestureKind.reverse; + return dragExtent > 0 + ? _FlingGestureKind.none + : _FlingGestureKind.reverse; } } else { switch (Directionality.of(context)) { case TextDirection.rtl: - return dragExtent < 0 ? _FlingGestureKind.reverse : _FlingGestureKind.none; + return dragExtent < 0 + ? _FlingGestureKind.reverse + : _FlingGestureKind.none; case TextDirection.ltr: - return dragExtent > 0 ? _FlingGestureKind.forward : _FlingGestureKind.none; + return dragExtent > 0 + ? _FlingGestureKind.forward + : _FlingGestureKind.none; } } } @@ -282,7 +307,8 @@ class _FlashState extends State> { setState(() => _moveAnimation = _animation); } if (details.velocity.pixelsPerSecond.dy.abs() > _kMinFlingVelocity) { - final double flingVelocity = details.velocity.pixelsPerSecond.dy / _childHeight; + final double flingVelocity = + details.velocity.pixelsPerSecond.dy / _childHeight; if (widget.position == FlashPosition.top) { animationController.fling(velocity: flingVelocity); if (flingVelocity < 0) controller.deactivate(); @@ -323,9 +349,11 @@ class _FlashState extends State> { animatable = Tween(begin: Offset(end, 0.0), end: Offset.zero); } else { if (widget.position == FlashPosition.top) { - animatable = Tween(begin: const Offset(0.0, -1.0), end: Offset.zero); + animatable = + Tween(begin: const Offset(0.0, -1.0), end: Offset.zero); } else { - animatable = Tween(begin: const Offset(0.0, 1.0), end: Offset.zero); + animatable = + Tween(begin: const Offset(0.0, 1.0), end: Offset.zero); } } _moveAnimation = animationController.drive(animatable); @@ -482,7 +510,8 @@ class FlashBar extends StatefulWidget { State createState() => _FlashBarState(); } -class _FlashBarState extends State with SingleTickerProviderStateMixin { +class _FlashBarState extends State + with SingleTickerProviderStateMixin { AnimationController? _fadeController; Animation? _fadeAnimation; @@ -505,7 +534,8 @@ class _FlashBarState extends State with SingleTickerProviderStateMixin } void _configurePulseAnimation() { - _fadeController = AnimationController(vsync: this, duration: _pulseAnimationDuration); + _fadeController = + AnimationController(vsync: this, duration: _pulseAnimationDuration); _fadeAnimation = Tween(begin: _initialOpacity, end: _finalOpacity).animate( CurvedAnimation( parent: _fadeController!, @@ -539,10 +569,17 @@ class _FlashBarState extends State with SingleTickerProviderStateMixin final position = widget.position; final behavior = widget.behavior; final padding = widget.padding ?? barTheme?.padding ?? defaults.padding; - final backgroundColor = widget.backgroundColor ?? barTheme?.backgroundColor ?? defaults.backgroundColor!; - final titleTextStyle = widget.titleTextStyle ?? barTheme?.titleTextStyle ?? defaults.titleTextStyle!; - final contentTextStyle = widget.contentTextStyle ?? barTheme?.contentTextStyle ?? defaults.contentTextStyle!; - final iconColor = widget.iconColor ?? barTheme?.iconColor ?? defaults.iconColor; + final backgroundColor = widget.backgroundColor ?? + barTheme?.backgroundColor ?? + defaults.backgroundColor!; + final titleTextStyle = widget.titleTextStyle ?? + barTheme?.titleTextStyle ?? + defaults.titleTextStyle!; + final contentTextStyle = widget.contentTextStyle ?? + barTheme?.contentTextStyle ?? + defaults.contentTextStyle!; + final iconColor = + widget.iconColor ?? barTheme?.iconColor ?? defaults.iconColor; Widget child = Column( mainAxisSize: MainAxisSize.min, children: [ @@ -566,7 +603,8 @@ class _FlashBarState extends State with SingleTickerProviderStateMixin IntrinsicHeight( child: Row( mainAxisSize: MainAxisSize.min, - children: _getAppropriateRowLayout(titleTextStyle, contentTextStyle, iconColor, padding), + children: _getAppropriateRowLayout( + titleTextStyle, contentTextStyle, iconColor, padding), ), ), ], @@ -580,14 +618,6 @@ class _FlashBarState extends State with SingleTickerProviderStateMixin ); } - if (widget.position == FlashPosition.top) { - final brightness = ThemeData.estimateBrightnessForColor(backgroundColor); - child = AnnotatedRegion( - value: brightness == Brightness.dark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark, - child: child, - ); - } - child = FadeTransition( opacity: widget.controller.controller, child: Flash( @@ -598,13 +628,19 @@ class _FlashBarState extends State with SingleTickerProviderStateMixin reverseAnimationCurve: widget.reverseAnimationCurve, child: Material( color: backgroundColor, - elevation: widget.elevation ?? barTheme?.elevation ?? defaults.elevation, - shadowColor: widget.shadowColor ?? barTheme?.shadowColor ?? defaults.shadowColor, - surfaceTintColor: widget.surfaceTintColor ?? barTheme?.surfaceTintColor ?? defaults.surfaceTintColor, + elevation: + widget.elevation ?? barTheme?.elevation ?? defaults.elevation, + shadowColor: widget.shadowColor ?? + barTheme?.shadowColor ?? + defaults.shadowColor, + surfaceTintColor: widget.surfaceTintColor ?? + barTheme?.surfaceTintColor ?? + defaults.surfaceTintColor, shape: widget.shape ?? barTheme?.shape ?? defaults.shape, type: MaterialType.card, clipBehavior: widget.clipBehavior, - child: widget.builder == null ? child : widget.builder!(context, child), + child: + widget.builder == null ? child : widget.builder!(context, child), ), ), ); @@ -618,9 +654,12 @@ class _FlashBarState extends State with SingleTickerProviderStateMixin } return Align( - alignment: position == FlashPosition.top ? Alignment.topCenter : Alignment.bottomCenter, + alignment: position == FlashPosition.top + ? Alignment.topCenter + : Alignment.bottomCenter, child: AnimatedPadding( - padding: MediaQuery.of(context).viewInsets + (widget.margin ?? barTheme?.margin ?? defaults.margin), + padding: MediaQuery.of(context).viewInsets + + (widget.margin ?? barTheme?.margin ?? defaults.margin), duration: widget.insetAnimationDuration, curve: widget.insetAnimationCurve, child: MediaQuery.removeViewInsets( @@ -635,8 +674,8 @@ class _FlashBarState extends State with SingleTickerProviderStateMixin ); } - List _getAppropriateRowLayout( - TextStyle titleTextStyle, TextStyle contentTextStyle, Color? iconColor, EdgeInsets padding) { + List _getAppropriateRowLayout(TextStyle titleTextStyle, + TextStyle contentTextStyle, Color? iconColor, EdgeInsets padding) { final messageTopMargin = _isTitlePresent ? 6.0 : padding.top; final messageBottomMargin = _isActionsPresent ? 6.0 : padding.bottom; double buttonRightPadding; @@ -903,7 +942,9 @@ class _FlashBarState extends State with SingleTickerProviderStateMixin return ButtonTheme( textTheme: ButtonTextTheme.primary, child: IconTheme( - data: Theme.of(context).iconTheme.copyWith(color: buttonTheme.colorScheme?.primary), + data: Theme.of(context) + .iconTheme + .copyWith(color: buttonTheme.colorScheme?.primary), child: widget.primaryAction!, ), ); @@ -917,7 +958,8 @@ class FlashToastTheme extends ThemeExtension { this.elevation = 4.0, this.shadowColor, this.surfaceTintColor, - this.shape = const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4.0))), + this.shape = const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(4.0))), this.alignment = const Alignment(0.0, 0.5), this.iconColor, this.textStyle, @@ -978,7 +1020,8 @@ class FlashToastTheme extends ThemeExtension { backgroundColor: Color.lerp(backgroundColor, other?.backgroundColor, t), elevation: lerpDouble(elevation, other?.elevation, t)!, shadowColor: Color.lerp(shadowColor, other?.shadowColor, t), - surfaceTintColor: Color.lerp(surfaceTintColor, other?.surfaceTintColor, t), + surfaceTintColor: + Color.lerp(surfaceTintColor, other?.surfaceTintColor, t), shape: ShapeBorder.lerp(shape, other?.shape, t), alignment: AlignmentGeometry.lerp(alignment, other?.alignment, t)!, iconColor: Color.lerp(iconColor, other?.iconColor, t), @@ -1066,12 +1109,14 @@ class FlashBarTheme extends ThemeExtension { backgroundColor: Color.lerp(backgroundColor, other?.backgroundColor, t), elevation: lerpDouble(elevation, other?.elevation, t)!, shadowColor: Color.lerp(shadowColor, other?.shadowColor, t), - surfaceTintColor: Color.lerp(surfaceTintColor, other?.surfaceTintColor, t), + surfaceTintColor: + Color.lerp(surfaceTintColor, other?.surfaceTintColor, t), shape: ShapeBorder.lerp(shape, other?.shape, t), padding: EdgeInsets.lerp(padding, other?.padding, t)!, iconColor: Color.lerp(iconColor, other?.iconColor, t), titleTextStyle: TextStyle.lerp(titleTextStyle, other?.titleTextStyle, t), - contentTextStyle: TextStyle.lerp(contentTextStyle, other?.contentTextStyle, t), + contentTextStyle: + TextStyle.lerp(contentTextStyle, other?.contentTextStyle, t), ); } } From 3edca0ed674f6ebb315a81afc108161a6c4977af Mon Sep 17 00:00:00 2001 From: Tobias Maihoff <44509310+tmaihoff@users.noreply.github.com> Date: Sun, 1 Sep 2024 11:46:03 +0200 Subject: [PATCH 2/2] refactor: fix formatting --- lib/src/flash.dart | 135 ++++++++++++++------------------------------- 1 file changed, 41 insertions(+), 94 deletions(-) diff --git a/lib/src/flash.dart b/lib/src/flash.dart index 407cf01..d7ad5c5 100644 --- a/lib/src/flash.dart +++ b/lib/src/flash.dart @@ -57,25 +57,16 @@ class Flash extends StatefulWidget { /// Called to create the animation that exposes the current progress of the transition /// controlled by the animation controller created by [FlashController.createAnimationController]. final Animation Function( - BuildContext context, - FlashPosition? position, - Animation parent, - Curve curve, - Curve? reverseCurve) slideAnimationCreator; + BuildContext context, FlashPosition? position, Animation parent, Curve curve, Curve? reverseCurve) + slideAnimationCreator; static Animation _defaultSlideAnimationCreator( - BuildContext context, - FlashPosition? position, - Animation parent, - Curve curve, - Curve? reverseCurve) { + BuildContext context, FlashPosition? position, Animation parent, Curve curve, Curve? reverseCurve) { Animatable animatable; if (position == FlashPosition.top) { - animatable = - Tween(begin: const Offset(0.0, -1.0), end: Offset.zero); + animatable = Tween(begin: const Offset(0.0, -1.0), end: Offset.zero); } else if (position == FlashPosition.bottom) { - animatable = - Tween(begin: const Offset(0.0, 1.0), end: Offset.zero); + animatable = Tween(begin: const Offset(0.0, 1.0), end: Offset.zero); } else { animatable = Tween(begin: Offset.zero, end: Offset.zero); } @@ -103,14 +94,11 @@ class _FlashState extends State> { return box.size.height; } - bool get enableVerticalDrag => - widget.dismissDirections.contains(FlashDismissDirection.vertical); + bool get enableVerticalDrag => widget.dismissDirections.contains(FlashDismissDirection.vertical); - bool get enableEndToStartDrag => - widget.dismissDirections.contains(FlashDismissDirection.endToStart); + bool get enableEndToStartDrag => widget.dismissDirections.contains(FlashDismissDirection.endToStart); - bool get enableStartToEndDrag => - widget.dismissDirections.contains(FlashDismissDirection.startToEnd); + bool get enableStartToEndDrag => widget.dismissDirections.contains(FlashDismissDirection.startToEnd); bool get enableHorizontalDrag => enableEndToStartDrag || enableStartToEndDrag; @@ -153,8 +141,7 @@ class _FlashState extends State> { } bool get _dismissUnderway => - animationController.status == AnimationStatus.reverse || - animationController.status == AnimationStatus.dismissed; + animationController.status == AnimationStatus.reverse || animationController.status == AnimationStatus.dismissed; @override Widget build(BuildContext context) { @@ -163,12 +150,9 @@ class _FlashState extends State> { position: _moveAnimation, child: GestureDetector( behavior: HitTestBehavior.deferToChild, - onHorizontalDragUpdate: - enableHorizontalDrag ? _handleHorizontalDragUpdate : null, - onHorizontalDragEnd: - enableHorizontalDrag ? _handleHorizontalDragEnd : null, - onVerticalDragUpdate: - enableVerticalDrag ? _handleVerticalDragUpdate : null, + onHorizontalDragUpdate: enableHorizontalDrag ? _handleHorizontalDragUpdate : null, + onHorizontalDragEnd: enableHorizontalDrag ? _handleHorizontalDragEnd : null, + onVerticalDragUpdate: enableVerticalDrag ? _handleVerticalDragUpdate : null, onVerticalDragEnd: enableVerticalDrag ? _handleVerticalDragEnd : null, child: widget.child, excludeFromSemantics: true, @@ -228,8 +212,7 @@ class _FlashState extends State> { setState(() => _moveAnimation = _animation); } if (details.velocity.pixelsPerSecond.dx.abs() > _kMinFlingVelocity) { - final double flingVelocity = - details.velocity.pixelsPerSecond.dx / _childHeight; + final double flingVelocity = details.velocity.pixelsPerSecond.dx / _childHeight; switch (_describeFlingGesture(details.velocity.pixelsPerSecond.dx)) { case _FlingGestureKind.none: animationController.forward(); @@ -263,24 +246,16 @@ class _FlashState extends State> { } else if (enableEndToStartDrag) { switch (Directionality.of(context)) { case TextDirection.rtl: - return dragExtent < 0 - ? _FlingGestureKind.none - : _FlingGestureKind.forward; + return dragExtent < 0 ? _FlingGestureKind.none : _FlingGestureKind.forward; case TextDirection.ltr: - return dragExtent > 0 - ? _FlingGestureKind.none - : _FlingGestureKind.reverse; + return dragExtent > 0 ? _FlingGestureKind.none : _FlingGestureKind.reverse; } } else { switch (Directionality.of(context)) { case TextDirection.rtl: - return dragExtent < 0 - ? _FlingGestureKind.reverse - : _FlingGestureKind.none; + return dragExtent < 0 ? _FlingGestureKind.reverse : _FlingGestureKind.none; case TextDirection.ltr: - return dragExtent > 0 - ? _FlingGestureKind.forward - : _FlingGestureKind.none; + return dragExtent > 0 ? _FlingGestureKind.forward : _FlingGestureKind.none; } } } @@ -307,8 +282,7 @@ class _FlashState extends State> { setState(() => _moveAnimation = _animation); } if (details.velocity.pixelsPerSecond.dy.abs() > _kMinFlingVelocity) { - final double flingVelocity = - details.velocity.pixelsPerSecond.dy / _childHeight; + final double flingVelocity = details.velocity.pixelsPerSecond.dy / _childHeight; if (widget.position == FlashPosition.top) { animationController.fling(velocity: flingVelocity); if (flingVelocity < 0) controller.deactivate(); @@ -349,11 +323,9 @@ class _FlashState extends State> { animatable = Tween(begin: Offset(end, 0.0), end: Offset.zero); } else { if (widget.position == FlashPosition.top) { - animatable = - Tween(begin: const Offset(0.0, -1.0), end: Offset.zero); + animatable = Tween(begin: const Offset(0.0, -1.0), end: Offset.zero); } else { - animatable = - Tween(begin: const Offset(0.0, 1.0), end: Offset.zero); + animatable = Tween(begin: const Offset(0.0, 1.0), end: Offset.zero); } } _moveAnimation = animationController.drive(animatable); @@ -510,8 +482,7 @@ class FlashBar extends StatefulWidget { State createState() => _FlashBarState(); } -class _FlashBarState extends State - with SingleTickerProviderStateMixin { +class _FlashBarState extends State with SingleTickerProviderStateMixin { AnimationController? _fadeController; Animation? _fadeAnimation; @@ -534,8 +505,7 @@ class _FlashBarState extends State } void _configurePulseAnimation() { - _fadeController = - AnimationController(vsync: this, duration: _pulseAnimationDuration); + _fadeController = AnimationController(vsync: this, duration: _pulseAnimationDuration); _fadeAnimation = Tween(begin: _initialOpacity, end: _finalOpacity).animate( CurvedAnimation( parent: _fadeController!, @@ -569,17 +539,10 @@ class _FlashBarState extends State final position = widget.position; final behavior = widget.behavior; final padding = widget.padding ?? barTheme?.padding ?? defaults.padding; - final backgroundColor = widget.backgroundColor ?? - barTheme?.backgroundColor ?? - defaults.backgroundColor!; - final titleTextStyle = widget.titleTextStyle ?? - barTheme?.titleTextStyle ?? - defaults.titleTextStyle!; - final contentTextStyle = widget.contentTextStyle ?? - barTheme?.contentTextStyle ?? - defaults.contentTextStyle!; - final iconColor = - widget.iconColor ?? barTheme?.iconColor ?? defaults.iconColor; + final backgroundColor = widget.backgroundColor ?? barTheme?.backgroundColor ?? defaults.backgroundColor!; + final titleTextStyle = widget.titleTextStyle ?? barTheme?.titleTextStyle ?? defaults.titleTextStyle!; + final contentTextStyle = widget.contentTextStyle ?? barTheme?.contentTextStyle ?? defaults.contentTextStyle!; + final iconColor = widget.iconColor ?? barTheme?.iconColor ?? defaults.iconColor; Widget child = Column( mainAxisSize: MainAxisSize.min, children: [ @@ -603,8 +566,7 @@ class _FlashBarState extends State IntrinsicHeight( child: Row( mainAxisSize: MainAxisSize.min, - children: _getAppropriateRowLayout( - titleTextStyle, contentTextStyle, iconColor, padding), + children: _getAppropriateRowLayout(titleTextStyle, contentTextStyle, iconColor, padding), ), ), ], @@ -628,19 +590,13 @@ class _FlashBarState extends State reverseAnimationCurve: widget.reverseAnimationCurve, child: Material( color: backgroundColor, - elevation: - widget.elevation ?? barTheme?.elevation ?? defaults.elevation, - shadowColor: widget.shadowColor ?? - barTheme?.shadowColor ?? - defaults.shadowColor, - surfaceTintColor: widget.surfaceTintColor ?? - barTheme?.surfaceTintColor ?? - defaults.surfaceTintColor, + elevation: widget.elevation ?? barTheme?.elevation ?? defaults.elevation, + shadowColor: widget.shadowColor ?? barTheme?.shadowColor ?? defaults.shadowColor, + surfaceTintColor: widget.surfaceTintColor ?? barTheme?.surfaceTintColor ?? defaults.surfaceTintColor, shape: widget.shape ?? barTheme?.shape ?? defaults.shape, type: MaterialType.card, clipBehavior: widget.clipBehavior, - child: - widget.builder == null ? child : widget.builder!(context, child), + child: widget.builder == null ? child : widget.builder!(context, child), ), ), ); @@ -654,12 +610,9 @@ class _FlashBarState extends State } return Align( - alignment: position == FlashPosition.top - ? Alignment.topCenter - : Alignment.bottomCenter, + alignment: position == FlashPosition.top ? Alignment.topCenter : Alignment.bottomCenter, child: AnimatedPadding( - padding: MediaQuery.of(context).viewInsets + - (widget.margin ?? barTheme?.margin ?? defaults.margin), + padding: MediaQuery.of(context).viewInsets + (widget.margin ?? barTheme?.margin ?? defaults.margin), duration: widget.insetAnimationDuration, curve: widget.insetAnimationCurve, child: MediaQuery.removeViewInsets( @@ -674,8 +627,8 @@ class _FlashBarState extends State ); } - List _getAppropriateRowLayout(TextStyle titleTextStyle, - TextStyle contentTextStyle, Color? iconColor, EdgeInsets padding) { + List _getAppropriateRowLayout( + TextStyle titleTextStyle, TextStyle contentTextStyle, Color? iconColor, EdgeInsets padding) { final messageTopMargin = _isTitlePresent ? 6.0 : padding.top; final messageBottomMargin = _isActionsPresent ? 6.0 : padding.bottom; double buttonRightPadding; @@ -942,9 +895,7 @@ class _FlashBarState extends State return ButtonTheme( textTheme: ButtonTextTheme.primary, child: IconTheme( - data: Theme.of(context) - .iconTheme - .copyWith(color: buttonTheme.colorScheme?.primary), + data: Theme.of(context).iconTheme.copyWith(color: buttonTheme.colorScheme?.primary), child: widget.primaryAction!, ), ); @@ -958,8 +909,7 @@ class FlashToastTheme extends ThemeExtension { this.elevation = 4.0, this.shadowColor, this.surfaceTintColor, - this.shape = const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(4.0))), + this.shape = const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(4.0))), this.alignment = const Alignment(0.0, 0.5), this.iconColor, this.textStyle, @@ -1020,8 +970,7 @@ class FlashToastTheme extends ThemeExtension { backgroundColor: Color.lerp(backgroundColor, other?.backgroundColor, t), elevation: lerpDouble(elevation, other?.elevation, t)!, shadowColor: Color.lerp(shadowColor, other?.shadowColor, t), - surfaceTintColor: - Color.lerp(surfaceTintColor, other?.surfaceTintColor, t), + surfaceTintColor: Color.lerp(surfaceTintColor, other?.surfaceTintColor, t), shape: ShapeBorder.lerp(shape, other?.shape, t), alignment: AlignmentGeometry.lerp(alignment, other?.alignment, t)!, iconColor: Color.lerp(iconColor, other?.iconColor, t), @@ -1109,14 +1058,12 @@ class FlashBarTheme extends ThemeExtension { backgroundColor: Color.lerp(backgroundColor, other?.backgroundColor, t), elevation: lerpDouble(elevation, other?.elevation, t)!, shadowColor: Color.lerp(shadowColor, other?.shadowColor, t), - surfaceTintColor: - Color.lerp(surfaceTintColor, other?.surfaceTintColor, t), + surfaceTintColor: Color.lerp(surfaceTintColor, other?.surfaceTintColor, t), shape: ShapeBorder.lerp(shape, other?.shape, t), padding: EdgeInsets.lerp(padding, other?.padding, t)!, iconColor: Color.lerp(iconColor, other?.iconColor, t), titleTextStyle: TextStyle.lerp(titleTextStyle, other?.titleTextStyle, t), - contentTextStyle: - TextStyle.lerp(contentTextStyle, other?.contentTextStyle, t), + contentTextStyle: TextStyle.lerp(contentTextStyle, other?.contentTextStyle, t), ); } } @@ -1149,4 +1096,4 @@ class _DefaultFlashBarTheme extends FlashBarTheme { @override TextStyle? get contentTextStyle => _textTheme.titleMedium; -} +} \ No newline at end of file