968e3e908a
Keep the reviewed attention surfaces on their Material implementations while preserving public cupertino parameters for remaining callers. Remove the unreachable Cupertino sheet and narrow tests to the Material path.
42 lines
1.5 KiB
Dart
42 lines
1.5 KiB
Dart
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<void> showNeedsYouSheet({
|
|
required BuildContext context,
|
|
required ValueListenable<List<AttentionEntry>> entries,
|
|
required ValueChanged<AttentionEntry> onOpen,
|
|
required ValueChanged<AttentionEntry> onDismiss,
|
|
required ValueChanged<List<AttentionEntry>> onClearAll,
|
|
bool? cupertino,
|
|
}) {
|
|
final snapshot = attentionDismissalSnapshot(entries.value);
|
|
return showModalBottomSheet<void>(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
useSafeArea: true,
|
|
showDragHandle: true,
|
|
builder: (_) => MaterialNeedsYouSheet(
|
|
entries: entries,
|
|
snapshot: snapshot,
|
|
onOpen: onOpen,
|
|
onDismiss: onDismiss,
|
|
onClearAll: onClearAll,
|
|
),
|
|
);
|
|
}
|