rename FlashWrapper to HighlightWrapper

This commit is contained in:
Henry Hiles 2026-06-08 11:03:34 -04:00
commit e15d947fac
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 13 additions and 13 deletions

View file

@ -1,16 +1,16 @@
import "package:flutter/material.dart"; import "package:flutter/material.dart";
class FlashWrapper extends StatelessWidget { class HighlightWrapper extends StatelessWidget {
final Widget child; final Widget child;
final bool isFlashing; final bool isHighlighted;
const FlashWrapper(this.child, {this.isFlashing = false, super.key}); const HighlightWrapper(this.child, {this.isHighlighted = false, super.key});
@override @override
Widget build(BuildContext context) => ClipRRect( Widget build(BuildContext context) => ClipRRect(
borderRadius: .all(.circular(12)), borderRadius: .all(.circular(12)),
child: AnimatedContainer( child: AnimatedContainer(
padding: isFlashing ? .all(8) : .all(0), padding: isHighlighted ? .all(8) : .all(0),
color: isFlashing color: isHighlighted
? Theme.of(context).colorScheme.onSurface.withAlpha(50) ? Theme.of(context).colorScheme.onSurface.withAlpha(50)
: Colors.transparent, : Colors.transparent,
duration: .new(milliseconds: 250), duration: .new(milliseconds: 250),

View file

@ -20,7 +20,7 @@ import "package:nexus/widgets/emoji_picker_button.dart";
import "package:nexus/widgets/renderers/event.dart"; import "package:nexus/widgets/renderers/event.dart";
import "package:nexus/widgets/member_list.dart"; import "package:nexus/widgets/member_list.dart";
import "package:nexus/widgets/room_appbar.dart"; import "package:nexus/widgets/room_appbar.dart";
import "package:nexus/widgets/flash_wrapper.dart"; import "package:nexus/widgets/highlight_wrapper.dart";
import "package:nexus/widgets/error_dialog.dart"; import "package:nexus/widgets/error_dialog.dart";
import "package:nexus/main.dart"; import "package:nexus/main.dart";
import "package:nexus/widgets/loading.dart"; import "package:nexus/widgets/loading.dart";
@ -41,7 +41,7 @@ class RoomChat extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final relatedEvent = useState<Event?>(null); final relatedEvent = useState<Event?>(null);
final relationType = useState(RelationType.reply); final relationType = useState(RelationType.reply);
final flashingEvent = useState<String?>(null); final highlightedEvent = useState<String?>(null);
final composerSize = useState<double>(64); final composerSize = useState<double>(64);
@ -426,7 +426,7 @@ class RoomChat extends HookConsumerWidget {
itemBuilder: (_, index) { itemBuilder: (_, index) {
final event = value[index]; final event = value[index];
final previousEvent = value.getOrNull(index - 1); final previousEvent = value.getOrNull(index - 1);
return FlashWrapper( return HighlightWrapper(
EventRenderer( EventRenderer(
event, event,
onTapReply: () async { onTapReply: () async {
@ -440,10 +440,10 @@ class RoomChat extends HookConsumerWidget {
duration: (_) => .new(milliseconds: 700), duration: (_) => .new(milliseconds: 700),
curve: (_) => Curves.easeInOut, curve: (_) => Curves.easeInOut,
); );
flashingEvent.value = replyId; highlightedEvent.value = replyId;
await Future.delayed(.new(seconds: 1), () { await Future.delayed(.new(seconds: 1), () {
if (flashingEvent.value == replyId) { if (highlightedEvent.value == replyId) {
flashingEvent.value = null; highlightedEvent.value = null;
} }
}); });
}, },
@ -457,8 +457,8 @@ class RoomChat extends HookConsumerWidget {
"${event.sender}${event.pmp?.id}" == "${event.sender}${event.pmp?.id}" ==
"${previousEvent?.sender}${previousEvent?.pmp?.id}", "${previousEvent?.sender}${previousEvent?.pmp?.id}",
), ),
isFlashing: isHighlighted:
flashingEvent.value == event.eventId, highlightedEvent.value == event.eventId,
); );
}, },
), ),