alignment changes
This commit is contained in:
@@ -507,13 +507,14 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
Flexible(
|
Flexible(
|
||||||
child: PortalEntry(
|
child: PortalEntry(
|
||||||
portal: Container(
|
portal: Container(
|
||||||
transform:
|
transform: Matrix4.translationValues(
|
||||||
Matrix4.translationValues(-12, 0, 0),
|
widget.reverse ? 12 : -12, 0, 0),
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxWidth: 22 * 6.0),
|
maxWidth: 22 * 6.0),
|
||||||
child: _buildReactionIndicator(context),
|
child: _buildReactionIndicator(context),
|
||||||
),
|
),
|
||||||
portalAnchor: const Alignment(-1, -1),
|
portalAnchor:
|
||||||
|
Alignment(widget.reverse ? 1 : -1, -1),
|
||||||
childAnchor:
|
childAnchor:
|
||||||
Alignment(widget.reverse ? -1 : 1, -1),
|
Alignment(widget.reverse ? -1 : 1, -1),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ class ReactionBubble extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final reactionIcons = StreamChatTheme.of(context).reactionIcons;
|
final reactionIcons = StreamChatTheme.of(context).reactionIcons;
|
||||||
final totalReactions = reactions.length;
|
final totalReactions = reactions.length;
|
||||||
final offset = totalReactions > 1 ? 16.0 : 2.0;
|
final offset =
|
||||||
|
totalReactions > 1 ? 16.0.mirrorConditionally(flipTail) : 2.0;
|
||||||
return Stack(
|
return Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
@@ -66,7 +67,7 @@ class ReactionBubble extends StatelessWidget {
|
|||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
vertical: 4,
|
vertical: 4,
|
||||||
horizontal: totalReactions > 1 ? 4 : 0,
|
horizontal: totalReactions > 1 ? 4.0 : 0,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
@@ -106,6 +107,7 @@ class ReactionBubble extends StatelessWidget {
|
|||||||
Positioned(
|
Positioned(
|
||||||
bottom: 2,
|
bottom: 2,
|
||||||
left: reverse ? null : 13,
|
left: reverse ? null : 13,
|
||||||
|
right: reverse ? 13 : null,
|
||||||
child: _buildReactionsTail(context),
|
child: _buildReactionsTail(context),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -323,3 +325,10 @@ extension YTransformer on Offset {
|
|||||||
// ignore: avoid_positional_boolean_parameters
|
// ignore: avoid_positional_boolean_parameters
|
||||||
Offset mirrorConditionally(bool flip) => Offset(flip ? -dx : dx, dy);
|
Offset mirrorConditionally(bool flip) => Offset(flip ? -dx : dx, dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Extension on [Offset]
|
||||||
|
extension IntTransformer on double {
|
||||||
|
/// Flips x coordinate when flip is true
|
||||||
|
// ignore: avoid_positional_boolean_parameters
|
||||||
|
double mirrorConditionally(bool flip) => flip ? -this : this;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user