From 4f35db1b1740ee16503c0b3866f80d6c61bc4120 Mon Sep 17 00:00:00 2001 From: Guy Luz Date: Mon, 30 Dec 2024 17:22:10 +0200 Subject: [PATCH 1/2] Added change border color --- example/lib/main.dart | 1 + lib/rounded_loading_button.dart | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 8198001..3074da8 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -74,6 +74,7 @@ class _MyHomePageState extends State { onPressed: () => _doSomething(_btnController2), valueColor: Colors.black, borderRadius: 10, + borderSide : BorderSide(color: Colors.red) child: Text(''' Tap me i have a huge text''', style: TextStyle(color: Colors.white)), ), diff --git a/lib/rounded_loading_button.dart b/lib/rounded_loading_button.dart index fcb56ab..f8bd783 100644 --- a/lib/rounded_loading_button.dart +++ b/lib/rounded_loading_button.dart @@ -52,6 +52,9 @@ class RoundedLoadingButton extends StatefulWidget { /// The radius of the button border final double borderRadius; + /// The side of the button border + final BorderSide borderSide; + /// The duration of the button animation final Duration duration; @@ -100,6 +103,7 @@ class RoundedLoadingButton extends StatefulWidget { this.animateOnTap = true, this.valueColor = Colors.white, this.borderRadius = 35, + this.borderSide = BorderSide.none, this.elevation = 2, this.duration = const Duration(milliseconds: 500), this.curve = Curves.easeInOutCirc, @@ -128,7 +132,6 @@ class RoundedLoadingButtonState extends State late Animation _squeezeAnimation; late Animation _bounceAnimation; late Animation _borderAnimation; - final _state = BehaviorSubject.seeded(ButtonState.idle); @override @@ -189,7 +192,8 @@ class RoundedLoadingButtonState extends State ); final _btn = ButtonTheme( - shape: RoundedRectangleBorder(borderRadius: _borderAnimation.value), + shape: RoundedRectangleBorder( + borderRadius: _borderAnimation.value, side: widget.borderSide), disabledColor: widget.disabledColor, padding: const EdgeInsets.all(0), child: ElevatedButton( From 96bad3008d376c9266427c5b70667d156ac18899 Mon Sep 17 00:00:00 2001 From: Guy Luz Date: Mon, 30 Dec 2024 17:56:57 +0200 Subject: [PATCH 2/2] Fix border color not effecting --- lib/rounded_loading_button.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rounded_loading_button.dart b/lib/rounded_loading_button.dart index f8bd783..133a5d8 100644 --- a/lib/rounded_loading_button.dart +++ b/lib/rounded_loading_button.dart @@ -192,14 +192,14 @@ class RoundedLoadingButtonState extends State ); final _btn = ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: _borderAnimation.value, side: widget.borderSide), + shape: RoundedRectangleBorder(borderRadius: _borderAnimation.value), disabledColor: widget.disabledColor, padding: const EdgeInsets.all(0), child: ElevatedButton( style: ElevatedButton.styleFrom( surfaceTintColor: widget.disabledColor, minimumSize: Size(_squeezeAnimation.value, widget.height), + side: widget.borderSide, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(widget.borderRadius), ),