Use Speech Input Across All Opted-In Text Fields
The Speech Input Widget is implemented as a composable Flutter widget that wraps any TextEditingController. Feature teams opt text fields into speech input by wrapping them with SpeechInputWidget and passing the target controller. The microphone icon renders inline within or adjacent to the text field. This composable pattern means speech input is available wherever the widget is applied — activity wizard summary, contact notes, event descriptions, and any future free-text fields — without duplicating recognition logic. The Speech Recognition Service and Voice Recording Control are shared singletons that handle one active session at a time.
User Story
Acceptance Criteria
- Given a text field has been wrapped with the Speech Input Widget, when the peer mentor views the field, then a microphone icon is visible adjacent to the field
- Given multiple text fields on the same screen are wrapped with Speech Input Widget, when the peer mentor taps the mic on one field, then only that field's session is activated and the others remain inactive
- Given a recognition session completes on a wrapped field, when the transcript is inserted, then the text is injected into the correct TextEditingController for that field
- Given a new text field in a future screen needs speech input, when a developer wraps it with SpeechInputWidget passing the controller, then speech input becomes available without modifying the Speech Recognition Service or Voice Recording Control
- Given the app is on a screen with no opted-in speech fields, when the peer mentor navigates the screen, then no microphone icon is displayed
Business Value
The composable widget architecture ensures speech input is not a one-off feature bolted onto the activity wizard but a reusable capability that reduces typing load across the entire app. This is especially valuable for contact notes — another free-text field where peer mentors document important personal and health context. Reducing typing friction across all notes fields directly supports the accessibility and low-cognitive-load design principles central to the project.