feat: 通知推送/免打扰偏好 + 饮食记录侧滑删除修复 + 聊天交互优化
- 通知: 新增推送开关/免打扰时段偏好持久化 + EF 迁移; 通知管线支持免打扰过滤 - 饮食: 侧滑删除 confirmDismiss 按方向放行(修复删不掉); 新增 diet_nutrition_widgets; 饮食录入页重构 - 聊天: 智能体胶囊点击锁防误触; 流式状态 select 优化; 卡片入场动画 - 主页: 消息列表提取 _HomeMessages + 侧滑手势打开抽屉 - 其他: api_client IP 适配; 通知/用药/饮食端点微调; 测试更新
This commit is contained in:
@@ -71,7 +71,9 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final chatState = ref.watch(chatProvider);
|
||||
final streaming = ref.watch(
|
||||
chatProvider.select((state) => (state.isStreaming, state.thinkingText)),
|
||||
);
|
||||
|
||||
if (messages.isEmpty) {
|
||||
return Center(
|
||||
@@ -107,10 +109,17 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
controller: scrollCtrl,
|
||||
reverse: false,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
cacheExtent: 180,
|
||||
itemCount: messages.length,
|
||||
itemBuilder: (context, index) {
|
||||
final msg = messages[index];
|
||||
return _buildMessageContent(context, ref, msg, chatState);
|
||||
return _buildMessageContent(
|
||||
context,
|
||||
ref,
|
||||
msg,
|
||||
streaming.$1,
|
||||
streaming.$2 ?? '',
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -121,7 +130,8 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
ChatMessage msg,
|
||||
ChatState chatState,
|
||||
bool isStreaming,
|
||||
String thinkingText,
|
||||
) {
|
||||
switch (msg.type) {
|
||||
case MessageType.agentWelcome:
|
||||
@@ -134,12 +144,10 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
case MessageType.dataConfirm:
|
||||
return _buildDataConfirmCard(context, ref, msg);
|
||||
default:
|
||||
if (!msg.isUser &&
|
||||
chatState.isStreaming &&
|
||||
msg.content.trim().isEmpty) {
|
||||
return _buildThinkingBubble(context, chatState.thinkingText);
|
||||
if (!msg.isUser && isStreaming && msg.content.trim().isEmpty) {
|
||||
return _buildThinkingBubble(context, thinkingText);
|
||||
}
|
||||
return _buildTextBubble(context, ref, msg, chatState);
|
||||
return _buildTextBubble(context, ref, msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1048,7 +1056,6 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
BuildContext context,
|
||||
WidgetRef ref,
|
||||
ChatMessage msg,
|
||||
ChatState? chatState,
|
||||
) {
|
||||
final isUser = msg.isUser;
|
||||
final imageUrl = msg.metadata?['imageUrl'] as String?;
|
||||
@@ -1088,7 +1095,7 @@ class ChatMessagesView extends ConsumerWidget {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
color: isUser ? AppTheme.primary : AppColors.cardBackground,
|
||||
color: isUser ? const Color(0xFF5F56FF) : AppColors.cardBackground,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(isUser ? 18.6 : 3),
|
||||
topRight: Radius.circular(isUser ? 3 : 18.6),
|
||||
|
||||
Reference in New Issue
Block a user