|
|
|
@ -48,63 +48,9 @@ class Message extends StatelessWidget {
|
|
|
|
|
? Colors.redAccent
|
|
|
|
|
: Theme.of(context).primaryColor;
|
|
|
|
|
}
|
|
|
|
|
List<PopupMenuEntry<String>> popupMenuList = [];
|
|
|
|
|
if (event.canRedact && !event.redacted && event.status > 1) {
|
|
|
|
|
popupMenuList.add(
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
|
value: "remove",
|
|
|
|
|
child: Text(I18n.of(context).removeMessage),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!event.redacted &&
|
|
|
|
|
[
|
|
|
|
|
MessageTypes.Text,
|
|
|
|
|
MessageTypes.Reply,
|
|
|
|
|
MessageTypes.Location,
|
|
|
|
|
MessageTypes.Notice,
|
|
|
|
|
MessageTypes.Emote,
|
|
|
|
|
MessageTypes.None,
|
|
|
|
|
].contains(event.messageType) &&
|
|
|
|
|
event.body.isNotEmpty) {
|
|
|
|
|
popupMenuList.add(
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
|
value: "copy",
|
|
|
|
|
child: Text(I18n.of(context).copy),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!event.redacted) {
|
|
|
|
|
popupMenuList.add(
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
|
value: "forward",
|
|
|
|
|
child: Text(I18n.of(context).forward),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ownMessage && event.status == -1) {
|
|
|
|
|
popupMenuList.add(
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
|
value: "resend",
|
|
|
|
|
child: Text(I18n.of(context).tryToSendAgain),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
popupMenuList.add(
|
|
|
|
|
PopupMenuItem<String>(
|
|
|
|
|
value: "delete",
|
|
|
|
|
child: Text(I18n.of(context).deleteMessage),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Widget> rowChildren = [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: longPressSelect ? null : () => onSelect(event),
|
|
|
|
|
onLongPress: !longPressSelect ? null : () => onSelect(event),
|
|
|
|
|
child: AnimatedOpacity(
|
|
|
|
|
duration: Duration(milliseconds: 500),
|
|
|
|
|
opacity: (event.status == 0 || event.redacted) ? 0.5 : 1,
|
|
|
|
@ -151,7 +97,6 @@ class Message extends StatelessWidget {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
];
|
|
|
|
|
final Widget avatarOrSizedBox = sameSender
|
|
|
|
|
? SizedBox(width: 40)
|
|
|
|
@ -171,12 +116,16 @@ class Message extends StatelessWidget {
|
|
|
|
|
rowChildren.insert(0, avatarOrSizedBox);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AnimatedContainer(
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: longPressSelect ? () => null : () => onSelect(event),
|
|
|
|
|
splashColor: Theme.of(context).primaryColor.withAlpha(100),
|
|
|
|
|
onLongPress: !longPressSelect ? null : () => onSelect(event),
|
|
|
|
|
child: AnimatedContainer(
|
|
|
|
|
duration: Duration(milliseconds: 300),
|
|
|
|
|
curve: Curves.fastOutSlowIn,
|
|
|
|
|
color: selected
|
|
|
|
|
? Theme.of(context).primaryColor.withAlpha(100)
|
|
|
|
|
: Theme.of(context).backgroundColor,
|
|
|
|
|
: Theme.of(context).primaryColor.withAlpha(0),
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
left: 8.0, right: 8.0, bottom: sameSender ? 4.0 : 8.0),
|
|
|
|
|
child: Row(
|
|
|
|
@ -184,6 +133,7 @@ class Message extends StatelessWidget {
|
|
|
|
|
mainAxisAlignment: rowMainAxisAlignment,
|
|
|
|
|
children: rowChildren,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|