show<T> static method

Future<T?> show<T>({
  1. required BuildContext context,
  2. required WidgetBuilder builder,
  3. LiquidGlassSettings? settings,
  4. GlassQuality? quality,
  5. bool showDragIndicator = true,
  6. Color? dragIndicatorColor,
  7. EdgeInsetsGeometry? padding,
  8. double topBorderRadius = 32.0,
  9. double? bottomBorderRadius,
  10. EdgeInsets margin = const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
  11. bool isScrollable = true,
  12. double interactionScale = 1.01,
  13. double stretch = 0.5,
  14. double resistance = 0.08,
  15. Axis stretchAxis = Axis.vertical,
  16. bool allowPositiveStretch = false,
  17. bool allowNegativeStretch = true,
  18. bool enableInteractionGlow = true,
  19. Color? glowColor,
  20. double glowRadius = 1.5,
  21. bool suppressInteractionOnChildren = false,
  22. bool isDismissible = true,
  23. bool enableDrag = true,
  24. Color? barrierColor,
  25. bool useRootNavigator = false,
  26. bool useSafeArea = true,
  27. bool enableSaturationGlow = true,
})

Shows a glass bottom sheet.

Returns a Future that resolves to the value (if any) passed to Navigator.pop when the sheet is dismissed.

Parameters:

  • context: Build context for showing the sheet
  • builder: Builder function that creates the sheet content
  • settings: Glass effect settings (null uses defaults)
  • quality: Rendering quality (defaults to standard)
  • showDragIndicator: Whether to show the drag indicator (default: true)
  • dragIndicatorColor: Color of the drag indicator
  • padding: Padding around the content
  • topBorderRadius: Corner radius of the sheet (default: 54)
  • margin: External margin for the "floating" look (default: 8x8)
  • isScrollable: Whether the content should be scrollable (default: true)
  • interactionScale: Visual scale feedback on touch (default: 1.01)
  • stretch: Liquid stretch intensity (default: 0.5)
  • resistance: Drag resistance factor (default: 0.08)
  • stretchAxis: Axis for the liquid effect (default: vertical)
  • allowPositiveStretch: Enable stretch in positive direction (default: false)
  • allowNegativeStretch: Enable stretch in negative direction (default: true)
  • enableInteractionGlow: Whether to show tactile glare on touch (default: true)
  • glowColor: Color of the interaction glow
  • glowRadius: Radius of the interaction glow
  • enableSaturationGlow: Whether to pulse saturation/lighting on touch (default: true)
  • suppressInteractionOnChildren: Enable "Smart Silence" for child interactions
  • isDismissible: Whether tapping outside dismisses the sheet (default: true)
  • enableDrag: Whether the sheet can be dragged down to dismiss (default: true)
  • barrierColor: Color of the modal barrier (defaults to black54)
  • useRootNavigator: Whether to show the sheet in the root navigator (default: false)
  • useSafeArea: Whether to wrap the content in a safe area (default: true)

Example:

final result = await GlassSheet.show<String>(
  context: context,
  builder: (context) => /* content */,
);

Implementation

static Future<T?> show<T>({
  required BuildContext context,
  required WidgetBuilder builder,
  LiquidGlassSettings? settings,
  GlassQuality? quality,
  bool showDragIndicator = true,
  Color? dragIndicatorColor,
  EdgeInsetsGeometry? padding,
  double topBorderRadius = 32.0,
  double? bottomBorderRadius,
  EdgeInsets margin = const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
  bool isScrollable = true,
  double interactionScale = 1.01,
  double stretch = 0.5,
  double resistance = 0.08,
  Axis stretchAxis = Axis.vertical,
  bool allowPositiveStretch = false,
  bool allowNegativeStretch = true,
  bool enableInteractionGlow = true,
  Color? glowColor,
  double glowRadius = 1.5,
  bool suppressInteractionOnChildren = false,
  bool isDismissible = true,
  bool enableDrag = true,
  Color? barrierColor,
  bool useRootNavigator = false,
  bool useSafeArea = true,
  bool enableSaturationGlow = true,
}) {
  return showGeneralDialog<T>(
    context: context,
    barrierDismissible: isDismissible,
    barrierLabel: 'Dismiss',
    barrierColor: barrierColor ?? GlassDefaults.barrierColor,
    useRootNavigator: useRootNavigator,
    transitionDuration: const Duration(milliseconds: 350),
    transitionBuilder: (context, animation, secondaryAnimation, child) {
      return SlideTransition(
        position: Tween<Offset>(
          begin: const Offset(0, 1),
          end: Offset.zero,
        ).animate(CurvedAnimation(
          parent: animation,
          curve: Curves.easeOutCubic,
          reverseCurve: Curves.easeInCubic,
        )),
        child: child,
      );
    },
    pageBuilder: (context, animation, secondaryAnimation) {
      return SafeArea(
        bottom: useSafeArea,
        top: false,
        left: false,
        right: false,
        child: Align(
          alignment: Alignment.bottomCenter,
          child: _DismissibleSheetWrapper(
            enableDrag: enableDrag,
            child: GlassSheet(
              settings: settings,
              quality: quality,
              showDragIndicator: showDragIndicator,
              dragIndicatorColor: dragIndicatorColor,
              padding: padding,
              topBorderRadius: topBorderRadius,
              bottomBorderRadius: bottomBorderRadius,
              margin: margin,
              isScrollable: isScrollable,
              interactionScale: interactionScale,
              stretch: stretch,
              resistance: resistance,
              stretchAxis: stretchAxis,
              allowPositiveStretch: allowPositiveStretch,
              allowNegativeStretch: allowNegativeStretch,
              enableInteractionGlow: enableInteractionGlow,
              glowColor: glowColor,
              glowRadius: glowRadius,
              enableSaturationGlow: enableSaturationGlow,
              suppressInteractionOnChildren: suppressInteractionOnChildren,
              child: builder(context),
            ),
          ),
        ),
      );
    },
  );
}