Bearbeiten und Löschen von Matches #171
@@ -144,7 +144,7 @@ class _MatchViewState extends State<MatchView> {
|
|||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
final loadedMatches = results[0] as List<Match>;
|
final loadedMatches = results[0] as List<Match>;
|
||||||
matches = loadedMatches
|
matches = [...loadedMatches]
|
||||||
..sort((a, b) => b.createdAt.compareTo(a.createdAt));
|
..sort((a, b) => b.createdAt.compareTo(a.createdAt));
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import 'package:intl/intl.dart';
|
|||||||
import 'package:tallee/core/common.dart';
|
import 'package:tallee/core/common.dart';
|
||||||
import 'package:tallee/core/custom_theme.dart';
|
import 'package:tallee/core/custom_theme.dart';
|
||||||
import 'package:tallee/data/dto/match.dart';
|
import 'package:tallee/data/dto/match.dart';
|
||||||
import 'package:tallee/data/dto/player.dart';
|
|
||||||
import 'package:tallee/l10n/generated/app_localizations.dart';
|
import 'package:tallee/l10n/generated/app_localizations.dart';
|
||||||
import 'package:tallee/presentation/widgets/tiles/text_icon_tile.dart';
|
import 'package:tallee/presentation/widgets/tiles/text_icon_tile.dart';
|
||||||
|
|
||||||
@@ -41,20 +40,13 @@ class MatchTile extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MatchTileState extends State<MatchTile> {
|
class _MatchTileState extends State<MatchTile> {
|
||||||
late List<Player> _allPlayers;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_allPlayers = [...widget.match.players];
|
|
||||||
_allPlayers.sort((a, b) => a.name.compareTo(b.name));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final match = widget.match;
|
final match = widget.match;
|
||||||
final group = widget.match.group;
|
final group = widget.match.group;
|
||||||
final winner = widget.match.winner;
|
final winner = widget.match.winner;
|
||||||
|
final players = [...widget.match.players]
|
||||||
|
..sort((a, b) => a.name.compareTo(b.name));
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
@@ -197,7 +189,7 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
],
|
],
|
||||||
|
|
||||||
if (_allPlayers.isNotEmpty && widget.compact == false) ...[
|
if (players.isNotEmpty && widget.compact == false) ...[
|
||||||
Text(
|
Text(
|
||||||
loc.players,
|
loc.players,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@@ -210,7 +202,7 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
Wrap(
|
Wrap(
|
||||||
spacing: 6,
|
spacing: 6,
|
||||||
runSpacing: 6,
|
runSpacing: 6,
|
||||||
children: _allPlayers.map((player) {
|
children: players.map((player) {
|
||||||
return TextIconTile(text: player.name, iconEnabled: false);
|
return TextIconTile(text: player.name, iconEnabled: false);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user