showWithCustomHeaderUiKitView static method

Future<void> showWithCustomHeaderUiKitView({
  1. required dynamic context,
  2. required String title,
  3. required Widget builder(
    1. BuildContext
    ),
  4. List<CNSheetDetent> detents = const [CNSheetDetent.large],
  5. bool prefersGrabberVisible = true,
  6. bool isModal = false,
  7. bool prefersEdgeAttachedInCompactHeight = false,
  8. bool widthFollowsPreferredContentSizeWhenEdgeAttached = false,
  9. double? preferredCornerRadius,
  10. double? headerTitleSize,
  11. dynamic headerTitleWeight,
  12. dynamic headerTitleColor,
  13. double? headerHeight,
  14. dynamic headerBackgroundColor,
  15. bool showHeaderDivider = true,
  16. dynamic headerDividerColor,
  17. String closeButtonPosition = 'trailing',
  18. String closeButtonIcon = 'xmark',
  19. double? closeButtonSize,
  20. dynamic closeButtonColor,
})

Shows a native sheet with custom Flutter widget content using UiKitView (delegates to CNNativeSheet)

This is the ULTIMATE solution combining:

  • Native UISheetPresentationController (real iOS sheet)
  • Custom Flutter widgets via UiKitView
  • Non-modal behavior (interact with background)

Implementation

static Future<void> showWithCustomHeaderUiKitView({
  required context,
  required String title,
  required Widget Function(BuildContext) builder,
  List<CNSheetDetent> detents = const [CNSheetDetent.large],
  bool prefersGrabberVisible = true,
  bool isModal = false,
  bool prefersEdgeAttachedInCompactHeight = false,
  bool widthFollowsPreferredContentSizeWhenEdgeAttached = false,
  double? preferredCornerRadius,
  double? headerTitleSize,
  headerTitleWeight,
  headerTitleColor,
  double? headerHeight,
  headerBackgroundColor,
  bool showHeaderDivider = true,
  headerDividerColor,
  String closeButtonPosition = 'trailing',
  String closeButtonIcon = 'xmark',
  double? closeButtonSize,
  closeButtonColor,
}) {
  return CNNativeSheet.showWithCustomHeaderUiKitView(
    context: context,
    title: title,
    builder: builder,
    detents: detents,
    prefersGrabberVisible: prefersGrabberVisible,
    isModal: isModal,
    prefersEdgeAttachedInCompactHeight: prefersEdgeAttachedInCompactHeight,
    widthFollowsPreferredContentSizeWhenEdgeAttached:
        widthFollowsPreferredContentSizeWhenEdgeAttached,
    preferredCornerRadius: preferredCornerRadius,
    headerTitleSize: headerTitleSize,
    headerTitleWeight: headerTitleWeight,
    headerTitleColor: headerTitleColor,
    headerHeight: headerHeight,
    headerBackgroundColor: headerBackgroundColor,
    showHeaderDivider: showHeaderDivider,
    headerDividerColor: headerDividerColor,
    closeButtonPosition: closeButtonPosition,
    closeButtonIcon: closeButtonIcon,
    closeButtonSize: closeButtonSize,
    closeButtonColor: closeButtonColor,
  );
}