@@ -279,32 +279,51 @@ class _ReportIssueState extends ConsumerState<ReportIssue> {
279279
280280 hideKeyboard ();
281281
282+ // Snapshot the validated fields now so later edits (e.g. while the
283+ // confirmation dialog is up or during its dismiss delay) can't change
284+ // what gets sent.
285+ final draft = ref.read (reportIssueDraftProvider);
286+ final issueType = _selectedIssue ?? '' ;
287+ final email = _emailController.text.trim ();
288+ final description = _descriptionController.text.trim ();
289+ final attachments = List <ReportIssueAttachment >.of (draft.attachments);
290+
282291 // Without an email we can't reply or follow up, so confirm before sending.
283- if (_emailController.text. trim () .isEmpty) {
292+ if (email .isEmpty) {
284293 AppDialog .show (
285294 context: context,
286295 title: 'send_without_email_title' .i18n,
287296 body: 'send_without_email_body' .i18n,
288297 primaryLabel: 'add_email' .i18n,
289298 secondaryLabel: 'send_without_email' .i18n,
290- onSecondaryPressed: _performSubmit,
299+ onSecondaryPressed: () => _performSubmit (
300+ email: email,
301+ issueType: issueType,
302+ description: description,
303+ attachments: attachments,
304+ ),
291305 );
292306 return ;
293307 }
294308
295- await _performSubmit ();
309+ await _performSubmit (
310+ email: email,
311+ issueType: issueType,
312+ description: description,
313+ attachments: attachments,
314+ );
296315 }
297316
298- Future <void > _performSubmit () async {
317+ Future <void > _performSubmit ({
318+ required String email,
319+ required String issueType,
320+ required String description,
321+ required List <ReportIssueAttachment > attachments,
322+ }) async {
299323 if (! mounted) {
300324 return ;
301325 }
302326
303- final draft = ref.read (reportIssueDraftProvider);
304- final issueType = _selectedIssue ?? '' ;
305- final email = _emailController.text.trim ();
306- final description = _descriptionController.text.trim ();
307-
308327 context.showLoadingDialog ();
309328 appLogger.debug ('Submitting issue report: $issueType , $description ' );
310329
@@ -314,7 +333,7 @@ class _ReportIssueState extends ConsumerState<ReportIssue> {
314333 email: email,
315334 issueType: issueType,
316335 description: description,
317- attachments: draft. attachments,
336+ attachments: attachments,
318337 );
319338
320339 if (! mounted) {
0 commit comments