Skip to content
On this page

MessageComposer

A message input with attachments, editing, and send actions.

MessageComposer in FluttyUIMessageComposer in FluttyUI dark theme

Import

import 'package:flutter/widgets.dart';
import 'package:fluttyui/fluttyui.dart' as ui;

API Reference

The declarations below match the current FluttyUI source. Types are shown without the optional ui. import prefix.

MessageComposer

const MessageComposer({
  super.key,
  this.controller,
  this.size,
  this.focusNode,
  this.initialValue = '',
  this.placeholder = 'Message...',
  this.semanticLabel = 'Message',
  this.onChanged,
  this.onSend,
  this.onSendError,
  this.onAttachmentPressed,
  this.onMicrophonePressed,
  this.onVoicePressed,
  this.voice,
  this.onStop,
  this.leadingActions = const [],
  this.trailingActions = const [],
  this.attachment,
  this.attachments = const [],
  this.onAttachmentRemoved,
  this.enabled = true,
  this.isSending = false,
  this.autofocus = false,
  this.clearOnSend = true,
  this.closeOnSend = false,
  this.collapsedWidthFactor = .95,
  this.minExpandedLines = 2,
  this.maxLines = 8,
  this.fontSize,
  this.lineHeight = 1.3,
  this.allowEnlargement = true,
  this.maxLength,
  this.inputFormatters = const [],
  this.errorText,
  this.backgroundColor,
  this.foregroundColor,
  this.placeholderColor,
  this.focusColor,
  this.motion,
});
ParameterTypeRequiredDefault
keyKey?Nonull
controllerTextEditingController?Nonull
sizeComponentSize?Nonull
focusNodeFocusNode?Nonull
initialValueStringNo''
placeholderStringNo'Message...'
semanticLabelStringNo'Message'
onChangedValueChanged<String>?Nonull
onSendFutureOr<void> Function(String text)?Nonull
onSendErrorvoid Function(Object error, StackTrace stackTrace)?Nonull
onAttachmentPressedVoidCallback?Nonull
onMicrophonePressedVoidCallback?Nonull
onVoicePressedVoidCallback?Nonull
voiceMessageComposerVoice?Nonull
onStopVoidCallback?Nonull
leadingActionsList<Widget>Noconst []
trailingActionsList<Widget>Noconst []
attachmentWidget?Nonull
attachmentsList<MessageComposerAttachment>Noconst []
onAttachmentRemovedValueChanged<MessageComposerAttachment>?Nonull
enabledboolNotrue
isSendingboolNofalse
autofocusboolNofalse
clearOnSendboolNotrue
closeOnSendboolNofalse
collapsedWidthFactordoubleNo.95
minExpandedLinesintNo2
maxLinesintNo8
fontSizedouble?Nonull
lineHeightdoubleNo1.3
allowEnlargementboolNotrue
maxLengthint?Nonull
inputFormattersList<TextInputFormatter>Noconst []
errorTextString?Nonull
backgroundColorColor?Nonull
foregroundColorColor?Nonull
placeholderColorColor?Nonull
focusColorColor?Nonull
motionComponentMotion?Nonull

Application Setup

Place components under FluttyApp to provide theme, navigation, localization, and overlay defaults. Use theme tokens for shared appearance settings.

Source

lib/src/widgets/messaging/message_composer/message_composer.dart

This reference is generated from the MessageComposer declaration in the FluttyUI core checkout. The component catalog lists the other available building blocks.

DartFlutter

Get started with FluttyUI