From bd40b567de9d742e905279dd46631ce30a58c142 Mon Sep 17 00:00:00 2001 From: Daniyil Yakovlev Date: Fri, 23 Oct 2020 15:05:14 +0300 Subject: [PATCH] Border radius fix --- lib/src/badge.dart | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/lib/src/badge.dart b/lib/src/badge.dart index b468440..04b3220 100644 --- a/lib/src/badge.dart +++ b/lib/src/badge.dart @@ -20,23 +20,23 @@ class Badge extends StatefulWidget { final bool showBadge; final bool ignorePointer; - Badge({ - Key key, - this.badgeContent, - this.child, - this.badgeColor = Colors.red, - this.elevation = 2, - this.toAnimate = true, - this.position, - this.shape = BadgeShape.circle, - this.padding = const EdgeInsets.all(5.0), - this.animationDuration = const Duration(milliseconds: 500), - this.borderRadius, - this.alignment = Alignment.center, - this.animationType = BadgeAnimationType.slide, - this.showBadge = true, - this.ignorePointer = false - }) : super(key: key); + Badge( + {Key key, + this.badgeContent, + this.child, + this.badgeColor = Colors.red, + this.elevation = 2, + this.toAnimate = true, + this.position, + this.shape = BadgeShape.circle, + this.padding = const EdgeInsets.all(5.0), + this.animationDuration = const Duration(milliseconds: 500), + this.borderRadius, + this.alignment = Alignment.center, + this.animationType = BadgeAnimationType.slide, + this.showBadge = true, + this.ignorePointer = false}) + : super(key: key); @override BadgeState createState() { @@ -87,7 +87,9 @@ class BadgeState extends State with SingleTickerProviderStateMixin { widget.child, BadgePositioned( position: widget.position, - child: widget.ignorePointer ? IgnorePointer(child: _getBadge()) : _getBadge(), + child: widget.ignorePointer + ? IgnorePointer(child: _getBadge()) + : _getBadge(), ), ], ); @@ -104,11 +106,10 @@ class BadgeState extends State with SingleTickerProviderStateMixin { print('Unknown material type for badge. Used Card'); type = MaterialType.card; } - RoundedRectangleBorder border = type == MaterialType.circle + final border = type == MaterialType.circle ? null - : RoundedRectangleBorder( - borderRadius: BorderRadius.circular(widget.borderRadius ?? 0), - ); + : RoundedRectangleBorder(borderRadius: widget.borderRadius); + Widget badgeView() { return AnimatedOpacity( child: Material(