1
+ import 'package:cached_network_image/cached_network_image.dart' ;
1
2
import 'package:collection/collection.dart' ;
2
3
import 'package:flutter/gestures.dart' ;
3
4
import 'package:flutter/material.dart' ;
@@ -6,6 +7,7 @@ import 'package:flutter_svg/flutter_svg.dart';
6
7
import 'package:frosty/constants.dart' ;
7
8
import 'package:frosty/models/badges.dart' ;
8
9
import 'package:frosty/models/emotes.dart' ;
10
+ import 'package:frosty/models/user.dart' ;
9
11
import 'package:frosty/screens/channel/chat/stores/chat_assets_store.dart' ;
10
12
import 'package:frosty/screens/settings/stores/settings_store.dart' ;
11
13
import 'package:frosty/utils.dart' ;
@@ -121,6 +123,7 @@ class IRCMessage {
121
123
void Function (String )? onTapPingedUser,
122
124
bool showMessage = true ,
123
125
bool useReadableColors = false ,
126
+ Map <String , UserTwitch >? channelIdToUserTwitch,
124
127
TimestampType timestamp = TimestampType .disabled,
125
128
}) {
126
129
final isLightTheme = Theme .of (context).brightness == Brightness .light;
@@ -167,6 +170,43 @@ class IRCMessage {
167
170
}
168
171
}
169
172
173
+ final sourceChannelId = tags['source-room-id' ] ?? tags['room-id' ];
174
+ final sourceChannelUser = channelIdToUserTwitch != null
175
+ ? channelIdToUserTwitch[sourceChannelId]
176
+ : null ;
177
+ if (sourceChannelUser != null ) {
178
+ span.add (
179
+ WidgetSpan (
180
+ child: Tooltip (
181
+ triggerMode: TooltipTriggerMode .tap,
182
+ preferBelow: false ,
183
+ message: sourceChannelUser.displayName,
184
+ child: CachedNetworkImage (
185
+ imageUrl: sourceChannelUser.profileImageUrl,
186
+ imageBuilder: (context, imageProvider) => Container (
187
+ width: badgeSize,
188
+ height: badgeSize,
189
+ decoration: BoxDecoration (
190
+ shape: BoxShape .circle,
191
+ image:
192
+ DecorationImage (image: imageProvider, fit: BoxFit .cover),
193
+ ),
194
+ ),
195
+ placeholder: (context, url) => Container (
196
+ width: badgeSize,
197
+ height: badgeSize,
198
+ decoration: BoxDecoration (
199
+ shape: BoxShape .circle,
200
+ color: Colors .grey,
201
+ ),
202
+ ),
203
+ ),
204
+ ),
205
+ ),
206
+ );
207
+ span.add (const TextSpan (text: ' ' ));
208
+ }
209
+
170
210
// Indicator to skip adding the bot badges later when adding the rest of FFZ badges.
171
211
var skipBot = false ;
172
212
0 commit comments