diff --git a/lib/screens/AvailableMatches.dart b/lib/screens/AvailableMatches.dart index 3fed6d53..37043bfd 100644 --- a/lib/screens/AvailableMatches.dart +++ b/lib/screens/AvailableMatches.dart @@ -36,8 +36,10 @@ class AvailableMatches extends StatelessWidget { if (state.getMatches() == null) { return null; } - if (state.getMatches().where((m) => loadOnceState.getSportCenter(m.sportCenterId) == null).isNotEmpty) - return null; + if (state + .getMatches() + .where((m) => loadOnceState.getSportCenter(m.sportCenterId) == null) + .isNotEmpty) return null; if (!userState.isLoggedIn()) { return getEmptyStateWidget(context, false); @@ -78,8 +80,10 @@ class AvailableMatches extends StatelessWidget { if (state.getMatches() == null) { return null; } - if (state.getMatches().where((m) => loadOnceState.getSportCenter(m.sportCenterId) == null).isNotEmpty) - return null; + if (state + .getMatches() + .where((m) => loadOnceState.getSportCenter(m.sportCenterId) == null) + .isNotEmpty) return null; if (!userState.isLoggedIn()) { return getEmptyStateWidget(context); @@ -119,8 +123,10 @@ class AvailableMatches extends StatelessWidget { if (state.getMatches() == null) { return null; } - if (state.getMatches().where((m) => loadOnceState.getSportCenter(m.sportCenterId) == null).isNotEmpty) - return null; + if (state + .getMatches() + .where((m) => loadOnceState.getSportCenter(m.sportCenterId) == null) + .isNotEmpty) return null; var matches = state .getMatchesInFuture() @@ -139,11 +145,11 @@ class AvailableMatches extends StatelessWidget { List sortedWeeks = grouped.keys.toList()..sort(); - List result = []; - - var groupedByWeeksIntervals = Map> (); - groupedByWeeksIntervals["THIS WEEK"] = grouped[0]; - groupedByWeeksIntervals["NEXT WEEK"] = grouped[0]; + var groupedByWeeksIntervals = Map>(); + if (grouped.containsKey(0)) + groupedByWeeksIntervals["THIS WEEK"] = grouped[0]; + if (grouped.containsKey(1)) + groupedByWeeksIntervals["NEXT WEEK"] = grouped[1]; groupedByWeeksIntervals["IN MORE THAN TWO WEEKS"] = List.from([]); sortedWeeks.forEach((w) { if (w > 1) { @@ -151,16 +157,17 @@ class AvailableMatches extends StatelessWidget { } }); + List result = []; groupedByWeeksIntervals.entries.forEach((e) { - var widgets = - e.value.sortedBy((e) => e.dateTime).mapIndexed((index, match) { - if (index == 0) { - return GenericMatchInfo.first( - match.documentId, onTap, refreshController); - } - return GenericMatchInfo(match.documentId, onTap, refreshController); - }); - if (widgets.isNotEmpty) { + if (e.value != null && e.value.isNotEmpty) { + var widgets = + e.value.sortedBy((e) => e.dateTime).mapIndexed((index, match) { + if (index == 0) { + return GenericMatchInfo.first( + match.documentId, onTap, refreshController); + } + return GenericMatchInfo(match.documentId, onTap, refreshController); + }); result.add(Section( topSpace: 16, title: e.key, diff --git a/lib/screens/MatchDetails.dart b/lib/screens/MatchDetails.dart index 26047440..3570fa85 100644 --- a/lib/screens/MatchDetails.dart +++ b/lib/screens/MatchDetails.dart @@ -685,8 +685,10 @@ class Stats extends StatelessWidget { @override Widget build(BuildContext context) { var child; + var showingPartial = matchStatusForUser == MatchStatusForUser.no_more_to_rate && extended; - if (matchStatusForUser == MatchStatusForUser.no_more_to_rate) { + // in extended mode, we show also partial results + if (matchStatusForUser == MatchStatusForUser.no_more_to_rate && !extended) { child = Container( width: double.infinity, child: Column( @@ -851,7 +853,7 @@ class Stats extends StatelessWidget { return Container( child: Section( - title: "MATCH STATS", + title: "MATCH STATS " + (showingPartial ? " (partial)" : ""), body: InfoContainer(child: child), ), );