File tree 2 files changed +27
-10
lines changed 2 files changed +27
-10
lines changed Original file line number Diff line number Diff line change @@ -177,9 +177,10 @@ class UnicodeEmojiNode extends EmojiNode {
177
177
}
178
178
179
179
class ImageEmojiNode extends EmojiNode {
180
- const ImageEmojiNode ({super .debugHtmlNode, required this .alt});
180
+ const ImageEmojiNode ({super .debugHtmlNode, required this .src, required this . alt });
181
181
182
- final String alt; // TODO parse actual emoji image URL
182
+ final String src;
183
+ final String alt;
183
184
}
184
185
185
186
////////////////////////////////////////////////////////////////
@@ -246,7 +247,9 @@ InlineContentNode parseInlineContent(dom.Node node) {
246
247
&& classes.length == 1 ) {
247
248
final alt = element.attributes['alt' ];
248
249
if (alt == null ) return unimplemented ();
249
- return ImageEmojiNode (alt: alt, debugHtmlNode: debugHtmlNode);
250
+ final src = element.attributes['src' ];
251
+ if (src == null ) return unimplemented ();
252
+ return ImageEmojiNode (src: src, alt: alt, debugHtmlNode: debugHtmlNode);
250
253
}
251
254
252
255
// TODO more types of node
Original file line number Diff line number Diff line change @@ -439,13 +439,27 @@ class MessageImageEmoji extends StatelessWidget {
439
439
440
440
@override
441
441
Widget build (BuildContext context) {
442
- // TODO show actual emoji image
443
- final alt = node.alt;
444
- return Container (
445
- padding: const EdgeInsets .all (2 ),
446
- decoration: BoxDecoration (
447
- color: Colors .white, border: Border .all (color: Colors .purple)),
448
- child: Text (alt));
442
+ final store = PerAccountStoreWidget .of (context);
443
+ final adjustedSrc = rewriteImageUrl (node.src, store.account);
444
+
445
+ const size = 20.0 ;
446
+
447
+ return Stack (
448
+ alignment: Alignment .center,
449
+ clipBehavior: Clip .none,
450
+ children: [
451
+ const SizedBox (width: size, height: kBaseFontSize),
452
+ Positioned (
453
+ // Web's css makes this seem like it should be -0.5, but that looks
454
+ // too low.
455
+ top: - 1.5 ,
456
+ child: Image .network (
457
+ adjustedSrc.toString (),
458
+ filterQuality: FilterQuality .medium,
459
+ width: size,
460
+ height: size,
461
+ )),
462
+ ]);
449
463
}
450
464
}
451
465
You can’t perform that action at this time.
0 commit comments