Skip to content

msglist: Pad left and right insets #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions lib/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,28 @@ class _MessageListState extends State<MessageList> {
style: const TextStyle(color: Color.fromRGBO(0, 0, 0, 1)),
child: ColoredBox(
color: Colors.white,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 760),
child: _buildListView(context)))));

// Pad the left and right insets, for small devices in landscape.
child: SafeArea(
// A non-ancestor (the compose box) pads the bottom inset;
// prevent extra padding here.
// TODO have MessageListPage adjust the MediaQuery so we don't
// have to worry about this here
bottom: false,

// A non-ancestor (the app bar) pads the top inset. But no
// need to prevent extra padding with `top: false`, because
// Scaffold, which knows about the app bar, sets `body`'s
// ambient `MediaQueryData.padding` to have `top: 0`:
// https://github.com/flutter/flutter/blob/3.7.0-1.2.pre/packages/flutter/lib/src/material/scaffold.dart#L2778

// Keep some padding when there are no horizontal insets,
// which is usual in portrait mode.
minimum: const EdgeInsets.symmetric(horizontal: 8),
child: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 760),
child: _buildListView(context))))));
}

Widget _buildListView(context) {
Expand Down