2020-05-17 12:26:52 +00:00
|
|
|
import 'package:comunic/utils/ui_utils.dart';
|
2020-04-16 12:07:21 +00:00
|
|
|
|
|
|
|
/// 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) {
|
2020-05-17 12:26:52 +00:00
|
|
|
_parseCache = parseEmojies(this._string);
|
2020-04-16 12:07:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return _parseCache;
|
|
|
|
}
|
|
|
|
}
|