show<T> method

  1. @override
Future<T?> show<T>({
  1. required String title,
  2. required Widget content,
  3. bool dismissible = true,
  4. bool showCloseButton = true,
  5. T close()?,
  6. List<Widget>? actions,
  7. 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,
  );
}