mod: article: show list

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-27 11:20:34 +08:00
parent 3dad24e7b4
commit dc1cca0d4c
6 changed files with 209 additions and 71 deletions

View File

@@ -1,3 +1,4 @@
import 'node.dart';
import 'pic.dart';
import 'text.dart';
@@ -9,6 +10,7 @@ class Paragraph {
Line? line;
LinkCard? linkCard;
Code? code;
L1st? list;
Paragraph({
this.align,
@@ -18,6 +20,7 @@ class Paragraph {
this.line,
this.linkCard,
this.code,
this.list,
});
factory Paragraph.fromJson(Map<String, dynamic> json) => Paragraph(
@@ -34,6 +37,7 @@ class Paragraph {
? null
: LinkCard.fromJson(json['link_card']),
code: json['code'] == null ? null : Code.fromJson(json['code']),
list: json['list'] == null ? null : L1st.fromJson(json['list']),
);
Map<String, dynamic> toJson() => {
@@ -44,6 +48,28 @@ class Paragraph {
};
}
class L1st {
List<Item>? items;
int? style;
L1st.fromJson(Map<String, dynamic> json) {
items = (json['items'] as List?)?.map((e) => Item.fromJson(e)).toList();
style = json['style'];
}
}
class Item {
int? level;
int? order;
List<Node>? nodes;
Item.fromJson(Map<String, dynamic> json) {
level = json['level'];
order = json['order'];
nodes = (json['nodes'] as List?)?.map((e) => Node.fromJson(e)).toList();
}
}
class Code {
String? content;
String? lang;

View File

@@ -5,8 +5,15 @@ class Word {
double? fontSize;
Style? style;
String? words;
String? fontLevel;
Word({this.color, this.fontSize, this.style, this.words});
Word({
this.color,
this.fontSize,
this.style,
this.words,
this.fontLevel,
});
factory Word.fromJson(Map<String, dynamic> json) => Word(
color: json['color'] == null
@@ -17,6 +24,7 @@ class Word {
? null
: Style.fromJson(json['style'] as Map<String, dynamic>),
words: json['words'] as String?,
fontLevel: json['font_level'] as String?,
);
Map<String, dynamic> toJson() => {
@@ -24,5 +32,6 @@ class Word {
'font_size': fontSize,
'style': style?.toJson(),
'words': words,
'font_level': fontLevel,
};
}