execute method

  1. @override
FutureOr<void> execute(
  1. BuildContext context, {
  2. Map<String, dynamic>? arguments,
})
override

Implementation

@override
FutureOr<void> execute(BuildContext context,
    {Map<String, dynamic>? arguments}) {
  final theme = Theme.of(context);

  switch (behavior) {
    case DialogBehavior.modalBottomSheet:
      return showModalBottomSheet(
        context: context,
        enableDrag: true,
        clipBehavior: Clip.antiAlias,
        isDismissible: true,
        showDragHandle: true,
        useSafeArea: true,
        builder: (context) => _dialogContent(context),
      );

    case DialogBehavior.fullscreen:
      return showDialog(
        context: context,
        barrierDismissible: true,
        useSafeArea: false,
        builder: (context) => Dialog.fullscreen(
          backgroundColor: theme.colorScheme.surface,
          child: SafeArea(
            child: Column(children: [
              Align(
                  alignment: Alignment.topRight,
                  child: IconButton.filled(
                      onPressed: () => context.pop(),
                      icon: const Icon(Icons.close))),
              Expanded(child: _dialogContent(context)),
            ]),
          ),
        ),
      );
  }
}