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