implement changes
This commit is contained in:
@@ -21,6 +21,7 @@ class _MatchTileState extends State<MatchTile> {
|
||||
final group = widget.match.group;
|
||||
final winner = widget.match.winner;
|
||||
final allPlayers = _getAllPlayers();
|
||||
final loc = AppLocalizations.of(context);
|
||||
|
||||
return GestureDetector(
|
||||
onTap: widget.onTap,
|
||||
@@ -49,7 +50,7 @@ class _MatchTileState extends State<MatchTile> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
_formatDate(widget.match.createdAt),
|
||||
_formatDate(widget.match.createdAt, context),
|
||||
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||
),
|
||||
],
|
||||
@@ -98,7 +99,7 @@ class _MatchTileState extends State<MatchTile> {
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).winner(winner.name),
|
||||
loc.winner(winner.name),
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -115,7 +116,7 @@ class _MatchTileState extends State<MatchTile> {
|
||||
|
||||
if (allPlayers.isNotEmpty) ...[
|
||||
Text(
|
||||
AppLocalizations.of(context).players,
|
||||
loc.players,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.grey,
|
||||
@@ -137,9 +138,10 @@ class _MatchTileState extends State<MatchTile> {
|
||||
);
|
||||
}
|
||||
|
||||
String _formatDate(DateTime dateTime) {
|
||||
String _formatDate(DateTime dateTime, BuildContext context) {
|
||||
final now = DateTime.now();
|
||||
final difference = now.difference(dateTime);
|
||||
final loc = AppLocalizations.of(context);
|
||||
|
||||
if (difference.inDays == 0) {
|
||||
return AppLocalizations.of(
|
||||
@@ -150,7 +152,7 @@ class _MatchTileState extends State<MatchTile> {
|
||||
context,
|
||||
).yesterday_at(DateFormat('HH:mm').format(dateTime));
|
||||
} else if (difference.inDays < 7) {
|
||||
return AppLocalizations.of(context).days_ago(difference.inDays);
|
||||
return loc.days_ago(difference.inDays);
|
||||
} else {
|
||||
return DateFormat('MMM d, yyyy').format(dateTime);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user