Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 30 additions & 27 deletions lib/cool_alert.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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, () {
Expand All @@ -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,
Expand Down
57 changes: 29 additions & 28 deletions lib/src/models/cool_alert_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
2 changes: 1 addition & 1 deletion lib/src/widgets/cool_alert_buttons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions lib/src/widgets/cool_alert_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down