Skip to content

Commit 37e478d

Browse files
committed
msglist: Style recipient header dates according to design
Also prepares header dates to receive a color from its parent so it can be changed depending on context.
1 parent 2842951 commit 37e478d

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

lib/widgets/message_list.dart

+17-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:math';
2+
import 'dart:ui';
23

34
import 'package:collection/collection.dart';
45
import 'package:flutter/material.dart';
@@ -597,7 +598,8 @@ class StreamMessageRecipientHeader extends StatelessWidget {
597598
style: const TextStyle(fontWeight: FontWeight.w600)))),
598599
// TODO topic links?
599600
// Then web also has edit/resolve/mute buttons. Skip those for mobile.
600-
RecipientHeaderDate(message: message),
601+
RecipientHeaderDate(message: message,
602+
color: _kRecipientHeaderDateColor),
601603
])));
602604
}
603605
}
@@ -638,33 +640,40 @@ class DmRecipientHeader extends StatelessWidget {
638640
color: _kDmRecipientHeaderColor,
639641
child: Text(style: const TextStyle(color: Colors.white),
640642
title)),
641-
RecipientHeaderDate(message: message),
643+
RecipientHeaderDate(message: message,
644+
color: _kRecipientHeaderDateColor),
642645
])));
643646
}
644647
}
645648

646649
final _kDmRecipientHeaderColor = const HSLColor.fromAHSL(1, 0, 0, 0.27).toColor();
647650

648651
class RecipientHeaderDate extends StatelessWidget {
649-
const RecipientHeaderDate({super.key, required this.message});
652+
const RecipientHeaderDate({super.key, required this.message, required this.color});
650653

651654
final Message message;
655+
final Color color;
652656

653657
@override
654658
Widget build(BuildContext context) {
655659
return Padding(
656660
padding: const EdgeInsets.fromLTRB(10, 0, 16, 0),
657661
child: Text(
658-
style: _kRecipientHeaderDateStyle,
662+
style: TextStyle(
663+
color: color,
664+
fontFamily: 'Source Sans 3',
665+
fontSize: 16,
666+
height: (19 / 16),
667+
// This is equivalent to css `all-small-caps`, see:
668+
// https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps#all-small-caps
669+
fontFeatures: const [FontFeature.enable('c2sc'), FontFeature.enable('smcp')],
670+
).merge(weightVariableTextStyle(context)),
659671
_kRecipientHeaderDateFormat.format(
660672
DateTime.fromMillisecondsSinceEpoch(message.timestamp * 1000))));
661673
}
662674
}
663675

664-
final _kRecipientHeaderDateStyle = TextStyle(
665-
fontWeight: FontWeight.w600,
666-
color: const HSLColor.fromAHSL(0.75, 0, 0, 0.15).toColor(),
667-
);
676+
final _kRecipientHeaderDateColor = const HSLColor.fromAHSL(0.75, 0, 0, 0.15).toColor();
668677

669678
final _kRecipientHeaderDateFormat = DateFormat('y-MM-dd', 'en_US'); // TODO(#278)
670679

0 commit comments

Comments
 (0)