diff --git a/lib/components/text_box_component.dart b/lib/components/text_box_component.dart index 24171ce39..02e9be5e8 100644 --- a/lib/components/text_box_component.dart +++ b/lib/components/text_box_component.dart @@ -46,7 +46,8 @@ class TextBoxComponent extends PositionComponent with Resizable { TextBoxConfig get boxConfig => _boxConfig; - TextBoxComponent(String text, { + TextBoxComponent( + String text, { TextConfig config, TextBoxConfig boxConfig, }) { diff --git a/lib/components/text_component.dart b/lib/components/text_component.dart index 4a7702b12..4e52ca28b 100644 --- a/lib/components/text_component.dart +++ b/lib/components/text_component.dart @@ -27,7 +27,7 @@ class TextComponent extends PositionComponent { _updateBox(); } - TextComponent(this._text, {TextConfig config }) { + TextComponent(this._text, {TextConfig config}) { _config = config ?? TextConfig(); _updateBox(); } diff --git a/lib/memory_cache.dart b/lib/memory_cache.dart index f311e7de3..dd31b6e05 100644 --- a/lib/memory_cache.dart +++ b/lib/memory_cache.dart @@ -1,12 +1,11 @@ - /// Simple class to cache values on the cache /// -class MemoryCache { +class MemoryCache { final Map _cache = {}; final List _addedOrder = []; final int cacheSize; - MemoryCache({ this.cacheSize = 10 }); + MemoryCache({this.cacheSize = 10}); void setValue(K key, V value) { if (!_cache.containsKey(key)) { diff --git a/lib/text_config.dart b/lib/text_config.dart index 268a4e8e8..088b62805 100644 --- a/lib/text_config.dart +++ b/lib/text_config.dart @@ -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(); + final MemoryCache _textPainterCache = + MemoryCache(); /// Creates a constant [TextConfig] with sensible defaults. /// @@ -98,18 +99,18 @@ class TextConfig { material.TextPainter toTextPainter(String text) { if (!_textPainterCache.containsKey(text)) { final material.TextStyle style = material.TextStyle( - color: color, - fontSize: fontSize, - fontFamily: fontFamily, + color: color, + fontSize: fontSize, + fontFamily: fontFamily, ); final material.TextSpan span = material.TextSpan( - style: style, - text: text, + style: style, + text: text, ); final material.TextPainter tp = material.TextPainter( - text: span, - textAlign: textAlign, - textDirection: textDirection, + text: span, + textAlign: textAlign, + textDirection: textDirection, ); tp.layout(); diff --git a/test/memory_cache_test.dart b/test/memory_cache_test.dart index 780ab33cc..bf4cf6473 100644 --- a/test/memory_cache_test.dart +++ b/test/memory_cache_test.dart @@ -29,4 +29,3 @@ void main() { }); }); } -