fix: attachment borders
This commit is contained in:
@@ -104,3 +104,15 @@ extension BuildContextX on BuildContext {
|
|||||||
double get textScaleFactor =>
|
double get textScaleFactor =>
|
||||||
MediaQuery.maybeOf(this)?.textScaleFactor ?? 1.0;
|
MediaQuery.maybeOf(this)?.textScaleFactor ?? 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Extension on [BorderRadius]
|
||||||
|
extension FlipBorder on BorderRadius {
|
||||||
|
/// Flips borders (Y)
|
||||||
|
BorderRadius mirrorBorderIfReversed({bool reverse = true}) => reverse
|
||||||
|
? BorderRadius.only(
|
||||||
|
topLeft: topRight,
|
||||||
|
topRight: topLeft,
|
||||||
|
bottomLeft: bottomRight,
|
||||||
|
bottomRight: bottomLeft)
|
||||||
|
: this;
|
||||||
|
}
|
||||||
|
|||||||
@@ -189,8 +189,10 @@ class _MessageActionsModalState extends State<MessageActionsModal> {
|
|||||||
child: MessageWidget(
|
child: MessageWidget(
|
||||||
key: const Key('MessageWidget'),
|
key: const Key('MessageWidget'),
|
||||||
reverse: widget.reverse,
|
reverse: widget.reverse,
|
||||||
attachmentBorderRadiusGeometry:
|
attachmentBorderRadiusGeometry: widget
|
||||||
widget.attachmentBorderRadiusGeometry,
|
.attachmentBorderRadiusGeometry
|
||||||
|
?.mirrorBorderIfReversed(
|
||||||
|
reverse: widget.reverse),
|
||||||
message: widget.message.copyWith(
|
message: widget.message.copyWith(
|
||||||
text: widget.message.text!.length > 200
|
text: widget.message.text!.length > 200
|
||||||
// ignore: lines_longer_than_80_chars
|
// ignore: lines_longer_than_80_chars
|
||||||
|
|||||||
@@ -144,7 +144,9 @@ class MessageReactionsModal extends StatelessWidget {
|
|||||||
attachmentShape: attachmentShape,
|
attachmentShape: attachmentShape,
|
||||||
padding: const EdgeInsets.all(0),
|
padding: const EdgeInsets.all(0),
|
||||||
attachmentBorderRadiusGeometry:
|
attachmentBorderRadiusGeometry:
|
||||||
attachmentBorderRadiusGeometry,
|
attachmentBorderRadiusGeometry
|
||||||
|
?.mirrorBorderIfReversed(
|
||||||
|
reverse: reverse),
|
||||||
attachmentPadding: EdgeInsets.all(
|
attachmentPadding: EdgeInsets.all(
|
||||||
hasFileAttachment ? 4 : 2,
|
hasFileAttachment ? 4 : 2,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import 'package:stream_chat_flutter/src/quoted_message_widget.dart';
|
|||||||
import 'package:stream_chat_flutter/src/reaction_bubble.dart';
|
import 'package:stream_chat_flutter/src/reaction_bubble.dart';
|
||||||
import 'package:stream_chat_flutter/src/url_attachment.dart';
|
import 'package:stream_chat_flutter/src/url_attachment.dart';
|
||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
|
import 'extension.dart';
|
||||||
|
|
||||||
/// Widget builder for building attachments
|
/// Widget builder for building attachments
|
||||||
typedef AttachmentBuilder = Widget Function(
|
typedef AttachmentBuilder = Widget Function(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
import 'package:stream_chat_flutter/src/extension.dart';
|
||||||
|
|
||||||
/// Launch URL
|
/// Launch URL
|
||||||
Future<void> launchURL(BuildContext context, String? url) async {
|
Future<void> launchURL(BuildContext context, String? url) async {
|
||||||
@@ -333,7 +334,7 @@ Widget wrapAttachmentWidget(
|
|||||||
BorderRadius borderRadius,
|
BorderRadius borderRadius,
|
||||||
) =>
|
) =>
|
||||||
ClipRRect(
|
ClipRRect(
|
||||||
borderRadius: borderRadius,
|
borderRadius: borderRadius.mirrorBorderIfReversed(reverse: reverse),
|
||||||
child: Material(
|
child: Material(
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
shape: attachmentShape,
|
shape: attachmentShape,
|
||||||
|
|||||||
Reference in New Issue
Block a user