@@ -3,9 +3,9 @@ import 'package:matrix/matrix.dart';
33import 'package:watch_it/watch_it.dart' ;
44
55import '../../common/chat_model.dart' ;
6- import '../../common/event_x.dart' ;
76import '../../common/view/build_context_x.dart' ;
87import '../../l10n/l10n.dart' ;
8+ import 'chat_room_last_event.dart' ;
99
1010class ChatRoomMasterTileSubTitle extends StatelessWidget with WatchItMixin {
1111 const ChatRoomMasterTileSubTitle ({super .key, required this .room});
@@ -41,46 +41,3 @@ class ChatRoomMasterTileSubTitle extends StatelessWidget with WatchItMixin {
4141 );
4242 }
4343}
44-
45- class ChatRoomLastEvent extends StatelessWidget {
46- const ChatRoomLastEvent ({required this .lastEvent, super .key});
47-
48- final Event ? lastEvent;
49-
50- @override
51- Widget build (BuildContext context) {
52- return FutureBuilder <String >(
53- key: ValueKey (
54- '${lastEvent ?.eventId }_${lastEvent ?.type }_${lastEvent ?.redacted }}' ,
55- ),
56- future: lastEvent? .calcLocalizedBody (
57- const MatrixDefaultLocalizations (),
58- hideReply: true ,
59- plaintextBody: true ,
60- withSenderNamePrefix: true ,
61- ),
62- initialData: lastEvent? .calcLocalizedBodyFallback (
63- const MatrixDefaultLocalizations (),
64- hideReply: true ,
65- plaintextBody: true ,
66- withSenderNamePrefix: true ,
67- ),
68- builder: (context, snapshot) {
69- if (snapshot.hasError) {
70- return const Text ('?' , maxLines: 1 );
71- }
72- if (lastEvent! .hideInTimeline (
73- showAvatarChanges: false ,
74- showDisplayNameChanges: false ,
75- )) {
76- return const Text ('...' , maxLines: 1 );
77- }
78- if (snapshot.hasData && lastEvent != null ) {
79- return Text (snapshot.data! , maxLines: 1 );
80- }
81-
82- return Text (context.l10n.emptyChat, maxLines: 1 );
83- },
84- );
85- }
86- }
0 commit comments