chore: Follow up mark messages

pull/754/head
krille-chan 2 years ago
parent 8f66cad58b
commit bfb3fa0f30
No known key found for this signature in database

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

Loading…
Cancel
Save