enhansed ui

This commit is contained in:
Vaibhav Surve 2025-11-18 17:50:47 +05:30
parent 253aa55a80
commit 804f0eba7b

View File

@ -478,25 +478,48 @@ class _ServiceProjectDetailsScreenState
if (controller.teamErrorMessage.value.isNotEmpty && if (controller.teamErrorMessage.value.isNotEmpty &&
controller.teamList.isEmpty) { controller.teamList.isEmpty) {
return Center( return Center(child: MyText.bodyMedium(controller.teamErrorMessage.value));
child: MyText.bodyMedium(controller.teamErrorMessage.value));
} }
if (controller.teamList.isEmpty) { if (controller.teamList.isEmpty) {
return Center(child: MyText.bodyMedium("No team members found")); return Center(child: MyText.bodyMedium("No team members found"));
} }
// Group team members by their role ID
final Map<String, List> roleGroups = {};
for (var team in controller.teamList) {
roleGroups.putIfAbsent(team.teamRole.id, () => []).add(team);
}
return ListView.separated( return ListView.separated(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
itemCount: controller.teamList.length, itemCount: roleGroups.keys.length,
separatorBuilder: (_, __) => const SizedBox(height: 12), separatorBuilder: (_, __) => const SizedBox(height: 12),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final team = controller.teamList[index]; final roleId = roleGroups.keys.elementAt(index);
final teamMembers = roleGroups[roleId]!;
final roleName = teamMembers.first.teamRole.name;
return Card( return Card(
shape: shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)), elevation: 3,
shadowColor: Colors.black26,
child: Padding( child: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Role header
MyText.bodyLarge(
roleName,
fontWeight: 700,
color: Colors.black87,
),
const Divider(height: 20, thickness: 1),
// List of team members inside this role card
...teamMembers.map((team) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row( child: Row(
children: [ children: [
Avatar( Avatar(
@ -514,23 +537,28 @@ class _ServiceProjectDetailsScreenState
children: [ children: [
MyText.titleMedium( MyText.titleMedium(
"${team.employee.firstName} ${team.employee.lastName}", "${team.employee.firstName} ${team.employee.lastName}",
fontWeight: 700), fontWeight: 600,
MyText.bodySmall(team.teamRole.name, ),
color: Colors.grey[700]),
MyText.bodySmall( MyText.bodySmall(
"Status: ${team.isActive ? 'Active' : 'Inactive'}", "Status: ${team.isActive ? 'Active' : 'Inactive'}",
color: Colors.grey[700]), color: Colors.grey[700],
),
], ],
), ),
), ),
], ],
), ),
);
}).toList(),
],
),
), ),
); );
}, },
); );
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {