chore: Follow up mark messages

This commit is contained in:
krille-chan 2023-12-27 17:49:59 +01:00
parent 8f66cad58b
commit bfb3fa0f30
No known key found for this signature in database

View file

@ -125,6 +125,8 @@ class Message extends StatelessWidget {
final resetAnimateIn = this.resetAnimateIn;
var animateIn = this.animateIn;
TapDownDetails? lastTapDownDetails;
final row = StatefulBuilder(
builder: (context, setState) {
if (animateIn && resetAnimateIn != null) {
@ -202,6 +204,20 @@ class Message extends StatelessWidget {
Container(
alignment: alignment,
padding: const EdgeInsets.only(left: 8),
child: GestureDetector(
onTapDown: (details) {
lastTapDownDetails = details;
},
onTap: () {
if (lastTapDownDetails?.kind ==
PointerDeviceKind.mouse) {
return;
}
onSelect(event);
},
onLongPress: event.messageType == MessageTypes.Text
? null
: () => onSelect(event),
child: AnimatedOpacity(
opacity: animateIn
? 0
@ -230,8 +246,9 @@ class Message extends StatelessWidget {
),
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(AppConfig.borderRadius),
borderRadius: BorderRadius.circular(
AppConfig.borderRadius,
),
),
padding: noBubble || noPadding
? EdgeInsets.zero
@ -250,7 +267,8 @@ class Message extends StatelessWidget {
RelationshipTypes.reply)
FutureBuilder<Event?>(
future: event.getReplyEvent(timeline),
builder: (BuildContext context, snapshot) {
builder:
(BuildContext context, snapshot) {
final replyEvent = snapshot.hasData
? snapshot.data!
: Event(
@ -267,8 +285,9 @@ class Message extends StatelessWidget {
originServerTs: DateTime.now(),
);
return Padding(
padding:
const EdgeInsets.only(bottom: 4.0),
padding: const EdgeInsets.only(
bottom: 4.0,
),
child: InkWell(
borderRadius:
ReplyContent.borderRadius,
@ -324,6 +343,7 @@ class Message extends StatelessWidget {
),
),
),
),
],
),
),
@ -413,8 +433,6 @@ class Message extends StatelessWidget {
container = row;
}
TapDownDetails? lastTapDownDetails;
return Center(
child: Swipeable(
key: ValueKey(event.eventId),
@ -426,16 +444,6 @@ class Message extends StatelessWidget {
),
direction: SwipeDirection.endToStart,
onSwipe: (_) => onSwipe(),
child: GestureDetector(
onTapDown: (details) {
lastTapDownDetails = details;
},
onTap: () {
if (lastTapDownDetails?.kind == PointerDeviceKind.mouse) {
return;
}
onSelect(event);
},
child: HoverBuilder(
builder: (context, hovered) => Stack(
children: [
@ -458,12 +466,10 @@ class Message extends StatelessWidget {
.colorScheme
.background
.withOpacity(0.9),
elevation: Theme.of(context)
.appBarTheme
.scrolledUnderElevation ??
elevation:
Theme.of(context).appBarTheme.scrolledUnderElevation ??
4,
borderRadius:
BorderRadius.circular(AppConfig.borderRadius),
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
shadowColor: Theme.of(context).appBarTheme.shadowColor,
child: Row(
mainAxisSize: MainAxisSize.min,
@ -499,7 +505,6 @@ class Message extends StatelessWidget {
),
),
),
),
);
}
}