showSuccessOverlay static method
void
showSuccessOverlay({})
Implementation
static void showSuccessOverlay({
Duration? duration,
String? successMessage,
IconData? icon,
Widget? successMessageWidget,
void Function()? onDismiss,
}) {
// log("showErrorOverlay");
if (WidgetsBinding.instance.isRootWidgetAttached) {
if (successMessage == null && successMessageWidget == null) {
_successOverlayController.refresh();
_successOverlayController.state = _showCustomOverlay(
(context, opacity) {
return SButton(
borderRadius: BorderRadius.circular(30),
child: Container(
decoration: BoxDecoration(
color: Colors.green.shade900.withValues(alpha: 0.2),
borderRadius: BorderRadius.circular(30),
),
).animate(
effects: [
FadeEffect(
duration: 0.12.sec,
curve: Curves.easeInOut,
)
],
),
);
},
duration: duration,
);
//execute onDismiss call
Future.delayed(duration ?? 0.20.sec, () => dismissErrorOverlay());
return;
}
//otherwise, show a PopThis,
//the Timer delay is only to allow
//any previous PopThis to first dismiss
//then to show this one
Timer(.2.sec, () {
PopThis.animatedDismissPopThis();
PopThis.pop(
shouldSaveThisPop: false,
onDismiss: onDismiss,
duration: duration ?? 4.sec,
popShadow: BoxShadow(
offset: Offset(0, 5),
blurRadius: 15,
spreadRadius: -10,
),
popBackgroundColor: Colors.white.withValues(alpha: 0.9),
dismissBarrierColor:
Colors.green.shade900.darken(0.1).withValues(alpha: 0.8),
child: SingleChildScrollView(
child: Column(
children: [
Icon(
icon ?? Iconsax.tick_circle_bold,
color: Colors.green,
size: 100,
),
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: successMessageWidget ??
Text(
successMessage ?? '',
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.w400,
),
),
),
],
),
),
);
});
return;
}
//if GetMaterial is not initialised yet
onDismiss?.call();
}