ChatInputFieldProvider class

Holds and drives the state of the chat input field: text entry, voice-note recording (with slide-to-cancel) and image/video selection.

Inheritance

Constructors

ChatInputFieldProvider({required dynamic onTextSubmit(ChatMessage text), required TextEditingController textController, required dynamic handleRecord(ChatMessage? audioMessage, bool cancel), required VoidCallback onSlideToCancelRecord, required double cancelPosition, required dynamic handleImageSelect(ChatMessage? imageMessage), dynamic handleVideoSelect(ChatMessage? videoMessage)?, PermissionService permissionService = const PermissionService(), int audioBitRate = 128000, int imageQuality = 70, double imageMaxWidth = 1440})

Properties

audioBitRate → int
Bit rate (bits/sec) used when recording voice notes.
final
cancelPosition → double
final
duration → int
getters
no setter
formKey → GlobalKey<FormState>
no setter
handleImageSelect → dynamic Function(ChatMessage? imageMessage)
Called with the selected/captured image message (or null when canceled).
final
handleRecord → dynamic Function(ChatMessage? audioMessage, bool cancel)
Called with the recorded voice note, or (null, true) when canceled.
final
handleVideoSelect → dynamic Function(ChatMessage? videoMessage)?
Called with the captured video message (or null when canceled).
final
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
height ← double
setters
no getter
imageMaxWidth → double
Maximum width (px) applied to images picked from the gallery.
final
imageQuality → int
Quality (0-100) applied to images picked from the gallery.
final
isRecording → bool
no setter
isText ↔ bool
getter/setter pair
onSlideToCancelRecord → VoidCallback
Called when the user slides to cancel a recording.
final
onTextSubmit → dynamic Function(ChatMessage text)
Called when the send button is pressed with a non-empty text message.
final
permissionService → PermissionService
Service used for all runtime permission requests.
final
recordTime → int
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
textController → TextEditingController
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object.
override
getPosition() → double
clamp the animated button position between 0 and the cancel threshold
handleCapturedMedia(CapturedMedia? media) → void
build a chat message from the result of the in-app camera flow and forward it through the matching callback
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
onAnimatedButtonLongPress() → void
animated button on long press -> start recording a voice note
onAnimatedButtonLongPressEnd(LongPressEndDetails details) → void
animated button on long press end -> stop and either send or cancel
onAnimatedButtonLongPressMoveUpdate(LongPressMoveUpdateDetails details) → void
animated button on long press move -> track the slide-to-cancel position
onAnimatedButtonTap() → void
animated button on tap -> submit the typed text message
onTextFieldValueChanged(String value) → void
pickImageFromGallery() → Future<void>
pick an image from the gallery and forward it through handleImageSelect
recordAudio() → Future<void>
start recording audio to a temporary file
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
stopRecord() → Future<String?>
stop recording and return the recorded file path (or null)
toString() → String
A string representation of this object.
inherited

Operators

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