mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-04 04:47:13 +08:00
linting
This commit is contained in:
@ -46,7 +46,8 @@ class TextBoxComponent extends PositionComponent with Resizable {
|
||||
|
||||
TextBoxConfig get boxConfig => _boxConfig;
|
||||
|
||||
TextBoxComponent(String text, {
|
||||
TextBoxComponent(
|
||||
String text, {
|
||||
TextConfig config,
|
||||
TextBoxConfig boxConfig,
|
||||
}) {
|
||||
|
||||
@ -27,7 +27,7 @@ class TextComponent extends PositionComponent {
|
||||
_updateBox();
|
||||
}
|
||||
|
||||
TextComponent(this._text, {TextConfig config }) {
|
||||
TextComponent(this._text, {TextConfig config}) {
|
||||
_config = config ?? TextConfig();
|
||||
_updateBox();
|
||||
}
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
|
||||
/// Simple class to cache values on the cache
|
||||
///
|
||||
class MemoryCache <K, V> {
|
||||
class MemoryCache<K, V> {
|
||||
final Map<K, V> _cache = {};
|
||||
final List<K> _addedOrder = [];
|
||||
final int cacheSize;
|
||||
|
||||
MemoryCache({ this.cacheSize = 10 });
|
||||
MemoryCache({this.cacheSize = 10});
|
||||
|
||||
void setValue(K key, V value) {
|
||||
if (!_cache.containsKey(key)) {
|
||||
|
||||
@ -53,7 +53,8 @@ class TextConfig {
|
||||
/// For proper fonts of languages like Hebrew or Arabic, replace this with [TextDirection.rtl].
|
||||
final TextDirection textDirection;
|
||||
|
||||
final MemoryCache _textPainterCache = MemoryCache<String, material.TextPainter>();
|
||||
final MemoryCache _textPainterCache =
|
||||
MemoryCache<String, material.TextPainter>();
|
||||
|
||||
/// Creates a constant [TextConfig] with sensible defaults.
|
||||
///
|
||||
|
||||
@ -29,4 +29,3 @@ void main() {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user