fix(feedback): Show success message after feedback submission#3609
Conversation
Display a success screen with successMessageText after feedback is submitted. The form is replaced with a checkmark icon and success message that auto-dismisses after 5 seconds or on tap. Adds `successColor` and `onSubmitSuccess` callback to `SentryFeedbackOptions`.
Android Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| bfabaf2 | 408.04 ms | 444.38 ms | 36.34 ms |
| 4ff8a1b | 378.32 ms | 381.29 ms | 2.97 ms |
| a5b28db | 383.85 ms | 387.65 ms | 3.80 ms |
| 13b8895 | 372.91 ms | 370.13 ms | -2.79 ms |
| b4b7781 | 399.82 ms | 394.26 ms | -5.56 ms |
| 819c1e7 | 449.80 ms | 442.98 ms | -6.82 ms |
| 7b21e8b | 467.74 ms | 466.24 ms | -1.50 ms |
| 2b5e090 | 437.21 ms | 467.14 ms | 29.93 ms |
| 7cfbbd6 | 499.69 ms | 592.24 ms | 92.55 ms |
| 93b7728 | 475.28 ms | 489.13 ms | 13.86 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| bfabaf2 | 13.93 MiB | 15.06 MiB | 1.13 MiB |
| 4ff8a1b | 13.93 MiB | 15.18 MiB | 1.25 MiB |
| a5b28db | 13.93 MiB | 15.18 MiB | 1.25 MiB |
| 13b8895 | 13.93 MiB | 15.18 MiB | 1.25 MiB |
| b4b7781 | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| 819c1e7 | 13.93 MiB | 15.00 MiB | 1.06 MiB |
| 7b21e8b | 13.93 MiB | 15.00 MiB | 1.06 MiB |
| 2b5e090 | 13.93 MiB | 15.06 MiB | 1.13 MiB |
| 7cfbbd6 | 6.54 MiB | 7.70 MiB | 1.17 MiB |
| 93b7728 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
Previous results on branch: feat/feedback-success-message
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0aa509a | 377.57 ms | 393.20 ms | 15.63 ms |
| f289ae3 | 496.35 ms | 485.24 ms | -11.10 ms |
| ec17daf | 403.04 ms | 422.15 ms | 19.10 ms |
| 0c7df23 | 379.69 ms | 379.08 ms | -0.61 ms |
| 04e57cb | 364.44 ms | 361.00 ms | -3.44 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0aa509a | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| f289ae3 | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| ec17daf | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| 0c7df23 | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| 04e57cb | 14.31 MiB | 15.49 MiB | 1.19 MiB |
iOS Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 3f47ea3 | 1263.90 ms | 1263.87 ms | -0.02 ms |
| 67de70c | 1260.09 ms | 1266.79 ms | 6.71 ms |
| 40c8f93 | 1234.27 ms | 1261.98 ms | 27.71 ms |
| 0e2b9b0 | 1248.69 ms | 1252.22 ms | 3.54 ms |
| a7f011a | 1247.40 ms | 1255.72 ms | 8.32 ms |
| e5ae2a6 | 1240.48 ms | 1253.26 ms | 12.78 ms |
| d789735 | 1240.58 ms | 1246.41 ms | 5.82 ms |
| 7cfbbd6 | 1270.63 ms | 1285.36 ms | 14.72 ms |
| 6b69699 | 1254.80 ms | 1273.31 ms | 18.52 ms |
| 944b773 | 1252.82 ms | 1254.08 ms | 1.27 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 3f47ea3 | 5.53 MiB | 5.96 MiB | 444.81 KiB |
| 67de70c | 5.73 MiB | 6.17 MiB | 455.45 KiB |
| 40c8f93 | 5.53 MiB | 6.00 MiB | 479.94 KiB |
| 0e2b9b0 | 5.73 MiB | 6.17 MiB | 453.79 KiB |
| a7f011a | 5.73 MiB | 6.17 MiB | 455.50 KiB |
| e5ae2a6 | 5.65 MiB | 6.09 MiB | 446.96 KiB |
| d789735 | 5.53 MiB | 5.96 MiB | 443.28 KiB |
| 7cfbbd6 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 6b69699 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 944b773 | 5.53 MiB | 6.00 MiB | 479.98 KiB |
Previous results on branch: feat/feedback-success-message
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 04e57cb | 1246.67 ms | 1248.35 ms | 1.67 ms |
| 0aa509a | 1248.27 ms | 1256.28 ms | 8.01 ms |
| ec17daf | 1242.74 ms | 1252.36 ms | 9.62 ms |
| 0c7df23 | 1259.98 ms | 1268.59 ms | 8.61 ms |
| f289ae3 | 1258.83 ms | 1258.98 ms | 0.15 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 04e57cb | 5.73 MiB | 6.17 MiB | 455.48 KiB |
| 0aa509a | 5.73 MiB | 6.17 MiB | 455.85 KiB |
| ec17daf | 5.73 MiB | 6.17 MiB | 455.86 KiB |
| 0c7df23 | 5.73 MiB | 6.17 MiB | 455.86 KiB |
| f289ae3 | 5.73 MiB | 6.17 MiB | 455.48 KiB |
📲 Install BuildsAndroid
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3609 +/- ##
==========================================
+ Coverage 86.85% 91.49% +4.64%
==========================================
Files 321 102 -219
Lines 10802 3494 -7308
==========================================
- Hits 9382 3197 -6185
+ Misses 1420 297 -1123
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
buenaflor
left a comment
There was a problem hiding this comment.
as discussed let's do that but let's make the out of the box success widget not the whole screen, please look into what's idiomatic for Flutter
…sentry-dart into feat/feedback-success-message
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Unguarded user callback blocks dismiss and snackbar
- Wrapped
onSubmitSuccessin try-catch with error logging so callback failures no longer prevent showing the success snackbar and dismissing the widget.
- Wrapped
Or push these changes by commenting:
@cursor push 0e775e1fba
Preview (0e775e1fba)
diff --git a/packages/flutter/lib/src/feedback/sentry_feedback_widget.dart b/packages/flutter/lib/src/feedback/sentry_feedback_widget.dart
--- a/packages/flutter/lib/src/feedback/sentry_feedback_widget.dart
+++ b/packages/flutter/lib/src/feedback/sentry_feedback_widget.dart
@@ -8,6 +8,7 @@
import 'package:flutter/services.dart';
import 'sentry_logo.dart';
import '../replay/integration.dart';
+import '../utils/internal_logger.dart';
class SentryFeedbackWidget extends StatefulWidget {
SentryFeedbackWidget({
@@ -388,7 +389,15 @@
if (!mounted) return;
- widget.options.onSubmitSuccess?.call(feedback, sentryId);
+ try {
+ widget.options.onSubmitSuccess?.call(feedback, sentryId);
+ } catch (exception, stackTrace) {
+ internalLogger.error(
+ 'SentryFeedbackWidget failed to execute onSubmitSuccess callback',
+ error: exception,
+ stackTrace: stackTrace,
+ );
+ }
_showSuccessSnackBar();
_dismiss(pendingAssociatedEventId: false);
}
diff --git a/packages/flutter/test/feedback/sentry_feedback_widget_test.dart b/packages/flutter/test/feedback/sentry_feedback_widget_test.dart
--- a/packages/flutter/test/feedback/sentry_feedback_widget_test.dart
+++ b/packages/flutter/test/feedback/sentry_feedback_widget_test.dart
@@ -889,6 +889,31 @@
expect(receivedEventId, isNotNull);
expect(receivedEventId, isNot(const SentryId.empty()));
});
+
+ testWidgets('dismisses and shows snackbar when onSubmitSuccess throws',
+ (tester) async {
+ fixture.options.feedback.onSubmitSuccess = (feedback, eventId) {
+ throw Exception('onSubmitSuccess failed');
+ };
+
+ await fixture.pumpFeedbackHost(tester);
+
+ await tester.tap(find.text('Show Feedback'));
+ await tester.pumpAndSettle();
+
+ await tester.enterText(
+ find.byKey(const ValueKey('sentry_feedback_message_textfield')),
+ 'callback-throw-test',
+ );
+ await tester.tap(find.text('Send Bug Report'));
+ await tester.pumpAndSettle();
+
+ expect(tester.takeException(), isNull);
+ expect(find.byType(SentryFeedbackWidget), findsNothing);
+ expect(find.byType(SnackBar), findsOneWidget);
+ expect(find.text('Thank you for your report!'), findsOneWidget);
+ expect(SentryFeedbackWidget.pendingAssociatedEventId, isNull);
+ });
});
});
}This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0aa509a. Configure here.
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Fixes
🤖 This preview updates automatically when you update the PR. |


📜 Description
Display a success snackbar with successMessageText after feedback is submitted. Adds
successColorandonSubmitSuccesscallback toSentryFeedbackOptions.💡 Motivation and Context
Closes #3583
💚 How did you test it?
📝 Checklist
sendDefaultPiiis enabled