showEJDialog<T> function Null safety

Future<EJSelectorItem<T>?> showEJDialog<T>(
  1. {required BuildContext context,
  2. required List<EJSelectorItem<T>> items,
  3. T? selected,
  4. bool alwaysShownScrollbar = true,
  5. Widget selectedWidgetBuilder(
    1. T valueOfSelected
    )?,
  6. Widget? divider,
  7. double? dialogHeight,
  8. double dialogWidth = 80,
  9. bool barrierDismissible = true,
  10. Color barrierColor = Colors.black54,
  11. String? barrierLabel,
  12. bool useSafeArea = true,
  13. bool useRootNavigator = true,
  14. RouteSettings? routeSettings}
)

Implementation

Future<EJSelectorItem<T>?> showEJDialog<T>({
  required BuildContext context,
  required List<EJSelectorItem<T>> items,
  T? selected,
  bool alwaysShownScrollbar = true,
  Widget Function(T valueOfSelected)? selectedWidgetBuilder,
  Widget? divider,
  double? dialogHeight,
  double dialogWidth = 80,
  bool barrierDismissible = true,
  Color barrierColor = Colors.black54,
  String? barrierLabel,
  bool useSafeArea = true,
  bool useRootNavigator = true,
  RouteSettings? routeSettings,
}) async {
  return showDialog<EJSelectorItem<T>>(
    context: context,
    barrierDismissible: barrierDismissible,
    useRootNavigator: useRootNavigator,
    routeSettings: routeSettings,
    useSafeArea: useSafeArea,
    barrierColor: barrierColor,
    barrierLabel: barrierLabel,
    builder: (context) => _Dialog<T>(
      selected: selected,
      alwaysShownScrollbar: alwaysShownScrollbar,
      selectedWidgetBuilder: (child, value) {
        if (selectedWidgetBuilder != null) {
          return selectedWidgetBuilder(value!);
        } else {
          return child;
        }
      },
      divider: divider,
      dialogHeight: dialogHeight,
      dialogWidth: dialogWidth,
      items: items,
    ),
  );
}