Skip to content

Commit fadf61a

Browse files
angelosilvestrematthew-carroll
authored andcommitted
[SuperEditor][SuperReader] Fix list item styling without stylesheet (Resolves #2224) (#2227)
1 parent 008e077 commit fadf61a

16 files changed

+197
-32
lines changed

super_editor/lib/src/default_editor/list_items.dart

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,15 @@ class UnorderedListItemComponentViewModel extends ListItemComponentViewModel {
294294
super.spellingErrors,
295295
});
296296

297-
ListItemDotStyle dotStyle = const ListItemDotStyle();
297+
ListItemDotStyle dotStyle;
298298

299299
@override
300300
void applyStyles(Map<String, dynamic> styles) {
301301
super.applyStyles(styles);
302-
dotStyle = ListItemDotStyle(
302+
dotStyle = dotStyle.copyWith(
303303
color: styles[Styles.dotColor],
304-
shape: styles[Styles.dotShape] ?? BoxShape.circle,
305-
size: styles[Styles.dotSize] ?? const Size(4, 4),
304+
shape: styles[Styles.dotShape],
305+
size: styles[Styles.dotSize],
306306
);
307307
}
308308

@@ -365,7 +365,7 @@ class OrderedListItemComponentViewModel extends ListItemComponentViewModel {
365365
@override
366366
void applyStyles(Map<String, dynamic> styles) {
367367
super.applyStyles(styles);
368-
numeralStyle = styles[Styles.listNumeralStyle] ?? OrderedListNumeralStyle.arabic;
368+
numeralStyle = styles[Styles.listNumeralStyle] ?? numeralStyle;
369369
}
370370

371371
@override
@@ -413,6 +413,20 @@ class ListItemDotStyle {
413413
final BoxShape shape;
414414
final Size size;
415415

416+
/// Returns a copy of this [ListItemDotStyle] with optional new values
417+
/// for [color], [shape], and [size].
418+
ListItemDotStyle copyWith({
419+
Color? color,
420+
BoxShape? shape,
421+
Size? size,
422+
}) {
423+
return ListItemDotStyle(
424+
color: color ?? this.color,
425+
shape: shape ?? this.shape,
426+
size: size ?? this.size,
427+
);
428+
}
429+
416430
@override
417431
bool operator ==(Object other) =>
418432
identical(this, other) ||
62.5 KB
Loading
63.2 KB
Loading
61.6 KB
Loading
64.1 KB
Loading

0 commit comments

Comments
 (0)