call method

Future call(
  1. BuildContext context, {
  2. String? title,
  3. required List<Widget> children,
  4. bool dismissible = true,
  5. VoidCallback? onClose,
  6. EdgeInsets? padding,
})

Implementation

Future<dynamic> call(
  BuildContext context, {
  String? title,
  required List<Widget> children,
  bool dismissible = true,
  VoidCallback? onClose,
  EdgeInsets? padding,
}) {
  return showDialog(
    context: context,
    barrierDismissible: dismissible,
    builder: (c) => PopScope(
      canPop: dismissible,
      child: Dialog(
        insetPadding: const EdgeInsets.symmetric(horizontal: 16),
        child: Padding(
          padding: padding ?? const EdgeInsets.all(24),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              if (title != null) ...{
                Row(
                  children: [
                    Expanded(
                      child: Text(
                        title,
                        style: Theme.of(context).textTheme.bodyLarge
                            ?.copyWith(
                              color: const Color(0xFF212124),
                              fontWeight: FontWeight.w500,
                            ),
                      ),
                    ),
                    SizedBox(width: 8),
                    if (onClose != null)
                      InkWell(
                        onTap: () => onClose.call(),
                        child: const Icon(
                          Icons.close,
                          size: 20,
                          color: Color(0xFF75767A),
                        ),
                      ),
                  ],
                ),
                const SizedBox(height: 8),
              },
              for (var child in children) child,
            ],
          ),
        ),
      ),
    ),
  );
}