show<T> method
Future<T?>
show<T>({
- required String title,
- required Widget content,
- bool dismissible = true,
- bool showCloseButton = true,
- T close()?,
- List<
Widget> ? actions, - BoxConstraints? constraints,
override
Implementation
@override
Future<T?> show<T>({
required String title,
required Widget content,
bool dismissible = true,
bool showCloseButton = true,
T Function()? close,
List<Widget>? actions,
BoxConstraints? constraints,
}) async {
return await showDialog<T>(
context: navigatorKey.currentState!.overlay!.context,
builder: (context) => ConstrainedBox(
constraints: constraints ?? const BoxConstraints(),
child: AlertDialog(
title: FadeInUp(
from: 5,
duration: const Duration(milliseconds: 200),
child: Row(
children: [
Text(
title,
style: GoogleFonts.roboto(
fontWeight: FontWeight.w600,
color: Colors.grey.shade800,
),
),
if (showCloseButton) ...{
const Spacer(),
IconButton(
icon: const Icon(Icons.close),
color: Colors.black,
tooltip: MaterialLocalizations.of(context).closeButtonTooltip,
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
onPressed: () {
Navigator.pop(navigatorKey.currentState!.overlay!.context);
},
splashRadius: 24,
),
},
],
),
),
content: FadeInUp(
from: 5,
duration: const Duration(milliseconds: 200),
child: content,
),
actions: actions
?.map(
(action) => FadeInUp(
from: 5,
duration: const Duration(milliseconds: 200),
child: action,
),
)
.toList(),
),
),
barrierDismissible: dismissible,
);
}