showLimeniaReportSheet function
Future<ReportResult?>
showLimeniaReportSheet(
- BuildContext context, {
- required Future<
ReportResult> onSubmit(- ReportDraft draft
- List<
ReportCategoryOption> ? categories, - GoodFaithConfirmation goodFaith = GoodFaithConfirmation.hidden,
- ReportEmergencyHint? emergencyHint = const ReportEmergencyHint(),
- String? title,
- LimeniaUiStrings? strings,
Shows the report form (LimeniaReportForm) in a modal bottom sheet.
The sheet calls onSubmit with what the user entered and shows its
result. It completes with the last result when it closes, or null if the
user closed it before a result arrived (the report goes on in onSubmit).
The other arguments are those of LimeniaReportForm.
final result = await showLimeniaReportSheet(
context,
onSubmit: (draft) => limenia.report(ReportRequest.content(...)),
);
Implementation
Future<ReportResult?> showLimeniaReportSheet(
BuildContext context, {
required Future<ReportResult> Function(ReportDraft draft) onSubmit,
List<ReportCategoryOption>? categories,
GoodFaithConfirmation goodFaith = GoodFaithConfirmation.hidden,
ReportEmergencyHint? emergencyHint = const ReportEmergencyHint(),
String? title,
LimeniaUiStrings? strings,
}) async {
ReportResult? last;
await showLimeniaSheet(
context,
(sheetContext) => LimeniaReportForm(
onSubmit: onSubmit,
categories: categories,
goodFaith: goodFaith,
emergencyHint: emergencyHint,
title: title,
strings: strings,
onResult: (result) => last = result,
onClose: () => Navigator.of(sheetContext).pop(),
),
);
return last;
}