Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit

Permalink
addressing comment
Browse files Browse the repository at this point in the history
  • Loading branch information
chunhtai committed Jan 9, 2020
1 parent b3da205 commit 81d9ea1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/ui/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2126,12 +2126,16 @@ Future<void> loadFontFromList(Uint8List list, {String fontFamily}) {
).then(_sendFontChangeMessage);
}

final ByteData _fontChangeMessage = utf8.encoder.convert(
json.encode(<String, dynamic>{'type': 'fontsChange'})
).buffer.asByteData();

FutureOr<void> _sendFontChangeMessage(void result) async {
if (window.onPlatformMessage != null)
window.onPlatformMessage(
'flutter/system',
utf8.encoder.convert(json.encode(<String, dynamic>{'type': 'fontsChange'})).buffer.asByteData(),
(_) {},
_fontChangeMessage,
(_) {},
);
}

Expand Down
4 changes: 3 additions & 1 deletion lib/web_ui/lib/src/ui/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1493,11 +1493,13 @@ Future<void> loadFontFromList(Uint8List list, {String fontFamily}) {
return _fontCollection.loadFontFromList(list, fontFamily: fontFamily).then(_sendFontChangeMessage);
}

final ByteData _fontChangeMessage = engine.JSONMessageCodec().encodeMessage(<String, dynamic>{'type': 'fontsChange'});

FutureOr<void> _sendFontChangeMessage(void result) async {
if (window.onPlatformMessage != null)
window.onPlatformMessage(
'flutter/system',
engine.JSONMessageCodec().encodeMessage(<String, dynamic>{'type': 'fontsChange'}),
_fontChangeMessage,
(_) {},
);
}

0 comments on commit 81d9ea1

Please sign in to comment.