Skip to content

Commit bd41d77

Browse files
committed
Refactor _applyCustomAttributes function
1 parent 7523d96 commit bd41d77

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/src/widgets/text_line.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class TextLine extends StatelessWidget {
3737
final DefaultStyles styles;
3838
final bool readOnly;
3939
final StyleBuilder? styleBuilder;
40+
4041
@override
4142
Widget build(BuildContext context) {
4243
assert(debugCheckHasMediaQuery(context));
@@ -157,15 +158,14 @@ class TextLine extends StatelessWidget {
157158

158159
TextStyle _applyCustomAttributes(
159160
TextStyle textStyle, Map<String, Attribute> attributes) {
160-
if (styleBuilder != null) {
161-
attributes.keys
162-
.where((key) => !attributes.containsKey(key))
163-
.forEach((key) {
164-
/// Custom Attribute
165-
final customAttr = styleBuilder!.call(key);
166-
textStyle = textStyle.merge(customAttr);
167-
});
161+
if (styleBuilder == null) {
162+
return textStyle;
168163
}
164+
attributes.keys.where((key) => !attributes.containsKey(key)).forEach((key) {
165+
/// Custom Attribute
166+
final customAttr = styleBuilder!.call(key);
167+
textStyle = textStyle.merge(customAttr);
168+
});
169169
return textStyle;
170170
}
171171

0 commit comments

Comments
 (0)