Files
tongxunruanjian/mobile-next/lib/pages/contacts/contacts_view.dart
T

87 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:openim_common/openim_common.dart';
import '../../company/brand/app_tokens.dart';
import 'contacts_logic.dart';
class ContactsPage extends StatelessWidget {
final logic = Get.find<ContactsLogic>();
ContactsPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.pageBg,
appBar: AppBar(
title: const Text('通讯录'),
actions: [
IconButton(
onPressed: logic.addContacts,
icon: const Icon(Icons.person_add_alt, size: AppIconSize.md, color: AppColors.textPrimary),
),
],
),
body: Obx(
() => 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,
),
],
),
),
);
}
Widget _entry({
required IconData icon,
required String label,
int count = 0,
required VoidCallback onTap,
}) {
return InkWell(
onTap: onTap,
child: SizedBox(
height: 56,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: AppGap.x4),
child: Row(
children: [
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: AppColors.primaryActive,
borderRadius: BorderRadius.circular(AppRadius.control),
),
alignment: Alignment.center,
child: Icon(icon, size: AppIconSize.sm, color: AppColors.primary),
),
const SizedBox(width: AppGap.x3),
Text(label, style: const TextStyle(fontSize: AppFont.body, color: AppColors.textPrimary)),
const Spacer(),
if (count > 0) UnreadCountView(count: count),
],
),
),
),
);
}
}