showProviderAwareBottomSheet<T> method

Future<T?> showProviderAwareBottomSheet<T>({
  1. required Widget builder(
    1. BuildContext
    ),
  2. bool isScrollControlled = true,
  3. bool showDragHandle = true,
  4. bool isDismissible = true,
  5. bool enableDrag = true,
  6. Color? backgroundColor,
  7. double? elevation,
  8. ShapeBorder? shape,
  9. Clip? clipBehavior,
  10. BoxConstraints? constraints,
  11. Color? barrierColor,
  12. bool useRootNavigator = false,
  13. RouteSettings? routeSettings,
})

Shows a modal bottom sheet that maintains access to Riverpod providers.

This automatically wraps the builder content in an UncontrolledProviderScope so that widgets inside the modal can access providers from the parent context.

Implementation

Future<T?> showProviderAwareBottomSheet<T>({
  required Widget Function(BuildContext) builder,
  bool isScrollControlled = true,
  bool showDragHandle = true,
  bool isDismissible = true,
  bool enableDrag = true,
  Color? backgroundColor,
  double? elevation,
  ShapeBorder? shape,
  Clip? clipBehavior,
  BoxConstraints? constraints,
  Color? barrierColor,
  bool useRootNavigator = false,
  RouteSettings? routeSettings,
}) {
  return showModalBottomSheet<T>(
    context: this,
    isScrollControlled: isScrollControlled,
    showDragHandle: showDragHandle,
    isDismissible: isDismissible,
    enableDrag: enableDrag,
    backgroundColor: backgroundColor,
    elevation: elevation,
    shape: shape,
    clipBehavior: clipBehavior,
    constraints: constraints,
    barrierColor: barrierColor,
    useRootNavigator: useRootNavigator,
    routeSettings: routeSettings,
    builder: (modalContext) {
      return UncontrolledProviderScope(
        container: ProviderScope.containerOf(this),
        child: builder(modalContext),
      );
    },
  );
}