diff --git a/lib/cool_alert.dart b/lib/cool_alert.dart index a4c6589..126f669 100644 --- a/lib/cool_alert.dart +++ b/lib/cool_alert.dart @@ -107,6 +107,9 @@ class CoolAlert { /// Reverse the order of the buttons bool reverseBtnOrder = false, + + /// Action button radius + double buttonCornerRadius = 10.0, }) { if (autoCloseDuration != null) { Future.delayed(autoCloseDuration, () { @@ -115,33 +118,33 @@ class CoolAlert { } final options = CoolAlertOptions( - title: title, - text: text, - widget: widget, - type: type, - animType: animType, - barrierDismissible: barrierDismissible, - onConfirmBtnTap: onConfirmBtnTap, - onCancelBtnTap: onCancelBtnTap, - confirmBtnText: confirmBtnText, - cancelBtnText: cancelBtnText, - confirmBtnColor: confirmBtnColor, - confirmBtnTextStyle: confirmBtnTextStyle, - cancelBtnTextStyle: cancelBtnTextStyle, - titleTextStyle: titleTextStyle, - textTextStyle: textTextStyle, - showCancelBtn: showCancelBtn, - borderRadius: borderRadius, - backgroundColor: backgroundColor, - flareAsset: flareAsset, - flareAnimationName: flareAnimationName, - lottieAsset: lottieAsset, - width: width, - loopAnimation: loopAnimation, - closeOnConfirmBtnTap: closeOnConfirmBtnTap, - autoCloseDuration: autoCloseDuration, - reverseBtnOrder: reverseBtnOrder, - ); + title: title, + text: text, + widget: widget, + type: type, + animType: animType, + barrierDismissible: barrierDismissible, + onConfirmBtnTap: onConfirmBtnTap, + onCancelBtnTap: onCancelBtnTap, + confirmBtnText: confirmBtnText, + cancelBtnText: cancelBtnText, + confirmBtnColor: confirmBtnColor, + confirmBtnTextStyle: confirmBtnTextStyle, + cancelBtnTextStyle: cancelBtnTextStyle, + titleTextStyle: titleTextStyle, + textTextStyle: textTextStyle, + showCancelBtn: showCancelBtn, + borderRadius: borderRadius, + backgroundColor: backgroundColor, + flareAsset: flareAsset, + flareAnimationName: flareAnimationName, + lottieAsset: lottieAsset, + width: width, + loopAnimation: loopAnimation, + closeOnConfirmBtnTap: closeOnConfirmBtnTap, + autoCloseDuration: autoCloseDuration, + reverseBtnOrder: reverseBtnOrder, + buttonCornerRadius: buttonCornerRadius); final child = AlertDialog( contentPadding: EdgeInsets.zero, diff --git a/lib/src/models/cool_alert_options.dart b/lib/src/models/cool_alert_options.dart index 94a82a3..01c72f8 100644 --- a/lib/src/models/cool_alert_options.dart +++ b/lib/src/models/cool_alert_options.dart @@ -28,33 +28,34 @@ class CoolAlertOptions { bool closeOnConfirmBtnTap; Duration? autoCloseDuration; bool reverseBtnOrder = false; + double? buttonCornerRadius; - CoolAlertOptions({ - this.title, - this.text, - this.widget, - required this.type, - this.animType, - this.barrierDismissible, - this.onConfirmBtnTap, - this.onCancelBtnTap, - this.confirmBtnText, - this.cancelBtnText, - this.confirmBtnColor, - this.confirmBtnTextStyle, - this.cancelBtnTextStyle, - this.titleTextStyle, - this.textTextStyle, - this.showCancelBtn, - this.borderRadius, - this.backgroundColor, - this.flareAsset, - this.flareAnimationName, - this.lottieAsset, - this.width, - this.loopAnimation = false, - this.closeOnConfirmBtnTap = true, - this.autoCloseDuration, - this.reverseBtnOrder = false, - }); + CoolAlertOptions( + {this.title, + this.text, + this.widget, + required this.type, + this.animType, + this.barrierDismissible, + this.onConfirmBtnTap, + this.onCancelBtnTap, + this.confirmBtnText, + this.cancelBtnText, + this.confirmBtnColor, + this.confirmBtnTextStyle, + this.cancelBtnTextStyle, + this.titleTextStyle, + this.textTextStyle, + this.showCancelBtn, + this.borderRadius, + this.backgroundColor, + this.flareAsset, + this.flareAnimationName, + this.lottieAsset, + this.width, + this.loopAnimation = false, + this.closeOnConfirmBtnTap = true, + this.autoCloseDuration, + this.reverseBtnOrder = false, + this.buttonCornerRadius = 30}); } diff --git a/lib/src/widgets/cool_alert_buttons.dart b/lib/src/widgets/cool_alert_buttons.dart index 75a16bd..f7b9afb 100644 --- a/lib/src/widgets/cool_alert_buttons.dart +++ b/lib/src/widgets/cool_alert_buttons.dart @@ -91,7 +91,7 @@ class CoolAlertButtons extends StatelessWidget { final okayBtn = MaterialButton( shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30.0), + borderRadius: BorderRadius.circular(options.buttonCornerRadius!), ), elevation: 0, color: options.confirmBtnColor ?? Theme.of(context!).primaryColor, diff --git a/lib/src/widgets/cool_alert_container.dart b/lib/src/widgets/cool_alert_container.dart index 8fec78c..82d20aa 100644 --- a/lib/src/widgets/cool_alert_container.dart +++ b/lib/src/widgets/cool_alert_container.dart @@ -131,6 +131,7 @@ class CoolAlertContainer extends StatelessWidget { visible: title != null, child: Text( '$title', + textAlign: TextAlign.center, style: options.titleTextStyle ?? Theme.of(context).textTheme.titleLarge?.copyWith( fontWeight: FontWeight.bold,