输入区域(Config 部分自定义 UI)
输入区域通过 RCKMessageInputConfig 进行部分自定义 UI,覆盖输入框、按钮组(左/右/上/下)、表情面板、语音录制、引用预览、扩展菜单、背景与分割线等。以下为所有可用配置与字段说明,并提供面向开发者的使用示例。
入口
- 组件:
RCKMessageInput - 配置:
RCKMessageInputConfig
总览:RCKMessageInputConfig(输入区域整体配置)
inputFieldConfig(RCKInputFieldConfig):输入框外观与行为。leftButtonConfig(RCKInputButtonConfig):左侧主按钮(默认语音/键盘切换)。rightButtonsConfig(List<RCKInputButtonConfig>):右侧按钮组(例如表情/更多)。topButtonsConfig、bottomButtonsConfig(List<RCKInputButtonConfig>):顶部/底部按钮组(可选)。emojiConfig(RCKEmojiConfig):表情面板。voiceRecordConfig(RCKVoiceRecordConfig):语音录制相关样式与布局。padding(EdgeInsets):输入区域内边距。spacing(double):输入框与按钮之间的间距。backgroundColor(Color?):输入区域背景色(随主题默认)。dividerColor(Color?):顶部分割线颜色。quotePreviewConfig(RCKQuotePreviewConfig):引用消息预览区域。extensionMenuConfig(RCKExtensionMenuConfig?):扩展菜单(图片/视频/文件等入口)。
输入框配置(RCKInputFieldConfig)
maxHeight(double?):最大高度限制(默认受kInputFieldMaxHeight约束)。fillColor(Color):填充颜色(默认跟随主题)。border、focusedBorder(InputBorder?):边框与聚焦边框。contentPadding(EdgeInsets):内部填充(默认 8)。textStyle(TextStyle?):文本样式。hintText、hintStyle(String?/TextStyle?):提示与样式。cursorColor(Color?):光标颜色。borderRadius(double):圆角(默认 10)。textInputAction(TextInputAction):键盘动作(默认发送)。
示例:
Dart
inputFieldConfig: RCKInputFieldConfig(
hintText: '说点什么…',
textInputAction: TextInputAction.send,
)
按钮配置(RCKInputButtonConfig)
icon、activeIcon(Widget?):普通/激活态图标。size(double):尺寸(默认kInputFieldIconSize)。spacing(double):与相邻按钮间距(默认kInputFieldButtonSpace)。color、activeColor(Color?):普通/激活态颜色。visible(bool):是否可见。
示例:
Dart
leftButtonConfig: const RCKInputButtonConfig(visible: true)
rightButtonsConfig: const [RCKInputButtonConfig(), RCKInputButtonConfig()]
表情面板配置(RCKEmojiConfig 及子项)
backgroundColor(Color?):背景色。height(double):面板高度(默认kInputExtentionHeight)。rowCount、columnCount(int):行/列数(默认 3×8)。emojiSize(double):表情尺寸(默认 24)。rowSpacing、columnSpacing(double):行/列间距。padding(EdgeInsets):内边距(默认 15)。pageIndicatorConfig(RCKEmojiPageIndicatorConfig):页指示器颜色、大小、间距、底部边距。deleteIcon(Widget):删除按钮图标。sendButtonConfig(RCKEmojiSendButtonConfig):文案、尺寸、背景色、圆角、位置、边距、文本样式。customEmojis(List<String>?):自定义表情资源列表。
RCKEmojiPageIndicatorConfig 字段:activeColor、inactiveColor、size、spacing、bottomPadding。
RCKEmojiSendButtonConfig 字段:text、width、height、backgroundColor、textStyle、borderRadius、position(EmojiSendButtonPosition:bottomRight/bottomLeft/topRight/topLeft)、margin。
示例:
Dart
emojiConfig: const RCKEmojiConfig(
height: 240,
pageIndicatorConfig: RCKEmojiPageIndicatorConfig(size: 6),
)