anchored_sheets library

Classes

ActiveSheetTracker
Simple static tracking for duplicate prevention
AnchoredSheet
Simplified TopModalSheet using mixins and reusable components
AnchoredSheetPop
AnchoredSheetPop utility class for context-based dismissal
AnchoredSheetRouteObserver
Global RouteObserver instance for anchored sheets This observer will track route changes and dismiss anchored sheets when needed
AnchoredSheetState<T extends StatefulWidget>
Abstract base class for anchored sheets with automatic lifecycle management
AppLogger
Main logger class for the anchored_sheets package
ComponentLogger
Component-specific logger that automatically adds tags
DraggableDismissible
A draggable widget that can be dismissed through pan gestures
DragHandle
Reusable drag handle widget for modal sheets
ModalController<T>
Modal controller with proper lifecycle management and error handling
ModalDismissProvider
Internal provider for modal dismissal events
ModalGestureDetector
A specialized gesture detector for modal dragging
ModalManager
A modal coordination widget that manages modal state across the widget tree

Enums

LogLevel
Log levels for different types of messages

Extensions

AnchoredSheetContext on BuildContext
Enhanced extension methods for BuildContext to provide convenient anchored sheet operations with improved error handling

Functions

anchoredSheet<T>({required BuildContext context, required WidgetBuilder builder, Color? backgroundColor, Color? shadowColor, double? elevation, ShapeBorder? shape, Clip? clipBehavior, BoxConstraints? constraints, BorderRadius? borderRadius, Color overlayColor = Colors.black54, Duration animationDuration = const Duration(milliseconds: 300), bool isDismissible = true, bool isScrollControlled = false, bool enableDrag = false, bool? showDragHandle, Color? dragHandleColor, Size? dragHandleSize, GlobalKey<State<StatefulWidget>>? anchorKey, double? topOffset, bool useSafeArea = false, bool enableNested = false}) Future<T?>
Shows an anchored modal sheet that slides down from the top of the screen.
anchoredSheetInternal<T>({required BuildContext context, required WidgetBuilder builder, Color? backgroundColor, Color? shadowColor, double? elevation, ShapeBorder? shape, Clip? clipBehavior, BoxConstraints? constraints, BorderRadius? borderRadius, Color overlayColor = Colors.black54, Duration animationDuration = const Duration(milliseconds: 300), bool isDismissible = true, bool isScrollControlled = false, bool enableDrag = false, bool? showDragHandle, Color? dragHandleColor, Size? dragHandleSize, GlobalKey<State<StatefulWidget>>? anchorKey, double? topOffset, bool useSafeArea = false, bool enableNested = false}) Future<T?>
Internal implementation of anchoredSheet with nested logic
buildClickThroughArea(double topOffset) Widget
Builds a click-through area above the modal
buildDismissibleOverlay({required double topOffset, required Animation<double> fadeAnimation, required VoidCallback onTap, Color overlayColor = Colors.black54}) Widget
Builds a dismissible overlay behind the modal
buildModalContent({required Widget child, required GlobalKey<State<StatefulWidget>> childKey, BottomSheetThemeData? theme, Color? backgroundColor, Color? shadowColor, double? elevation, ShapeBorder? shape, BorderRadius? borderRadius, Clip? clipBehavior, BoxConstraints? constraints, bool useSafeArea = false, bool showDragHandle = false, bool isScrollControlled = false, bool hasAnchorKey = false, VoidCallback? onDragHandleTap, ValueChanged<bool>? onDragHandleHover, Set<WidgetState>? dragHandleStates, Color? dragHandleColor, Size? dragHandleSize}) Widget
Builds a positioned modal content with Material theming
buildPositionedModal({required double topOffset, required double height, required Widget child, required Animation<double> slideAnimation, required Animation<double> fadeAnimation, void onDismiss(dynamic)?, Color? backgroundColor, ShapeBorder? shape, bool hasAnchorKey = false, bool isScrollControlled = false}) Widget
Builds the main positioned modal with animations and status bar handling
calculateModalHeight({required double availableHeight, bool isScrollControlled = false, bool hasAnchorKey = false}) double
Calculates modal height based on scroll control settings
calculateTopOffset({GlobalKey<State<StatefulWidget>>? anchorKey, double? topOffset, BuildContext? context, bool respectStatusBar = true}) double
Calculates the appropriate top offset for anchored modals
dismissAnchoredSheet<T extends Object?>([T? result]) Future<void>
Dismisses the currently active TopModalSheet without requiring a BuildContext.