Skip to content

Commit

Permalink
fix: reduce bubble message width
Browse files Browse the repository at this point in the history
This Closes #469
  • Loading branch information
Julian KOUNE authored and hoangdat committed Aug 25, 2023
1 parent a6c42e7 commit db2f608
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/pages/chat/events/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ class Message extends StatelessWidget {
children: [
// if (ownMessage && event.messageType == MessageTypes.Image)
// ReplyIconWidget(isOwnMessage: ownMessage),
Expanded(
flex: MessageStyle.messageFlexMobile,
Container(
constraints: BoxConstraints(
maxWidth: MessageStyle.messageBubbleWidth(context),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
Expand Down
14 changes: 14 additions & 0 deletions lib/pages/chat/events/message/message_style.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:fluffychat/config/app_config.dart';
import 'package:flutter/material.dart';
import 'package:fluffychat/utils/extension/build_context_extension.dart';

class MessageStyle {
static final bubbleBorderRadius = BorderRadius.circular(20);
Expand Down Expand Up @@ -47,4 +48,17 @@ class MessageStyle {
static double get forwardContainerSize => 40.0;
static Color? forwardColorBackground(context) =>
Theme.of(context).colorScheme.surfaceTint.withOpacity(0.08);

static const double messageBubbleLargeMaxWidth = 620.0;
static const double messageBubbleWatchMaxWidth = 240.0;
static const double messageBubbleMobileRatioMaxWidth = 0.80;
static double messageBubbleWidth(BuildContext context) {
return context.responsiveValue<double>(
desktop: messageBubbleLargeMaxWidth,
tablet: messageBubbleLargeMaxWidth,
mobile:
MediaQuery.of(context).size.width * messageBubbleMobileRatioMaxWidth,
watch: messageBubbleWatchMaxWidth,
);
}
}

0 comments on commit db2f608

Please sign in to comment.