@@ -841,6 +841,9 @@ String formatHeaderDate(
841
841
}
842
842
843
843
/// A Zulip message, showing the sender's name and avatar if specified.
844
+ // Design referenced from:
845
+ // - https://github.com/zulip/zulip-mobile/issues/5511
846
+ // - https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?type=design&node-id=144-12134&mode=design&t=Vkvdz5hmNVd5um1u-0
844
847
class MessageWithPossibleSender extends StatelessWidget {
845
848
const MessageWithPossibleSender ({super .key, required this .item});
846
849
@@ -850,62 +853,65 @@ class MessageWithPossibleSender extends StatelessWidget {
850
853
Widget build (BuildContext context) {
851
854
final message = item.message;
852
855
853
- final senderRow = item.showSender
856
+ final Widget ? senderRow = item.showSender
854
857
? Padding (
855
858
padding: const EdgeInsets .fromLTRB (3 , 6 , 11 , 0 ),
856
- child: GestureDetector (
857
- onTap: () => Navigator .push (context,
858
- ProfilePage .buildRoute (context: context,
859
- userId: message.senderId)),
860
- child: Avatar (size: 35 , borderRadius: 4 ,
861
- userId: message.senderId)))
862
- : const SizedBox (width: 3 + 35 + 11 );
859
+ child: Row (
860
+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
861
+ crossAxisAlignment: CrossAxisAlignment .baseline,
862
+ textBaseline: TextBaseline .alphabetic,
863
+ children: [
864
+ Flexible (
865
+ child: GestureDetector (
866
+ onTap: () => Navigator .push (context,
867
+ ProfilePage .buildRoute (context: context,
868
+ userId: message.senderId)),
869
+ child: Row (
870
+ children: [
871
+ Avatar (size: 32 , borderRadius: 3 , userId: message.senderId),
872
+ const SizedBox (width: 8 ),
873
+ Flexible (
874
+ child: Text (message.senderFullName, // TODO get from user data
875
+ style: const TextStyle (
876
+ fontFamily: 'Source Sans 3' ,
877
+ fontSize: 18 ,
878
+ height: (22 / 18 ),
879
+ ).merge (weightVariableTextStyle (context, wght: 600 ,
880
+ wghtIfPlatformRequestsBold: 900 )),
881
+ overflow: TextOverflow .ellipsis)),
882
+ ]))),
883
+ Text (
884
+ _kMessageTimestampFormat.format (
885
+ DateTime .fromMillisecondsSinceEpoch (1000 * message.timestamp)),
886
+ style: TextStyle (
887
+ color: _kMessageTimestampColor,
888
+ fontFamily: 'Source Sans 3' ,
889
+ fontSize: 16 ,
890
+ height: (18 / 16 ),
891
+ fontFeatures: const [FontFeature .enable ('c2sc' ), FontFeature .enable ('smcp' )],
892
+ ).merge (weightVariableTextStyle (context))),
893
+ ]))
894
+ : null ;
863
895
864
896
return GestureDetector (
865
897
behavior: HitTestBehavior .translucent,
866
898
onLongPress: () => showMessageActionSheet (context: context, message: message),
867
- // TODO clean up this layout, by less precisely imitating web
868
899
child: Padding (
869
900
padding: const EdgeInsets .only (top: 2 , bottom: 3 , left: 8 , right: 8 ),
870
901
child: Row (crossAxisAlignment: CrossAxisAlignment .start, children: [
871
- senderRow,
872
902
Expanded (
873
903
child: Column (
874
904
crossAxisAlignment: CrossAxisAlignment .stretch,
875
905
children: [
876
- if (item.showSender ) ...[
906
+ if (senderRow != null ) ...[
877
907
const SizedBox (height: 3 ),
878
- GestureDetector (
879
- onTap: () => Navigator .push (context,
880
- ProfilePage .buildRoute (context: context,
881
- userId: message.senderId)),
882
- child: Text (message.senderFullName, // TODO get from user data
883
- style: const TextStyle (
884
- fontFamily: 'Source Sans 3' ,
885
- fontSize: 18 ,
886
- height: (22 / 18 ),
887
- ).merge (weightVariableTextStyle (context, wght: 600 ,
888
- wghtIfPlatformRequestsBold: 900 )))),
908
+ senderRow,
889
909
const SizedBox (height: 4 ),
890
910
],
891
911
MessageContent (message: message, content: item.content),
892
912
if ((message.reactions? .total ?? 0 ) > 0 )
893
913
ReactionChipsList (messageId: message.id, reactions: message.reactions! )
894
914
])),
895
- Container (
896
- width: 80 ,
897
- padding: const EdgeInsets .only (top: 4 , right: 16 - 8 ),
898
- alignment: Alignment .topRight,
899
- child: Text (
900
- _kMessageTimestampFormat.format (
901
- DateTime .fromMillisecondsSinceEpoch (1000 * message.timestamp)),
902
- style: TextStyle (
903
- color: _kMessageTimestampColor,
904
- fontFamily: 'Source Sans 3' ,
905
- fontSize: 16 ,
906
- height: (18 / 16 ),
907
- fontFeatures: const [FontFeature .enable ('c2sc' ), FontFeature .enable ('smcp' )],
908
- ).merge (weightVariableTextStyle (context)))),
909
915
])));
910
916
}
911
917
}
0 commit comments