feat: confirm a saved quotation with a short note
This commit is contained in:
parent
e6e84fdc01
commit
4d581caad5
11 changed files with 39 additions and 7 deletions
|
|
@ -338,12 +338,24 @@ class _ReaderScreenState extends State<ReaderScreen> {
|
|||
deps.browser.narrowWhileTyping(form.action, values),
|
||||
// The reader's marked text is kept with the page it came from, so
|
||||
// its citation can name the author when the page did.
|
||||
onSaveQuotation: (text) => deps.db.addQuotation(
|
||||
quote: text,
|
||||
pageUrl: page.url,
|
||||
pageTitle: page.title,
|
||||
author: page.author,
|
||||
),
|
||||
onSaveQuotation: (text) async {
|
||||
// Taken before the wait, so the note does not reach across it.
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
final saved = AppScope.of(context).strings.t('quotations-saved');
|
||||
await deps.db.addQuotation(
|
||||
quote: text,
|
||||
pageUrl: page.url,
|
||||
pageTitle: page.title,
|
||||
author: page.author,
|
||||
);
|
||||
if (!mounted) return;
|
||||
// Closing the toolbar looks the same either way, so the save
|
||||
// says it happened.
|
||||
messenger.showSnackBar(SnackBar(
|
||||
duration: const Duration(seconds: 2),
|
||||
content: Text(saved),
|
||||
));
|
||||
},
|
||||
fetchImageBytes: deps.browser.fetchImageBytes,
|
||||
scrollController: _scroll,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue