Skip to content

Commit eef24bf

Browse files
committed
content: Use directional layout for message media
Previously, these previews (for images and video) were hardcoded to align to the left, with padding on the right. This resulted in an incorrect layout in RTL locales. We now use directional positioning so that the alignment and padding flip correctly based on the text direction. Suggested by @gnprice.
1 parent 9296fb3 commit eef24bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/widgets/content.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,11 +741,11 @@ class MessageMediaContainer extends StatelessWidget {
741741
return GestureDetector(
742742
onTap: onTap,
743743
child: UnconstrainedBox(
744-
alignment: Alignment.centerLeft,
744+
alignment: AlignmentDirectional.centerStart,
745745
child: Padding(
746746
// TODO clean up this padding by imitating web less precisely;
747747
// in particular, avoid adding loose whitespace at end of message.
748-
padding: const EdgeInsets.only(right: 5, bottom: 5),
748+
padding: const EdgeInsetsDirectional.only(end: 5, bottom: 5),
749749
child: ColoredBox(
750750
color: ContentTheme.of(context).colorMessageMediaContainerBackground,
751751
child: Padding(

0 commit comments

Comments
 (0)