diff --git a/lib/src/model/broadcast/broadcast.dart b/lib/src/model/broadcast/broadcast.dart index 035aab4e68..e662e90090 100644 --- a/lib/src/model/broadcast/broadcast.dart +++ b/lib/src/model/broadcast/broadcast.dart @@ -82,7 +82,8 @@ class BroadcastRound with _$BroadcastRound { required String name, required RoundStatus status, required DateTime? startsAt, - DateTime? finishedAt, + required DateTime? finishedAt, + required bool startsAfterPrevious, }) = _BroadcastRound; } diff --git a/lib/src/model/broadcast/broadcast_repository.dart b/lib/src/model/broadcast/broadcast_repository.dart index 04bdbc2ea7..05ddfe2b49 100644 --- a/lib/src/model/broadcast/broadcast_repository.dart +++ b/lib/src/model/broadcast/broadcast_repository.dart @@ -136,6 +136,7 @@ BroadcastRound _roundFromPick(RequiredPick pick) { status: status, startsAt: pick('startsAt').asDateTimeFromMillisecondsOrNull(), finishedAt: pick('finishedAt').asDateTimeFromMillisecondsOrNull(), + startsAfterPrevious: pick('startsAfterPrevious').asBoolOrFalse(), ); } diff --git a/lib/src/view/broadcast/broadcast_list_screen.dart b/lib/src/view/broadcast/broadcast_list_screen.dart index 6d55990abe..a55720a012 100644 --- a/lib/src/view/broadcast/broadcast_list_screen.dart +++ b/lib/src/view/broadcast/broadcast_list_screen.dart @@ -217,9 +217,9 @@ class BroadcastGridItem extends StatefulWidget { final Broadcast broadcast; final ImageColorWorker worker; - BroadcastGridItem.loading(this.worker) - : broadcast = Broadcast( - tour: const BroadcastTournamentData( + const BroadcastGridItem.loading(this.worker) + : broadcast = const Broadcast( + tour: BroadcastTournamentData( id: BroadcastTournamentId(''), name: '', imageUrl: null, @@ -234,13 +234,15 @@ class BroadcastGridItem extends StatefulWidget { ), ), round: BroadcastRound( - id: const BroadcastRoundId(''), + id: BroadcastRoundId(''), name: '', status: RoundStatus.finished, - startsAt: DateTime.now(), + startsAt: null, + finishedAt: null, + startsAfterPrevious: false, ), group: null, - roundToLinkId: const BroadcastRoundId(''), + roundToLinkId: BroadcastRoundId(''), ); @override diff --git a/lib/src/view/broadcast/broadcast_round_screen.dart b/lib/src/view/broadcast/broadcast_round_screen.dart index d85ee37ad1..a0723ad863 100644 --- a/lib/src/view/broadcast/broadcast_round_screen.dart +++ b/lib/src/view/broadcast/broadcast_round_screen.dart @@ -383,37 +383,40 @@ class _RoundSelectorState extends ConsumerState<_RoundSelectorMenu> { return BottomSheetScrollableContainer( scrollController: widget.scrollController, children: [ - for (final round in widget.rounds) + for (final (index, round) in widget.rounds.indexed) PlatformListTile( key: round.id == widget.selectedRoundId ? currentRoundKey : null, selected: round.id == widget.selectedRoundId, title: Text(round.name), - trailing: switch (round.status) { - RoundStatus.finished => Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(_dateFormat.format(round.startsAt!)), - const SizedBox(width: 5.0), - Icon(Icons.check, color: context.lichessColors.good), - ], - ), - RoundStatus.live => Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(_dateFormat.format(round.startsAt!)), - const SizedBox(width: 5.0), - Icon(Icons.circle, color: context.lichessColors.error), - ], - ), - RoundStatus.upcoming => Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(_dateFormat.format(round.startsAt!)), - const SizedBox(width: 5.0), - const Icon(Icons.calendar_month, color: Colors.grey), - ], - ), - }, + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (round.startsAt != null || round.startsAfterPrevious) ...[ + Text( + round.startsAt != null + ? _dateFormat.format(round.startsAt!) + : context.l10n.broadcastStartsAfter( + widget.rounds[index - 1].name, + ), + ), + const SizedBox(width: 5.0), + ], + switch (round.status) { + RoundStatus.finished => Icon( + Icons.check, + color: context.lichessColors.good, + ), + RoundStatus.live => Icon( + Icons.circle, + color: context.lichessColors.error, + ), + RoundStatus.upcoming => const Icon( + Icons.calendar_month, + color: Colors.grey, + ), + }, + ], + ), onTap: () { widget.setRoundId(round.id); Navigator.of(context).pop();