Splash color on select
This commit is contained in:
@ -48,106 +48,51 @@ 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,
|
||||
child: Bubble(
|
||||
elevation: 0,
|
||||
radius: Radius.circular(8),
|
||||
alignment: alignment,
|
||||
margin: BubbleEdges.symmetric(horizontal: 4),
|
||||
color: color,
|
||||
nip: nip,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
ownMessage
|
||||
? I18n.of(context).you
|
||||
: event.sender.calcDisplayname(),
|
||||
style: TextStyle(
|
||||
color: ownMessage
|
||||
? textColor
|
||||
: event.sender.calcDisplayname().color,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
child: AnimatedOpacity(
|
||||
duration: Duration(milliseconds: 500),
|
||||
opacity: (event.status == 0 || event.redacted) ? 0.5 : 1,
|
||||
child: Bubble(
|
||||
elevation: 0,
|
||||
radius: Radius.circular(8),
|
||||
alignment: alignment,
|
||||
margin: BubbleEdges.symmetric(horizontal: 4),
|
||||
color: color,
|
||||
nip: nip,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
ownMessage
|
||||
? I18n.of(context).you
|
||||
: event.sender.calcDisplayname(),
|
||||
style: TextStyle(
|
||||
color: ownMessage
|
||||
? textColor
|
||||
: event.sender.calcDisplayname().color,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
event.time.localizedTime(context),
|
||||
style: TextStyle(
|
||||
color: textColor.withAlpha(180),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
Text(
|
||||
event.time.localizedTime(context),
|
||||
style: TextStyle(
|
||||
color: textColor.withAlpha(180),
|
||||
),
|
||||
],
|
||||
),
|
||||
MessageContent(
|
||||
event,
|
||||
textColor: textColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
MessageContent(
|
||||
event,
|
||||
textColor: textColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -171,18 +116,23 @@ class Message extends StatelessWidget {
|
||||
rowChildren.insert(0, avatarOrSizedBox);
|
||||
}
|
||||
|
||||
return AnimatedContainer(
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.fastOutSlowIn,
|
||||
color: selected
|
||||
? Theme.of(context).primaryColor.withAlpha(100)
|
||||
: Theme.of(context).backgroundColor,
|
||||
padding: EdgeInsets.only(
|
||||
left: 8.0, right: 8.0, bottom: sameSender ? 4.0 : 8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: rowMainAxisAlignment,
|
||||
children: rowChildren,
|
||||
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).primaryColor.withAlpha(0),
|
||||
padding: EdgeInsets.only(
|
||||
left: 8.0, right: 8.0, bottom: sameSender ? 4.0 : 8.0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: rowMainAxisAlignment,
|
||||
children: rowChildren,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user