import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import '../domain/attention_models.dart'; import 'needs_you_sheet_material.dart'; /// Opens the native `Needs you` sheet over the live [entries]. /// /// [entries] is the caller's current list: the sheet redraws when it changes, so /// dismissing a row updates the open sheet in place, as the browser does. The /// dismissal snapshot is captured here, when the route opens; Clear all acts /// only on it, so an entry that arrives while the sheet is open is shown but is /// never silently cleared. /// /// The sheet stays open after Dismiss and Clear all, so several rows can be /// dealt with in one visit. Choosing a row closes it; Escape, the barrier and /// system back are native route behaviour. The sheet is always the Material /// bottom sheet; [cupertino] is retained for callers that still pass it. Future showNeedsYouSheet({ required BuildContext context, required ValueListenable> entries, required ValueChanged onOpen, required ValueChanged onDismiss, required ValueChanged> onClearAll, bool? cupertino, }) { final snapshot = attentionDismissalSnapshot(entries.value); return showModalBottomSheet( context: context, isScrollControlled: true, useSafeArea: true, showDragHandle: true, builder: (_) => MaterialNeedsYouSheet( entries: entries, snapshot: snapshot, onOpen: onOpen, onDismiss: onDismiss, onClearAll: onClearAll, ), ); }