mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-30 00:36:28 +00:00
39 lines
669 B
Dart
39 lines
669 B
Dart
import 'package:flutter_emoji/flutter_emoji.dart';
|
|
|
|
/// Optimized colons Emoji-parsed string
|
|
///
|
|
/// @author Pierre Hubert
|
|
|
|
class DisplayedString {
|
|
String _string;
|
|
String _parseCache;
|
|
|
|
DisplayedString(this._string);
|
|
|
|
int get length => _string.length;
|
|
|
|
bool get isEmpty => _string.isEmpty;
|
|
|
|
bool get isNull => _string == null;
|
|
|
|
String get content => _string;
|
|
|
|
set content(String content) {
|
|
_string = content;
|
|
_parseCache = null;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return _string;
|
|
}
|
|
|
|
String get parsedString {
|
|
if (_parseCache == null) {
|
|
_parseCache = EmojiParser().emojify(this._string);
|
|
}
|
|
|
|
return _parseCache;
|
|
}
|
|
}
|