enhansed ui
This commit is contained in:
parent
253aa55a80
commit
804f0eba7b
@ -470,67 +470,95 @@ class _ServiceProjectDetailsScreenState
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTeamsTab() {
|
Widget _buildTeamsTab() {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
if (controller.isTeamLoading.value) {
|
if (controller.isTeamLoading.value) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
}
|
}
|
||||||
|
|
||||||
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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ListView.separated(
|
// Group team members by their role ID
|
||||||
padding: const EdgeInsets.all(12),
|
final Map<String, List> roleGroups = {};
|
||||||
itemCount: controller.teamList.length,
|
for (var team in controller.teamList) {
|
||||||
separatorBuilder: (_, __) => const SizedBox(height: 12),
|
roleGroups.putIfAbsent(team.teamRole.id, () => []).add(team);
|
||||||
itemBuilder: (context, index) {
|
}
|
||||||
final team = controller.teamList[index];
|
|
||||||
return Card(
|
return ListView.separated(
|
||||||
shape:
|
padding: const EdgeInsets.all(12),
|
||||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
|
itemCount: roleGroups.keys.length,
|
||||||
child: Padding(
|
separatorBuilder: (_, __) => const SizedBox(height: 12),
|
||||||
padding: const EdgeInsets.all(16),
|
itemBuilder: (context, index) {
|
||||||
child: Row(
|
final roleId = roleGroups.keys.elementAt(index);
|
||||||
children: [
|
final teamMembers = roleGroups[roleId]!;
|
||||||
Avatar(
|
final roleName = teamMembers.first.teamRole.name;
|
||||||
firstName: team.employee.firstName,
|
|
||||||
lastName: team.employee.lastName,
|
return Card(
|
||||||
size: 32,
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
imageUrl: (team.employee.photo?.isNotEmpty ?? false)
|
elevation: 3,
|
||||||
? team.employee.photo
|
shadowColor: Colors.black26,
|
||||||
: null,
|
child: Padding(
|
||||||
),
|
padding: const EdgeInsets.all(16),
|
||||||
MySpacing.width(12),
|
child: Column(
|
||||||
Expanded(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
child: Column(
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
// 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(
|
||||||
children: [
|
children: [
|
||||||
MyText.titleMedium(
|
Avatar(
|
||||||
"${team.employee.firstName} ${team.employee.lastName}",
|
firstName: team.employee.firstName,
|
||||||
fontWeight: 700),
|
lastName: team.employee.lastName,
|
||||||
MyText.bodySmall(team.teamRole.name,
|
size: 32,
|
||||||
color: Colors.grey[700]),
|
imageUrl: (team.employee.photo?.isNotEmpty ?? false)
|
||||||
MyText.bodySmall(
|
? team.employee.photo
|
||||||
"Status: ${team.isActive ? 'Active' : 'Inactive'}",
|
: null,
|
||||||
color: Colors.grey[700]),
|
),
|
||||||
|
MySpacing.width(12),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
MyText.titleMedium(
|
||||||
|
"${team.employee.firstName} ${team.employee.lastName}",
|
||||||
|
fontWeight: 600,
|
||||||
|
),
|
||||||
|
MyText.bodySmall(
|
||||||
|
"Status: ${team.isActive ? 'Active' : 'Inactive'}",
|
||||||
|
color: Colors.grey[700],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
],
|
}).toList(),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
);
|
},
|
||||||
});
|
);
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user