diff --git a/docs/prompt.md b/docs/prompt.md
index 9529cbf..3a5e3dc 100644
--- a/docs/prompt.md
+++ b/docs/prompt.md
@@ -24,3 +24,9 @@ Folgende Dateien wurden in diesem Prompt verändert:
- backend_splatournament_manager/src/services/team-service.ts
- frontend_splatournament_manager/lib/models/team.dart
- frontend_splatournament_manager/lib/pages/teams_page.dart
+
+- Remove the teams_page and add the member count display to the list views.
+Folgende Dateien wurden in diesem Prompt verändert:
+ - frontend_splatournament_manager/lib/pages/teams_page.dart (gelöscht)
+ - frontend_splatournament_manager/lib/widgets/teams_list_widget.dart
+ - frontend_splatournament_manager/lib/widgets/my_teams_widget.dart
diff --git a/frontend_splatournament_manager/lib/pages/teams_page.dart b/frontend_splatournament_manager/lib/pages/teams_page.dart
deleted file mode 100644
index 7326f95..0000000
--- a/frontend_splatournament_manager/lib/pages/teams_page.dart
+++ /dev/null
@@ -1,180 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:frontend_splatournament_manager/models/team.dart';
-import 'package:frontend_splatournament_manager/pages/create_team_page.dart';
-import 'package:frontend_splatournament_manager/providers/team_provider.dart';
-import 'package:provider/provider.dart';
-
-class TeamsPage extends StatelessWidget {
- const TeamsPage({super.key});
-
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: const Text("Teams"),
- actions: [
- IconButton(
- onPressed: () async {
- final teamProvider = Provider.of(
- context,
- listen: false,
- );
- try {
- await teamProvider.refreshTeams();
- } catch (_) {
- if (!context.mounted) return;
- ScaffoldMessenger.of(context).showSnackBar(
- const SnackBar(content: Text('Failed to refresh teams')),
- );
- }
- },
- icon: const Icon(Icons.refresh),
- ),
- ],
- ),
- body: Container(
- padding: const EdgeInsets.all(16),
- child: Consumer(
- builder: (context, provider, _) {
- return FutureBuilder>(
- future: provider.ensureTeamsLoaded(),
- builder: (context, snapshot) {
- final teams = provider.teams;
-
- if (snapshot.connectionState == ConnectionState.waiting &&
- teams.isEmpty) {
- return const Center(child: CircularProgressIndicator());
- }
-
- if (snapshot.hasError && teams.isEmpty) {
- return Center(child: Text('Error: ${snapshot.error}'));
- }
-
- if (teams.isEmpty) {
- return const Center(child: Text('No teams found'));
- }
-
- return ListView.builder(
- itemCount: teams.length,
- itemBuilder: (context, index) {
- final team = teams[index];
- return TeamListItem(team: team);
- },
- );
- },
- );
- },
- ),
- ),
- floatingActionButton: FloatingActionButton(
- onPressed: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => const CreateTeamPage(),
- ),
- );
- },
- child: const Icon(Icons.add),
- ),
- );
- }
-}
-
-class TeamListItem extends StatelessWidget {
- final Team team;
-
- const TeamListItem({super.key, required this.team});
-
- void _showDeleteDialog(BuildContext context) {
- showDialog(
- context: context,
- builder: (BuildContext dialogContext) {
- return AlertDialog(
- title: const Text('Delete Team'),
- content: Text('Are you sure you want to delete "${team.name}"?'),
- actions: [
- TextButton(
- onPressed: () => Navigator.pop(dialogContext),
- child: const Text('Cancel'),
- ),
- TextButton(
- onPressed: () async {
- Navigator.pop(dialogContext);
- try {
- final provider = Provider.of(
- context,
- listen: false,
- );
- await provider.deleteTeam(team.id);
- if (!context.mounted) return;
- ScaffoldMessenger.of(context).showSnackBar(
- const SnackBar(content: Text('Team deleted')),
- );
- } catch (e) {
- if (!context.mounted) return;
- ScaffoldMessenger.of(context).showSnackBar(
- SnackBar(content: Text('Error: $e')),
- );
- }
- },
- child: const Text('Delete', style: TextStyle(color: Colors.red)),
- ),
- ],
- );
- },
- );
- }
-
- @override
- Widget build(BuildContext context) {
- final memberCountText = team.memberCount != null
- ? '${team.memberCount}/4 members'
- : 'No members';
-
- return Card(
- margin: const EdgeInsets.symmetric(vertical: 8),
- child: ListTile(
- leading: CircleAvatar(
- child: Text(team.tag),
- ),
- title: Text(team.name),
- subtitle: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(team.description.isEmpty ? 'No description' : team.description),
- const SizedBox(height: 4),
- Text(
- memberCountText,
- style: const TextStyle(
- fontSize: 12,
- fontWeight: FontWeight.w500,
- ),
- ),
- ],
- ),
- isThreeLine: true,
- trailing: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- IconButton(
- icon: const Icon(Icons.edit),
- onPressed: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => CreateTeamPage(teamToEdit: team),
- ),
- );
- },
- ),
- IconButton(
- icon: const Icon(Icons.delete, color: Colors.red),
- onPressed: () => _showDeleteDialog(context),
- ),
- ],
- ),
- ),
- );
- }
-}
diff --git a/frontend_splatournament_manager/lib/widgets/my_teams_widget.dart b/frontend_splatournament_manager/lib/widgets/my_teams_widget.dart
index 53e51a7..b770e74 100644
--- a/frontend_splatournament_manager/lib/widgets/my_teams_widget.dart
+++ b/frontend_splatournament_manager/lib/widgets/my_teams_widget.dart
@@ -53,12 +53,30 @@ class _MyTeamsWidgetState extends State {
}
Widget _buildTeamCard(Team team) {
+ final memberCountText = team.memberCount != null
+ ? '${team.memberCount}/4 members'
+ : 'No members';
+
return Card(
margin: const EdgeInsets.only(bottom: 12),
child: ListTile(
leading: CircleAvatar(child: Text(team.tag)),
title: Text(team.name),
- subtitle: Text(team.description.isEmpty ? 'No description' : team.description),
+ subtitle: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(team.description.isEmpty ? 'No description' : team.description),
+ const SizedBox(height: 4),
+ Text(
+ memberCountText,
+ style: const TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ ],
+ ),
+ isThreeLine: true,
trailing: IconButton(
icon: const Icon(Icons.logout, color: Colors.red),
onPressed: () => _leaveTeam(team),
diff --git a/frontend_splatournament_manager/lib/widgets/teams_list_widget.dart b/frontend_splatournament_manager/lib/widgets/teams_list_widget.dart
index 8a6103b..2f96348 100644
--- a/frontend_splatournament_manager/lib/widgets/teams_list_widget.dart
+++ b/frontend_splatournament_manager/lib/widgets/teams_list_widget.dart
@@ -49,12 +49,30 @@ class TeamListItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ final memberCountText = team.memberCount != null
+ ? '${team.memberCount}/4 members'
+ : 'No members';
+
return Card(
margin: const EdgeInsets.only(bottom: 12),
child: ListTile(
leading: CircleAvatar(child: Text(team.tag)),
title: Text(team.name),
- subtitle: Text(team.description.isEmpty ? 'No description' : team.description),
+ subtitle: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(team.description.isEmpty ? 'No description' : team.description),
+ const SizedBox(height: 4),
+ Text(
+ memberCountText,
+ style: const TextStyle(
+ fontSize: 12,
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ ],
+ ),
+ isThreeLine: true,
trailing: PopupMenuButton(
icon: const Icon(Icons.more_vert),
itemBuilder: (context) => [