Add floating quick-add button to person insights
This commit is contained in:
@@ -712,9 +712,20 @@ class _PersonInsightsPage extends ConsumerWidget {
|
||||
final AsyncValue<SignalsFeed> signals = ref.watch(
|
||||
signalsControllerProvider,
|
||||
);
|
||||
final LocalDataState? localValue = localData.asData?.value;
|
||||
final PersonProfile? quickAddPerson = localValue == null
|
||||
? null
|
||||
: _findPersonById(localValue.people, personId);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Person Insights')),
|
||||
floatingActionButton: quickAddPerson == null
|
||||
? null
|
||||
: FloatingActionButton(
|
||||
tooltip: 'Add to person',
|
||||
onPressed: () => _openQuickAddSheet(context, ref, quickAddPerson),
|
||||
child: const Icon(Icons.add_rounded),
|
||||
),
|
||||
body: localData.when(
|
||||
data: (LocalDataState data) {
|
||||
final PersonProfile? person = _findPersonById(data.people, personId);
|
||||
@@ -1143,6 +1154,59 @@ class _PersonInsightsPage extends ConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _openQuickAddSheet(
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
PersonProfile person,
|
||||
) async {
|
||||
final _InsightQuickAction? selected =
|
||||
await showModalBottomSheet<_InsightQuickAction>(
|
||||
context: context,
|
||||
showDragHandle: true,
|
||||
builder: (BuildContext context) {
|
||||
return SafeArea(
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
leading: const Icon(Icons.auto_awesome_rounded),
|
||||
title: const Text('Add Capture'),
|
||||
subtitle: const Text('Log a new moment or interaction'),
|
||||
onTap: () =>
|
||||
Navigator.of(context).pop(_InsightQuickAction.capture),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.note_add_outlined),
|
||||
title: const Text('Add Note'),
|
||||
subtitle: const Text('Save a context note for later'),
|
||||
onTap: () =>
|
||||
Navigator.of(context).pop(_InsightQuickAction.note),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.lightbulb_outline_rounded),
|
||||
title: const Text('Add Idea'),
|
||||
subtitle: const Text('Gift or event idea'),
|
||||
onTap: () =>
|
||||
Navigator.of(context).pop(_InsightQuickAction.idea),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.notifications_active_outlined),
|
||||
title: const Text('Add Reminder'),
|
||||
subtitle: const Text('Schedule a follow-up prompt'),
|
||||
onTap: () =>
|
||||
Navigator.of(context).pop(_InsightQuickAction.reminder),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
if (selected == null || !context.mounted) {
|
||||
return;
|
||||
}
|
||||
await _handleQuickAction(context, ref, person, selected);
|
||||
}
|
||||
|
||||
Future<String?> _showQuickTextCaptureDialog(
|
||||
BuildContext context, {
|
||||
required String title,
|
||||
|
||||
Reference in New Issue
Block a user