fix(mobile-next): 把加载、失败、断网接到真实 SDK 与目录请求
会话列表、通讯录、好友申请、添加同事页覆盖 CompanyLoadingView/CompanyFailView; 主页断网横幅跟随 IMSdkStatus.connectionFailed。不伪造状态。 Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
Cursor
multica-agent
parent
092f513708
commit
2b2c2d28a4
@@ -46,7 +46,8 @@ class ConversationPage extends StatelessWidget {
|
||||
body: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(AppGap.x4, 0, AppGap.x4, AppGap.x2),
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
AppGap.x4, 0, AppGap.x4, AppGap.x2),
|
||||
child: Container(
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
@@ -57,47 +58,64 @@ class ConversationPage extends StatelessWidget {
|
||||
alignment: Alignment.centerLeft,
|
||||
child: const Row(
|
||||
children: [
|
||||
Icon(Icons.search, size: AppIconSize.sm, color: AppColors.textSecondary),
|
||||
Icon(Icons.search,
|
||||
size: AppIconSize.sm, color: AppColors.textSecondary),
|
||||
SizedBox(width: AppGap.x2),
|
||||
Text('搜索', style: TextStyle(fontSize: AppFont.sub, color: AppColors.textSecondary)),
|
||||
Text('搜索',
|
||||
style: TextStyle(
|
||||
fontSize: AppFont.sub,
|
||||
color: AppColors.textSecondary)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: logic.list.isEmpty
|
||||
? const CompanyEmptyView(
|
||||
icon: Icons.chat_bubble_outline,
|
||||
title: '暂时没有会话',
|
||||
subtitle: '去通讯录找个同事聊聊吧',
|
||||
)
|
||||
: SlidableAutoCloseBehavior(
|
||||
child: ScrollablePositionedList.builder(
|
||||
itemScrollController: logic.itemScrollController,
|
||||
itemBuilder: (_, index) => _buildConversationItemView(
|
||||
logic.list.elementAt(index),
|
||||
),
|
||||
itemCount: logic.list.length,
|
||||
itemPositionsListener: logic.itemPositionsListener,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(child: _conversationBody()),
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Widget _conversationBody() {
|
||||
if (logic.showLoading) {
|
||||
return const CompanyLoadingView();
|
||||
}
|
||||
if (logic.showFail) {
|
||||
return CompanyFailView(onRetry: logic.reloadConversations);
|
||||
}
|
||||
if (logic.list.isEmpty) {
|
||||
return const CompanyEmptyView(
|
||||
icon: Icons.chat_bubble_outline,
|
||||
title: '暂时没有会话',
|
||||
subtitle: '去通讯录找个同事聊聊吧',
|
||||
);
|
||||
}
|
||||
return SlidableAutoCloseBehavior(
|
||||
child: ScrollablePositionedList.builder(
|
||||
itemScrollController: logic.itemScrollController,
|
||||
itemBuilder: (_, index) => _buildConversationItemView(
|
||||
logic.list.elementAt(index),
|
||||
),
|
||||
itemCount: logic.list.length,
|
||||
itemPositionsListener: logic.itemPositionsListener,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildConversationItemView(ConversationInfo info) => Slidable(
|
||||
endActionPane: ActionPane(
|
||||
motion: const ScrollMotion(),
|
||||
extentRatio: logic.existUnreadMsg(info) ? 0.7 : (logic.isPinned(info) ? 0.5 : 0.4),
|
||||
extentRatio: logic.existUnreadMsg(info)
|
||||
? 0.7
|
||||
: (logic.isPinned(info) ? 0.5 : 0.4),
|
||||
children: [
|
||||
CustomSlidableAction(
|
||||
onPressed: (_) => logic.pinConversation(info),
|
||||
flex: logic.isPinned(info) ? 3 : 2,
|
||||
backgroundColor: Styles.c_0089FF,
|
||||
padding: const EdgeInsets.all(1),
|
||||
child: (logic.isPinned(info) ? StrRes.cancelTop : StrRes.top).toText..style = Styles.ts_FFFFFF_14sp,
|
||||
child:
|
||||
(logic.isPinned(info) ? StrRes.cancelTop : StrRes.top).toText
|
||||
..style = Styles.ts_FFFFFF_14sp,
|
||||
),
|
||||
if (logic.existUnreadMsg(info))
|
||||
CustomSlidableAction(
|
||||
@@ -163,7 +181,8 @@ class ConversationPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
logic.getTime(info).toText..style = Styles.ts_8E9AB0_12sp,
|
||||
logic.getTime(info).toText
|
||||
..style = Styles.ts_8E9AB0_12sp,
|
||||
],
|
||||
),
|
||||
3.verticalSpace,
|
||||
@@ -175,9 +194,12 @@ class ConversationPage extends StatelessWidget {
|
||||
prefixSpan: TextSpan(
|
||||
text: '',
|
||||
children: [
|
||||
if (logic.isNotDisturb(info) && logic.getUnreadCount(info) > 0)
|
||||
if (logic.isNotDisturb(info) &&
|
||||
logic.getUnreadCount(info) > 0)
|
||||
TextSpan(
|
||||
text: '[${sprintf(StrRes.nPieces, [logic.getUnreadCount(info)])}] ',
|
||||
text: '[${sprintf(StrRes.nPieces, [
|
||||
logic.getUnreadCount(info)
|
||||
])}] ',
|
||||
style: Styles.ts_8E9AB0_14sp,
|
||||
),
|
||||
TextSpan(
|
||||
@@ -195,7 +217,8 @@ class ConversationPage extends StatelessWidget {
|
||||
..width = 13.63.w
|
||||
..height = 14.07.h
|
||||
else
|
||||
UnreadCountView(count: logic.getUnreadCount(info)),
|
||||
UnreadCountView(
|
||||
count: logic.getUnreadCount(info)),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user