Initial commit: Flutter 无书应用项目

This commit is contained in:
Developer
2026-03-30 02:35:31 +08:00
commit 9175ff9905
566 changed files with 103261 additions and 0 deletions

View File

View File

@@ -0,0 +1,114 @@
/// 时间: 2026-03-25
/// 功能: 诗词数据模型
/// 介绍: 定义诗词相关的数据结构
/// 最新变化: 新建PoetryModel支持诗词数据解析
class PoetryModel {
final int id;
final String name;
final String alias;
final String keywords;
final String introduce;
final String drtime;
final int like;
final String url;
final int tui;
final int star;
final int hitsTotal;
final int hitsMonth;
final int hitsDay;
final String date;
final String datem;
final String time;
final String createTime;
final String updateTime;
final int rank; // 排名字段
final String firstChar; // 朝代首字符
PoetryModel({
required this.id,
required this.name,
required this.alias,
required this.keywords,
required this.introduce,
required this.drtime,
required this.like,
required this.url,
required this.tui,
required this.star,
required this.hitsTotal,
required this.hitsMonth,
required this.hitsDay,
required this.date,
required this.datem,
required this.time,
required this.createTime,
required this.updateTime,
this.rank = 0, // 默认值
this.firstChar = '', // 默认值
});
factory PoetryModel.fromJson(Map<String, dynamic> json) {
return PoetryModel(
id: json['id'] ?? 0,
name: json['name'] ?? '',
alias: json['alias'] ?? '',
keywords: json['keywords'] ?? '',
introduce: json['introduce'] ?? '',
drtime: json['drtime'] ?? '',
like: json['like'] ?? 0,
url: json['url'] ?? '',
tui: json['tui'] ?? 0,
star: json['star'] ?? 0,
hitsTotal: json['hits_total'] ?? 0,
hitsMonth: json['hits_month'] ?? 0,
hitsDay: json['hits_day'] ?? 0,
date: json['date'] ?? '',
datem: json['datem'] ?? '',
time: json['time'] ?? '',
createTime: json['create_time'] ?? '',
updateTime: json['update_time'] ?? '',
rank: json['rank'] ?? 0,
firstChar: json['first_char'] ?? '',
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'alias': alias,
'keywords': keywords,
'introduce': introduce,
'drtime': drtime,
'like': like,
'url': url,
'tui': tui,
'star': star,
'hits_total': hitsTotal,
'hits_month': hitsMonth,
'hits_day': hitsDay,
'date': date,
'datem': datem,
'time': time,
'create_time': createTime,
'update_time': updateTime,
'rank': rank,
'first_char': firstChar,
};
}
@override
String toString() {
return 'PoetryModel{id: $id, name: $name, alias: $alias, rank: $rank, like: $like, hitsTotal: $hitsTotal}';
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is PoetryModel && other.id == id;
}
@override
int get hashCode => id.hashCode;
}

View File