forked from Henry-Hiles/nexus
make message flash when tapping reply
This commit is contained in:
parent
0ac714f1e9
commit
a6aee7565a
5 changed files with 127 additions and 102 deletions
|
|
@ -66,6 +66,7 @@ class MessageController extends AsyncNotifier<Message?> {
|
|||
),
|
||||
).future,
|
||||
),
|
||||
"flashing": false,
|
||||
"timelineId": event.timelineRowId,
|
||||
"big": event.localContent?.bigEmoji == true,
|
||||
"eventType": type,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import "dart:async";
|
||||
|
||||
import "package:collection/collection.dart";
|
||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:flutter_chat_core/flutter_chat_core.dart";
|
||||
|
|
@ -282,6 +284,16 @@ class RoomChatController extends AsyncNotifier<InMemoryChatController> {
|
|||
|
||||
Future<void> scrollToMessage(Message message) async {
|
||||
final controller = await future;
|
||||
Future<void> setFlashing(bool flashing) => controller.updateMessage(
|
||||
message,
|
||||
message.copyWith(
|
||||
metadata: {...(message.metadata ?? {}), "flashing": flashing},
|
||||
),
|
||||
);
|
||||
|
||||
await setFlashing(true);
|
||||
Timer(Duration(seconds: 1), () => setFlashing(false));
|
||||
|
||||
return await controller.scrollToMessage(message.id);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue