removed print and dartfmt
This commit is contained in:
@@ -40,13 +40,10 @@ class MessageReactionsModal extends StatelessWidget {
|
||||
var user = StreamChat.of(context).user;
|
||||
|
||||
var roughMaxSize = 2 * size.width / 3;
|
||||
var roughSentenceSize = message.text.length * messageTheme.messageText.fontSize * 1.2;
|
||||
var roughSentenceSize =
|
||||
message.text.length * messageTheme.messageText.fontSize * 1.2;
|
||||
var divFactor = roughSentenceSize / roughMaxSize;
|
||||
|
||||
print(roughMaxSize);
|
||||
print(roughSentenceSize);
|
||||
print(divFactor);
|
||||
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () {
|
||||
@@ -77,7 +74,11 @@ class MessageReactionsModal extends StatelessWidget {
|
||||
(message.status == MessageSendingStatus.SENT ||
|
||||
message.status == null))
|
||||
Align(
|
||||
alignment: Alignment(user.id == message.user.id ? (divFactor > 1.0 ? 0.0 : (1.0 - divFactor)) : (divFactor > 1.0 ? 0.0 : -(1.0 - divFactor)), 0.0),
|
||||
alignment: Alignment(
|
||||
user.id == message.user.id
|
||||
? (divFactor > 1.0 ? 0.0 : (1.0 - divFactor))
|
||||
: (divFactor > 1.0 ? 0.0 : -(1.0 - divFactor)),
|
||||
0.0),
|
||||
child: ReactionPicker(
|
||||
message: message,
|
||||
messageTheme: messageTheme,
|
||||
@@ -154,10 +155,10 @@ class MessageReactionsModal extends StatelessWidget {
|
||||
alignment: WrapAlignment.start,
|
||||
children: message.latestReactions
|
||||
.map((e) => _buildReaction(
|
||||
e,
|
||||
currentUser,
|
||||
context,
|
||||
))
|
||||
e,
|
||||
currentUser,
|
||||
context,
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
@@ -170,10 +171,10 @@ class MessageReactionsModal extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildReaction(
|
||||
Reaction reaction,
|
||||
User currentUser,
|
||||
BuildContext context,
|
||||
) {
|
||||
Reaction reaction,
|
||||
User currentUser,
|
||||
BuildContext context,
|
||||
) {
|
||||
final isCurrentUser = reaction.user.id == currentUser.id;
|
||||
return ConstrainedBox(
|
||||
constraints: BoxConstraints.loose(Size(
|
||||
|
||||
@@ -28,37 +28,37 @@ class ReactionPicker extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: reactionIcons.map((reactionIcon) {
|
||||
final ownReactionIndex = message.ownReactions?.indexWhere(
|
||||
(reaction) => reaction.type == reactionIcon.type) ??
|
||||
-1;
|
||||
return IconButton(
|
||||
iconSize: 24,
|
||||
icon: Icon(
|
||||
reactionIcon.iconData,
|
||||
color: ownReactionIndex != -1
|
||||
? StreamChatTheme.of(context).accentColor
|
||||
: Theme.of(context).iconTheme.color.withOpacity(.5),
|
||||
),
|
||||
onPressed: () {
|
||||
if (ownReactionIndex != -1) {
|
||||
removeReaction(
|
||||
context,
|
||||
message.ownReactions[ownReactionIndex],
|
||||
);
|
||||
} else {
|
||||
sendReaction(
|
||||
context,
|
||||
reactionIcon.type,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: reactionIcons.map((reactionIcon) {
|
||||
final ownReactionIndex = message.ownReactions?.indexWhere(
|
||||
(reaction) => reaction.type == reactionIcon.type) ??
|
||||
-1;
|
||||
return IconButton(
|
||||
iconSize: 24,
|
||||
icon: Icon(
|
||||
reactionIcon.iconData,
|
||||
color: ownReactionIndex != -1
|
||||
? StreamChatTheme.of(context).accentColor
|
||||
: Theme.of(context).iconTheme.color.withOpacity(.5),
|
||||
),
|
||||
onPressed: () {
|
||||
if (ownReactionIndex != -1) {
|
||||
removeReaction(
|
||||
context,
|
||||
message.ownReactions[ownReactionIndex],
|
||||
);
|
||||
} else {
|
||||
sendReaction(
|
||||
context,
|
||||
reactionIcon.type,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user