Skip to content

Commit

Permalink
Broadcast list screen fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
veloce committed Dec 15, 2024
1 parent c77dd2e commit aa2508f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
8 changes: 4 additions & 4 deletions lib/src/utils/l10n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ Text l10nWithWidget<T extends Widget>(
}

final _dayFormatter = DateFormat.E().add_jm();
final _monthFormatter = DateFormat.MMMd().add_Hm();
final _dateFormatterWithYear = DateFormat.yMMMd().add_Hm();
final _monthFormatter = DateFormat.MMMd();
final _dateFormatterWithYear = DateFormat.yMMMd();

String relativeDate(DateTime date) {
final diff = date.difference(DateTime.now());
Expand All @@ -55,9 +55,9 @@ String relativeDate(DateTime date) {
? diff.inHours == 0
? 'in ${diff.inMinutes} minute${diff.inMinutes > 1 ? 's' : ''}' // TODO translate with https://github.com/lichess-org/lila/blob/65b28ea8e43e0133df6c7ed40e03c2954f247d1e/translation/source/timeago.xml#L8
: 'in ${diff.inHours} hour${diff.inHours > 1 ? 's' : ''}' // TODO translate with https://github.com/lichess-org/lila/blob/65b28ea8e43e0133df6c7ed40e03c2954f247d1e/translation/source/timeago.xml#L12
: diff.inDays <= 7
: diff.inDays.abs() <= 7
? _dayFormatter.format(date)
: diff.inDays < 365
: diff.inDays.abs() < 365
? _monthFormatter.format(date)
: _dateFormatterWithYear.format(date);
}
Expand Down
18 changes: 13 additions & 5 deletions lib/src/view/broadcast/broadcast_list_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ class _BodyState extends ConsumerState<_Body> {
),
],
),
const SliverSafeArea(
top: false,
sliver: SliverToBoxAdapter(
child: SizedBox(height: 16.0),
),
),
],
),
),
Expand Down Expand Up @@ -477,30 +483,32 @@ class _BroadcastCartState extends State<BroadcastCard> {
Padding(
padding: kBroadcastGridItemContentPadding,
child: Row(
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Text(
widget.broadcast.round.name,
style: TextStyle(
fontSize: 13,
fontSize: 14,
color: subTitleColor,
letterSpacing: -0.2,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
const SizedBox(width: 4.0),
Flexible(
const SizedBox(width: 5.0),
Expanded(
child: Text(
relativeDate(widget.broadcast.round.startsAt!),
style: TextStyle(
fontSize: 13,
fontSize: 12,
color: subTitleColor,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
),
if (widget.broadcast.isLive) ...[
const Spacer(flex: 3),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Expand Down

0 comments on commit aa2508f

Please sign in to comment.