@@ -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
@@ -852,61 +855,67 @@ class MessageWithPossibleSender extends StatelessWidget {
852
855
853
856
final senderRow = item.showSender
854
857
? Padding (
855
- 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 );
858
+ padding: const EdgeInsets .only (top: 6 , left: 16 , right: 16 ),
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
- child: Padding (
869
- padding: const EdgeInsets .only (top: 2 , bottom: 3 , left: 8 , right: 8 ),
870
- child: Row (crossAxisAlignment: CrossAxisAlignment .start, children: [
871
- senderRow,
872
- Expanded (
873
- child: Column (
874
- crossAxisAlignment: CrossAxisAlignment .stretch,
875
- children: [
876
- if (item.showSender) ...[
877
- 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 )))),
889
- const SizedBox (height: 4 ),
890
- ],
891
- MessageContent (message: message, content: item.content),
892
- if ((message.reactions? .total ?? 0 ) > 0 )
893
- ReactionChipsList (messageId: message.id, reactions: message.reactions! )
894
- ])),
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
- ])));
899
+ child: Column (
900
+ children: [
901
+ if (senderRow != null ) senderRow,
902
+ Row (
903
+ crossAxisAlignment: CrossAxisAlignment .start,
904
+ children: [
905
+ const SizedBox (width: 16 ),
906
+ Expanded (
907
+ child: Padding (
908
+ padding: const EdgeInsets .symmetric (vertical: 4 ),
909
+ child: Column (
910
+ crossAxisAlignment: CrossAxisAlignment .stretch,
911
+ children: [
912
+ MessageContent (message: message, content: item.content),
913
+ if ((message.reactions? .total ?? 0 ) > 0 )
914
+ ReactionChipsList (messageId: message.id, reactions: message.reactions! )
915
+ ]))),
916
+ const SizedBox (width: 16 ),
917
+ ]),
918
+ ]));
910
919
}
911
920
}
912
921
0 commit comments