Splash color on select
This commit is contained in:
parent
955c2376ea
commit
5451216695
|
@ -48,63 +48,9 @@ class Message extends StatelessWidget {
|
||||||
? Colors.redAccent
|
? Colors.redAccent
|
||||||
: Theme.of(context).primaryColor;
|
: 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 = [
|
List<Widget> rowChildren = [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: InkWell(
|
|
||||||
onTap: longPressSelect ? null : () => onSelect(event),
|
|
||||||
onLongPress: !longPressSelect ? null : () => onSelect(event),
|
|
||||||
child: AnimatedOpacity(
|
child: AnimatedOpacity(
|
||||||
duration: Duration(milliseconds: 500),
|
duration: Duration(milliseconds: 500),
|
||||||
opacity: (event.status == 0 || event.redacted) ? 0.5 : 1,
|
opacity: (event.status == 0 || event.redacted) ? 0.5 : 1,
|
||||||
|
@ -151,7 +97,6 @@ class Message extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
];
|
];
|
||||||
final Widget avatarOrSizedBox = sameSender
|
final Widget avatarOrSizedBox = sameSender
|
||||||
? SizedBox(width: 40)
|
? SizedBox(width: 40)
|
||||||
|
@ -171,12 +116,16 @@ class Message extends StatelessWidget {
|
||||||
rowChildren.insert(0, avatarOrSizedBox);
|
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),
|
duration: Duration(milliseconds: 300),
|
||||||
curve: Curves.fastOutSlowIn,
|
curve: Curves.fastOutSlowIn,
|
||||||
color: selected
|
color: selected
|
||||||
? Theme.of(context).primaryColor.withAlpha(100)
|
? Theme.of(context).primaryColor.withAlpha(100)
|
||||||
: Theme.of(context).backgroundColor,
|
: Theme.of(context).primaryColor.withAlpha(0),
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
left: 8.0, right: 8.0, bottom: sameSender ? 4.0 : 8.0),
|
left: 8.0, right: 8.0, bottom: sameSender ? 4.0 : 8.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
@ -184,6 +133,7 @@ class Message extends StatelessWidget {
|
||||||
mainAxisAlignment: rowMainAxisAlignment,
|
mainAxisAlignment: rowMainAxisAlignment,
|
||||||
children: rowChildren,
|
children: rowChildren,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class App extends StatelessWidget {
|
||||||
appBarTheme: AppBarTheme(
|
appBarTheme: AppBarTheme(
|
||||||
brightness: Brightness.light,
|
brightness: Brightness.light,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
elevation: 1,
|
//elevation: 1,
|
||||||
textTheme: TextTheme(
|
textTheme: TextTheme(
|
||||||
title: TextStyle(
|
title: TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
|
|
|
@ -12,7 +12,7 @@ extension LocalizedBody on Event {
|
||||||
MessageTypes.None,
|
MessageTypes.None,
|
||||||
};
|
};
|
||||||
|
|
||||||
getLocalizedBody(BuildContext context,
|
String getLocalizedBody(BuildContext context,
|
||||||
{bool withSenderNamePrefix = false, bool hideQuotes = false}) {
|
{bool withSenderNamePrefix = false, bool hideQuotes = false}) {
|
||||||
if (this.redacted) {
|
if (this.redacted) {
|
||||||
return I18n.of(context)
|
return I18n.of(context)
|
||||||
|
@ -204,6 +204,13 @@ extension LocalizedBody on Event {
|
||||||
localizedBody = I18n.of(context).unknownEvent(this.typeKey);
|
localizedBody = I18n.of(context).unknownEvent(this.typeKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hide quotes
|
||||||
|
if (hideQuotes) {
|
||||||
|
List<String> lines = localizedBody.split("\n");
|
||||||
|
lines.removeWhere((s) => s.startsWith("> ") || s.isEmpty);
|
||||||
|
localizedBody = lines.join("\n");
|
||||||
|
}
|
||||||
|
|
||||||
// Add the sender name prefix
|
// Add the sender name prefix
|
||||||
if (withSenderNamePrefix &&
|
if (withSenderNamePrefix &&
|
||||||
this.type == EventTypes.Message &&
|
this.type == EventTypes.Message &&
|
||||||
|
@ -214,13 +221,6 @@ extension LocalizedBody on Event {
|
||||||
localizedBody = "$senderNameOrYou: $localizedBody";
|
localizedBody = "$senderNameOrYou: $localizedBody";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide quotes
|
|
||||||
if (hideQuotes) {
|
|
||||||
List<String> lines = localizedBody.split("\n");
|
|
||||||
lines.removeWhere((s) => s.startsWith("> "));
|
|
||||||
localizedBody = lines.join("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return localizedBody;
|
return localizedBody;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue