@@ -224,9 +224,6 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
224
224
color: Colors .white,
225
225
// Pad the left and right insets, for small devices in landscape.
226
226
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 ),
230
227
child: Center (
231
228
child: ConstrainedBox (
232
229
constraints: const BoxConstraints (maxWidth: 760 ),
@@ -354,62 +351,14 @@ class MessageItem extends StatelessWidget {
354
351
355
352
@override
356
353
Widget build (BuildContext context) {
357
- final store = PerAccountStoreWidget .of (context);
358
354
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
-
387
355
return StickyHeaderItem (
388
356
allowOverflow: ! item.isLastInBlock,
389
357
header: RecipientHeader (message: message),
390
358
child: Column (children: [
391
- DecoratedBox (
392
- decoration: borderDecoration,
393
- child: MessageWithPossibleSender (item: item)),
359
+ MessageWithPossibleSender (item: item),
394
360
if (trailing != null && item.isLastInBlock) trailing! ,
395
361
]));
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.
413
362
}
414
363
}
415
364
0 commit comments