Skip to content

Commit

Permalink
msglist: Move white background color to MessageItem, from whole list
Browse files Browse the repository at this point in the history
This lets `colorScheme.background` (which we matched to the Figma in
21dbae1) come through in the area with the "Mark X messages as
read" button, following a Figma frame:
  https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=147%3A9133&mode=dev
(There's a different Figma frame that shows a stream-specific color
there; more on that in the next commit.)

The background color (`colorScheme.background`) will now also come
through in these areas:

- in the area with the "No earlier messages" text, when scrolled to
  the earliest messages
- in the new blank space we added after the most recent message,
  earlier in this series of commits.

Fixes: #401
  • Loading branch information
chrisbobbe authored and gnprice committed Nov 20, 2023
1 parent c8fe66e commit dff550e
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions lib/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,35 +229,33 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
// TODO figure out text color -- web is supposedly hsl(0deg 0% 20%),
// but seems much darker than that
style: const TextStyle(color: Color.fromRGBO(0, 0, 0, 1)),
child: ColoredBox(
color: Colors.white,
// Pad the left and right insets, for small devices in landscape.
child: SafeArea(
// Don't let this be the place we pad the bottom inset. When there's
// no compose box, we want to let the message-list content pad it.
// TODO(#311) Remove as unnecessary if we do a bottom nav.
// The nav will pad the bottom inset, and an ancestor of this widget
// will have a `MediaQuery.removePadding` with `removeBottom: true`.
bottom: false,

child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 760),
child: NotificationListener<ScrollMetricsNotification>(
onNotification: _metricsChanged,
child: Stack(
children: <Widget>[
_buildListView(context),
Positioned(
bottom: 0,
right: 0,
// TODO(#311) SafeArea shouldn't be needed if we have a
// bottom nav. That will pad the bottom inset.
child: SafeArea(
child: ScrollToBottomButton(
scrollController: scrollController,
visibleValue: _scrollToBottomVisibleValue))),
])))))));
// Pad the left and right insets, for small devices in landscape.
child: SafeArea(
// Don't let this be the place we pad the bottom inset. When there's
// no compose box, we want to let the message-list content pad it.
// TODO(#311) Remove as unnecessary if we do a bottom nav.
// The nav will pad the bottom inset, and an ancestor of this widget
// will have a `MediaQuery.removePadding` with `removeBottom: true`.
bottom: false,

child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 760),
child: NotificationListener<ScrollMetricsNotification>(
onNotification: _metricsChanged,
child: Stack(
children: <Widget>[
_buildListView(context),
Positioned(
bottom: 0,
right: 0,
// TODO(#311) SafeArea shouldn't be needed if we have a
// bottom nav. That will pad the bottom inset.
child: SafeArea(
child: ScrollToBottomButton(
scrollController: scrollController,
visibleValue: _scrollToBottomVisibleValue))),
]))))));
}

Widget _buildListView(context) {
Expand Down Expand Up @@ -464,10 +462,12 @@ class MessageItem extends StatelessWidget {
header: RecipientHeader(message: message),
child: _UnreadMarker(
isRead: message.flags.contains(MessageFlag.read),
child: Column(children: [
MessageWithPossibleSender(item: item),
if (trailingWhitespace != null && item.isLastInBlock) SizedBox(height: trailingWhitespace!),
])));
child: ColoredBox(
color: Colors.white,
child: Column(children: [
MessageWithPossibleSender(item: item),
if (trailingWhitespace != null && item.isLastInBlock) SizedBox(height: trailingWhitespace!),
]))));
}
}

Expand Down

0 comments on commit dff550e

Please sign in to comment.