feat(ui): expose widthFactor in MessageWidget (#1357)

This commit is contained in:
Spencer Connaughton
2022-10-24 10:28:08 +02:00
committed by GitHub
parent 144d517dea
commit 1d6a566647
2 changed files with 10 additions and 1 deletions
@@ -3,6 +3,7 @@
🔄 Changed 🔄 Changed
- Updated `share_plus` dependency to `^4.5.0` - Updated `share_plus` dependency to `^4.5.0`
- Expose `widthFactor` option in `MessageWidget`
## 5.0.0 ## 5.0.0
@@ -88,6 +88,7 @@ class StreamMessageWidget extends StatefulWidget {
vertical: 8, vertical: 8,
), ),
this.attachmentPadding = EdgeInsets.zero, this.attachmentPadding = EdgeInsets.zero,
this.widthFactor = 0.78,
this.onQuotedMessageTap, this.onQuotedMessageTap,
this.customActions = const [], this.customActions = const [],
this.onAttachmentTap, this.onAttachmentTap,
@@ -377,6 +378,11 @@ class StreamMessageWidget extends StatefulWidget {
/// {@endtemplate} /// {@endtemplate}
final EdgeInsetsGeometry attachmentPadding; final EdgeInsetsGeometry attachmentPadding;
/// {@template widthFactor}
/// The percentage of the available width the message content should take
/// {@endtemplate}
final double widthFactor;
/// {@template showUserAvatar} /// {@template showUserAvatar}
/// It controls the display behaviour of the user avatar /// It controls the display behaviour of the user avatar
/// {@endtemplate} /// {@endtemplate}
@@ -547,6 +553,7 @@ class StreamMessageWidget extends StatefulWidget {
EdgeInsetsGeometry? padding, EdgeInsetsGeometry? padding,
EdgeInsets? textPadding, EdgeInsets? textPadding,
EdgeInsetsGeometry? attachmentPadding, EdgeInsetsGeometry? attachmentPadding,
double? widthFactor,
DisplayWidget? showUserAvatar, DisplayWidget? showUserAvatar,
bool? showSendingIndicator, bool? showSendingIndicator,
bool? showReactions, bool? showReactions,
@@ -606,6 +613,7 @@ class StreamMessageWidget extends StatefulWidget {
padding: padding ?? this.padding, padding: padding ?? this.padding,
textPadding: textPadding ?? this.textPadding, textPadding: textPadding ?? this.textPadding,
attachmentPadding: attachmentPadding ?? this.attachmentPadding, attachmentPadding: attachmentPadding ?? this.attachmentPadding,
widthFactor: widthFactor ?? this.widthFactor,
showUserAvatar: showUserAvatar ?? this.showUserAvatar, showUserAvatar: showUserAvatar ?? this.showUserAvatar,
showSendingIndicator: showSendingIndicator ?? this.showSendingIndicator, showSendingIndicator: showSendingIndicator ?? this.showSendingIndicator,
showReactions: showReactions ?? this.showReactions, showReactions: showReactions ?? this.showReactions,
@@ -829,7 +837,7 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
alignment: widget.reverse alignment: widget.reverse
? Alignment.centerRight ? Alignment.centerRight
: Alignment.centerLeft, : Alignment.centerLeft,
widthFactor: 0.78, widthFactor: widget.widthFactor,
child: MessageWidgetContent( child: MessageWidgetContent(
streamChatTheme: _streamChatTheme, streamChatTheme: _streamChatTheme,
showUsername: showUsername, showUsername: showUsername,