feat(mobile-next): 通讯录按部门分组并补齐职务行与申请窄屏
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
7f131457f7
commit
49b346d375
@@ -32,31 +32,116 @@ class ContactsPage extends StatelessWidget {
|
||||
if (logic.loadFailed.value) {
|
||||
return CompanyFailView(onRetry: logic.reload);
|
||||
}
|
||||
return Column(
|
||||
children: [
|
||||
_entry(
|
||||
icon: Icons.person_add_alt,
|
||||
label: '新的同事',
|
||||
count: logic.friendApplicationCount,
|
||||
onTap: logic.newFriend,
|
||||
),
|
||||
_entry(
|
||||
icon: Icons.group_outlined,
|
||||
label: '我的群聊',
|
||||
count: logic.groupApplicationCount,
|
||||
onTap: logic.myGroup,
|
||||
),
|
||||
_entry(
|
||||
icon: Icons.people_outline,
|
||||
label: '同事',
|
||||
onTap: logic.myFriend,
|
||||
final grouped = logic.groupedColleagues;
|
||||
return CustomScrollView(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: Column(
|
||||
children: [
|
||||
_entry(
|
||||
icon: Icons.person_add_alt,
|
||||
label: '新的同事',
|
||||
count: logic.friendApplicationCount,
|
||||
onTap: logic.newFriend,
|
||||
),
|
||||
_entry(
|
||||
icon: Icons.group_outlined,
|
||||
label: '我的群聊',
|
||||
count: logic.groupApplicationCount,
|
||||
onTap: logic.myGroup,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (logic.colleagues.isEmpty)
|
||||
const SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: CompanyEmptyView(
|
||||
icon: Icons.person_outline,
|
||||
title: '暂时没有同事',
|
||||
subtitle: '点右上角添加同事',
|
||||
),
|
||||
)
|
||||
else
|
||||
for (final entry in grouped.entries) ...[
|
||||
SliverToBoxAdapter(child: _groupHeader(entry.key)),
|
||||
SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(_, index) => _colleagueRow(entry.value[index]),
|
||||
childCount: entry.value.length,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _groupHeader(String name) {
|
||||
return Container(
|
||||
height: 28,
|
||||
color: AppColors.chatBg,
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.symmetric(horizontal: AppGap.x4),
|
||||
child: Text(
|
||||
name,
|
||||
style: const TextStyle(
|
||||
fontSize: AppFont.small, color: AppColors.textSecondary),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _colleagueRow(ColleagueRow row) {
|
||||
return InkWell(
|
||||
onTap: () => logic.openColleague(row),
|
||||
splashColor: AppColors.chatBg,
|
||||
highlightColor: AppColors.chatBg,
|
||||
child: SizedBox(
|
||||
height: 64,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: AppGap.x4),
|
||||
child: Row(
|
||||
children: [
|
||||
AvatarView(
|
||||
url: row.faceURL,
|
||||
text: row.nickname,
|
||||
width: 48,
|
||||
height: 48,
|
||||
),
|
||||
const SizedBox(width: AppGap.x3),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
row.nickname,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: AppFont.body,
|
||||
color: AppColors.textPrimary),
|
||||
),
|
||||
if (row.subtitle.isNotEmpty)
|
||||
Text(
|
||||
row.subtitle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: AppFont.sub,
|
||||
color: AppColors.textSecondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _entry({
|
||||
required IconData icon,
|
||||
required String label,
|
||||
|
||||
Reference in New Issue
Block a user