会话列表(Config 部分自定义 UI)
会话列表通过 RCKConvoConfig 进行部分自定义 UI,覆盖 AppBar、头像、标题、最后一条消息、时间、未读角标、免打扰图标、单元格样式、元素布局、侧滑操作、整体列表等。以下为所有可用配置及字段说明,并提供常见使用示例。
入口组件
- 组件:
RCKConvoPage - 配置:
RCKConvoConfig
总览:RCKConvoConfig(会话列表整体配置)
包含以下子配置:
appBarConfig: 顶部导航栏配置(详见下文“AppBar 配置”)avatarConfig: 头像配置titleConfig: 标题(会话名)配置lastMessageConfig: 最后一条消息配置timeConfig: 时间配置unreadBadgeConfig: 未读角标配置muteIconConfig: 免打扰图标配置itemConfig: 单元格容器与分割线配置layoutConfig: 各元素在单元格内的布局位置与间距slidableConfig: 侧滑操作配置(置顶/删除/免打扰/自定义)listConfig: 列表级别配置(搜索、分页、背景等)
AppBar 配置(RCKConvoAppBarConfig)
height(double): AppBar 高度padding(EdgeInsets): AppBar 内边距centerTitle(bool): 标题是否居中automaticallyImplyLeading(bool): 是否自动添加返回按钮backgroundConfig(BackgroundConfig): 背景(颜色/图片/渐变/边框/圆角/阴影)leadingConfig(LeadingConfig): 左侧区域(图标/文本/点击/内边距/最大宽度等)titleConfig(AppbarTitleConfig): 标题文本、样式、前后缀图标、间距、内边距、对齐actionsConfig(ActionsConfig): 右侧操作项列表、间距、内边距、对齐
BackgroundConfig 字段:color、image(DecorationImage)、gradient、border、borderRadius、boxShadow
LeadingConfig 字段:icon(Widget?)、text(String?)、textStyle、textOverflow、spacing、onPressed、padding、maxWidth
AppbarTitleConfig 字段:text、textStyle、textOverflow、prefixIcon、suffixIcon、spacing、padding、maxWidth、alignment(MainAxisAlignment)
ActionsConfig 字段:items(List<ActionItem>)、spacing、padding、maxWidth、alignment
ActionItem 字段:icon(Widget,必填)、text、textStyle、textOverflow、spacing、onPressed、padding
示例:
Dart
RCKConvoPage(
config: RCKConvoConfig(
appBarConfig: RCKConvoAppBarConfig(
titleConfig: AppbarTitleConfig(text: '会话'),
leadingConfig: LeadingConfig(
icon: const Icon(Icons.arrow_back),
onPressed: () => Navigator.pop(context),
),
actionsConfig: ActionsConfig(items: [
ActionItem(icon: const Icon(Icons.add), onPressed: () {/* ... */}),
]),
),
),
)