FeedbackWidget class

An inline form widget for collecting user feedback.

Provides category selection, free-text input with optional voice dictation, emoji rating, NPS score, and screenshot attachment. Submits via a pluggable FeedbackBackend.

For a ready-to-use floating action button see FeedbackButton.

FeedbackWidget(
  backend: WebhookBackend(url: 'https://example.com/feedback'),
  appVersion: '1.0.0',
  onSuccess: () => Navigator.pop(context),
  metadataCollector: FeedbackMetadataCollector(),
  showRating: true,
)
Inheritance

Constructors

FeedbackWidget({Key? key, required FeedbackBackend backend, required String appVersion, VoidCallback? onSuccess, void onError(Object error)?, VoidCallback? onQueued, int maxMessageLength = 2000, int maxScreenshots = 5, List<FeedbackCategoryItem>? categories, String? submitLabel, String? successMessage, String? queuedMessage, int imageQuality = 60, double maxImageWidth = 800, double maxImageHeight = 800, SpeechRecognitionService? speechService, Future<Uint8List?> onCaptureScreenshot()?, bool autoCapture = false, FeedbackAnalytics? analytics, FeedbackMetadataCollector? metadataCollector, FeedbackSessionContext? sessionContextBuilder()?, bool showRating = false, bool showNps = false, FeedbackLocalizations? localizations})
const

Properties

analytics FeedbackAnalytics?
Optional analytics observer for widget lifecycle events.
final
appVersion String
Application version string embedded in every submission.
final
autoCapture bool
When true and onCaptureScreenshot is provided, automatically captures the screen when the widget first renders. Default: false.
final
backend FeedbackBackend
The backend that receives the submitted FeedbackEntry.
final
categories List<FeedbackCategoryItem>?
Categories shown in the dropdown.
final
hashCode int
The hash code for this object.
no setterinherited
imageQuality int
JPEG quality for gallery images (0–100). Default: 60.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
localizations FeedbackLocalizations?
Custom localisation strings. Falls back to FeedbackLocalizations.of from the widget tree, then EnFeedbackLocalizations.
final
maxImageHeight double
Maximum height for gallery images in pixels. Default: 800.
final
maxImageWidth double
Maximum width for gallery images in pixels. Default: 800.
final
maxMessageLength int
Maximum characters in the message field. Default: 2000.
final
maxScreenshots int
Maximum screenshots that can be attached. Default: 5.
final
metadataCollector FeedbackMetadataCollector?
Optional metadata collector — enriches each FeedbackEntry with OS/device/app info at submission time.
final
onCaptureScreenshot Future<Uint8List?> Function()?
Optional callback for full-screen capture.
final
onError → void Function(Object error)?
Called when submission fails, with the thrown error as argument.
final
onQueued VoidCallback?
Called when the entry is saved to the offline queue instead of sent.
final
onSuccess VoidCallback?
Called after a successful submission.
final
queuedMessage String?
Custom queued snack-bar message. Overrides FeedbackLocalizations.queuedMessage.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionContextBuilder FeedbackSessionContext? Function()?
Optional session context builder called at submission time.
final
showNps bool
Show an NPS (0–10) row. Default: false.
final
showRating bool
Show an emoji CSAT rating row (1–5). Default: false.
final
speechService SpeechRecognitionService?
Optional voice-to-text service. Enables mic button when provided.
final
submitLabel String?
Custom submit button label. Overrides FeedbackLocalizations.submitLabel.
final
successMessage String?
Custom success snack-bar message. Overrides FeedbackLocalizations.successMessage.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<FeedbackWidget>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited