Skip to content

Commit f50e1b2

Browse files
committed
msglist: Messages changed to render edge-to-edge and borderless
This is a small change in line with zulip#157 and moves the implementation closer to the new 2023+ design for mobile. Messages now span from screen edge to screen edge and borders around groups of messages (in particular the left-side recipient border) was removed.
1 parent d9ae8ca commit f50e1b2

File tree

1 file changed

+1
-52
lines changed

1 file changed

+1
-52
lines changed

lib/widgets/message_list.dart

+1-52
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,6 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
224224
color: Colors.white,
225225
// Pad the left and right insets, for small devices in landscape.
226226
child: SafeArea(
227-
// Keep some padding when there are no horizontal insets,
228-
// which is usual in portrait mode.
229-
minimum: const EdgeInsets.symmetric(horizontal: 8),
230227
child: Center(
231228
child: ConstrainedBox(
232229
constraints: const BoxConstraints(maxWidth: 760),
@@ -354,62 +351,14 @@ class MessageItem extends StatelessWidget {
354351

355352
@override
356353
Widget build(BuildContext context) {
357-
final store = PerAccountStoreWidget.of(context);
358354
final message = item.message;
359-
360-
Color highlightBorderColor;
361-
Color restBorderColor;
362-
if (message is StreamMessage) {
363-
final subscription = store.subscriptions[message.streamId];
364-
highlightBorderColor = colorForStream(subscription);
365-
restBorderColor = _kStreamMessageBorderColor;
366-
} else if (message is DmMessage) {
367-
highlightBorderColor = _kDmRecipientHeaderColor;
368-
restBorderColor = _kDmRecipientHeaderColor;
369-
} else {
370-
throw Exception("impossible message type: ${message.runtimeType}");
371-
}
372-
373-
// This 3px border seems to accurately reproduce something much more
374-
// complicated on web, involving CSS box-shadow; see comment below.
375-
final recipientBorder = BorderSide(color: highlightBorderColor, width: 3);
376-
final restBorder = BorderSide(color: restBorderColor, width: 1);
377-
var borderDecoration = ShapeDecoration(
378-
// Web actually uses, for stream messages, a slightly lighter border at
379-
// right than at bottom and in the recipient header: black 10% alpha,
380-
// vs. 88% lightness. Assume that's an accident.
381-
shape: Border(
382-
left: recipientBorder,
383-
right: restBorder,
384-
bottom: item.isLastInBlock ? restBorder : BorderSide.none,
385-
));
386-
387355
return StickyHeaderItem(
388356
allowOverflow: !item.isLastInBlock,
389357
header: RecipientHeader(message: message),
390358
child: Column(children: [
391-
DecoratedBox(
392-
decoration: borderDecoration,
393-
child: MessageWithPossibleSender(item: item)),
359+
MessageWithPossibleSender(item: item),
394360
if (trailing != null && item.isLastInBlock) trailing!,
395361
]));
396-
397-
// Web handles the left-side recipient marker in a funky way:
398-
// box-shadow: inset 3px 0px 0px -1px #c2726a, -1px 0px 0px 0px #c2726a;
399-
// (where the color is the stream color.) That is, it's a pair of
400-
// box shadows. One of them is inset.
401-
//
402-
// At attempt at a literal translation might look like this:
403-
//
404-
// DecoratedBox(
405-
// decoration: ShapeDecoration(shadows: [
406-
// BoxShadow(offset: Offset(3, 0), spreadRadius: -1, color: highlightBorderColor),
407-
// BoxShadow(offset: Offset(-1, 0), color: highlightBorderColor),
408-
// ], shape: Border.fromBorderSide(BorderSide.none)),
409-
// child: MessageWithSender(message: message)),
410-
//
411-
// But CSS `box-shadow` seems to not apply under the item itself, while
412-
// Flutter's BoxShadow does.
413362
}
414363
}
415364

0 commit comments

Comments
 (0)