feature: 完整诗词应用
This commit is contained in:
parent
4ecf4be446
commit
f1388d6d62
58
README.md
58
README.md
|
|
@ -1,16 +1,48 @@
|
|||
# flutter_samples
|
||||
|
||||
A new Flutter project.
|
||||
## 项目目录结构
|
||||
```yaml
|
||||
lib
|
||||
- components # 组件
|
||||
- helpers
|
||||
- constants # 常量
|
||||
- api.dart # 请求地址常量
|
||||
- index.dart # 常量
|
||||
- route.dart # 路由常量
|
||||
- config.dart # 环境配置
|
||||
- dio.dart # http函数
|
||||
- log.dart # 日志函数
|
||||
- logics # 逻辑
|
||||
- adapters # 数据格式化
|
||||
- entities # 数据序列化定义
|
||||
- api # 接口字段定义
|
||||
- page # 本地字段定义
|
||||
- state # 状态字段定义
|
||||
- models # 数据
|
||||
- poetry # 请求诗词数据
|
||||
- services # 业务逻辑(view-model)
|
||||
- poetry_list.dart # 首页数据和逻辑
|
||||
- poetry_detail.dart # 诗词详情页数据和逻辑
|
||||
- router # 路由配置
|
||||
- router.dart
|
||||
- styles # 样式
|
||||
- colors # 颜色
|
||||
- styles # 文字样式
|
||||
- ui # UI界面
|
||||
- home.dart # 首页/诗词列表页
|
||||
- poetry_detail.dart # 诗词详情页
|
||||
- utils # 工具函数
|
||||
main.dart # 入口文件
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
## 常用命令
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
```bash
|
||||
# 生成代码
|
||||
$ dart run build_runner build
|
||||
# 运行h5
|
||||
$ flutter run -d chrome --web-browser-flag "--disable-web-security" --dart-define=APP_ENV=development
|
||||
# ios生成环境打包
|
||||
$ flutter build ipa --dart-define=APP_ENV=production
|
||||
# android生产环境打包
|
||||
$ flutter build apk --dart-define=APP_ENV=production
|
||||
```
|
||||
|
|
@ -26,3 +26,7 @@ linter:
|
|||
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
|
||||
analyzer:
|
||||
errors:
|
||||
invalid_annotation_target: ignore
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "Generated.xcconfig"
|
||||
|
|
|
|||
43
ios/Podfile
Normal file
43
ios/Podfile
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '12.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_ios_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
|
||||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||
target 'RunnerTests' do
|
||||
inherit! :search_paths
|
||||
end
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_ios_build_settings(target)
|
||||
end
|
||||
end
|
||||
61
lib/components/PoetryCard.dart
Normal file
61
lib/components/PoetryCard.dart
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_samples/logics/entities/page/poetry.dart';
|
||||
import 'package:flutter_samples/main.dart';
|
||||
|
||||
typedef ClickCallback = void Function();
|
||||
|
||||
class Poetrycard extends StatelessWidget {
|
||||
final Poetry poetry;
|
||||
final ClickCallback? onClick;
|
||||
const Poetrycard({super.key, required this.poetry, this.onClick});
|
||||
|
||||
void _tapPoetry() {
|
||||
onClick?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
color: $styles.colors.white,
|
||||
border: Border(
|
||||
bottom: BorderSide(color: $styles.colors.borderColor, width: 0.5),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
poetry.authorAvatar.isNotEmpty
|
||||
? CircleAvatar(
|
||||
backgroundColor: $styles.colors.bgColor,
|
||||
backgroundImage: NetworkImage(poetry.authorAvatar),
|
||||
radius: 20,
|
||||
)
|
||||
: CircleAvatar(
|
||||
backgroundColor: $styles.colors.bgColor,
|
||||
radius: 20,
|
||||
child: const Icon(Icons.person, color: Colors.white),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Text(poetry.authorName, style: $styles.normalText),
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: _tapPoetry,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 10),
|
||||
Text(poetry.title, style: $styles.grayText),
|
||||
SizedBox(height: 10),
|
||||
Text(poetry.content, style: $styles.normalText),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
16
lib/helpers/config.dart
Normal file
16
lib/helpers/config.dart
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
class AppConfig {
|
||||
static const String environment = String.fromEnvironment(
|
||||
'APP_ENV',
|
||||
defaultValue: 'development',
|
||||
);
|
||||
static String get baseUrl {
|
||||
switch (environment) {
|
||||
case 'development':
|
||||
return 'http://127.0.0.1:7002';
|
||||
case 'production':
|
||||
return 'https://your-production.com';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
4
lib/helpers/constants/api.dart
Normal file
4
lib/helpers/constants/api.dart
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
class ReqUrl {
|
||||
static const String getPoetryList = '/v1/poetry/list';
|
||||
static const String getPoetryDetail = '/v1/poetry/detail';
|
||||
}
|
||||
14
lib/helpers/constants/index.dart
Normal file
14
lib/helpers/constants/index.dart
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import 'package:flutter_samples/logics/entities/page/page_list.dart';
|
||||
import 'package:flutter_samples/logics/entities/page/poetry.dart';
|
||||
|
||||
const isMockRequest = true;
|
||||
const emptyPoetry = Poetry();
|
||||
const emptyPoetryList = PageList<Poetry>(
|
||||
cursor: '',
|
||||
page: 1,
|
||||
size: 10,
|
||||
total: 0,
|
||||
list: [],
|
||||
loadAll: false,
|
||||
loading: false,
|
||||
);
|
||||
4
lib/helpers/constants/route.dart
Normal file
4
lib/helpers/constants/route.dart
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
class Routes {
|
||||
static const home = '/home';
|
||||
static const poetry = '/poetry';
|
||||
}
|
||||
67
lib/helpers/dio.dart
Normal file
67
lib/helpers/dio.dart
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_samples/helpers/config.dart';
|
||||
import 'package:flutter_samples/helpers/constants/index.dart';
|
||||
import 'package:flutter_samples/helpers/dio_mock.dart';
|
||||
|
||||
final dio = Dio(BaseOptions(baseUrl: AppConfig.baseUrl));
|
||||
|
||||
class DioInterceptors extends Interceptor {
|
||||
@override
|
||||
Future onRequest(
|
||||
RequestOptions options,
|
||||
RequestInterceptorHandler handler,
|
||||
) async {
|
||||
// TODO 处理token
|
||||
String? token = "";
|
||||
options.headers['Authorization'] = token.isNotEmpty ? 'Bearer $token' : '';
|
||||
options.headers['Content-Type'] = 'application/json';
|
||||
super.onRequest(options, handler);
|
||||
}
|
||||
|
||||
@override
|
||||
void onResponse(Response response, ResponseInterceptorHandler handler) {
|
||||
super.onResponse(response, handler);
|
||||
}
|
||||
|
||||
@override
|
||||
Future onError(DioException err, ErrorInterceptorHandler handler) async {
|
||||
final statusCode = err.response?.statusCode;
|
||||
switch (statusCode) {
|
||||
case 401:
|
||||
// TODO 处理token过期
|
||||
break;
|
||||
default:
|
||||
}
|
||||
super.onError(err, handler);
|
||||
}
|
||||
}
|
||||
|
||||
class MockInterceptor extends Interceptor {
|
||||
@override
|
||||
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
||||
final path = options.path;
|
||||
if (mockData.containsKey(path)) {
|
||||
Future.delayed(Duration(milliseconds: 300)).then((_) {
|
||||
handler.resolve(
|
||||
Response(
|
||||
requestOptions: options,
|
||||
statusCode: 200,
|
||||
data: mockData[path],
|
||||
),
|
||||
);
|
||||
});
|
||||
} else {
|
||||
super.onRequest(options, handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DioRequest {
|
||||
static Future post(String url, Map<String, dynamic> params) async {
|
||||
dio.interceptors.add(DioInterceptors());
|
||||
if (isMockRequest) {
|
||||
dio.interceptors.add(MockInterceptor());
|
||||
}
|
||||
return await dio.post(url, data: params);
|
||||
}
|
||||
}
|
||||
245
lib/helpers/dio_mock.dart
Normal file
245
lib/helpers/dio_mock.dart
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
import 'package:flutter_samples/helpers/constants/api.dart';
|
||||
|
||||
final Map<String, dynamic> mockData = {
|
||||
ReqUrl.getPoetryList: {
|
||||
"last": 7395,
|
||||
"list": [
|
||||
{
|
||||
"id": 508,
|
||||
"title": "帝京篇十首",
|
||||
"content":
|
||||
"秦川雄帝宅,函谷壮皇居。绮殿千寻起,离宫百雉馀。 连薨遥接汉,飞观迥凌虚。云日隐层阙,风烟出绮疏。 岩廊罢机务,崇文聊驻辇。玉匣启龙图,金绳披凤篆。 韦编断仍续,缥帙舒还卷。对此乃淹留,欹案观坟典。 移步出词林,停舆欣武宴。雕弓写明月,骏马疑流电。 惊雁落虚弦,啼猿悲急箭。阅赏诚多美,于兹乃忘倦。 鸣笳临乐馆,眺听欢芳节。急管韵朱弦,清歌凝白雪。 彩凤肃来仪,玄鹤纷成列。去兹郑卫声,雅音方可悦。 芳辰追逸趣,禁苑信多奇。桥形通汉上,峰势接云危。 烟霞交隐映,花鸟自参差。何如肆辙迹,万里赏瑶池。 飞盖去芳园,兰桡游翠渚。萍间日彩乱,荷处香风举。 桂楫满中川,弦歌振长屿。岂必汾河曲,方为欢宴所。 落日双阙昏,回舆九重暮。长烟散初碧,皎月澄轻素。 搴幌玩琴书,开轩引云雾。斜汉耿层阁,清风摇玉树。 欢乐难再逢,芳辰良可惜。玉酒泛云罍,兰殽陈绮席。 千钟合尧禹,百兽谐金石。得志重寸阴,忘怀轻尺璧。 建章欢赏夕,二八尽妖妍。罗绮昭阳殿,芬芳玳瑁筵。 佩移星正动,扇掩月初圆。无劳上悬圃,即此对神仙。 以兹游观极,悠然独长想。披卷览前踪,抚躬寻既往。 望古茅茨约,瞻今兰殿广。人道恶高危,虚心戒盈荡。 奉天竭诚敬,临民思惠养。纳善察忠谏,明科慎刑赏。 六五诚难继,四三非易仰。广待淳化敷,方嗣云亭响。",
|
||||
"author_id": 165,
|
||||
"author_name": "李世民",
|
||||
"author_avatar": "",
|
||||
"author_bio": "",
|
||||
"dynasty_id": 6,
|
||||
"dynasty_name": "唐代",
|
||||
"favor_num": 0,
|
||||
"share_num": 0,
|
||||
"comment_num": 0,
|
||||
"collect_num": 0,
|
||||
"seal_num": 0,
|
||||
"honor_points": 0,
|
||||
"version": 0,
|
||||
"deleted": false,
|
||||
"favored": false,
|
||||
},
|
||||
{
|
||||
"id": 509,
|
||||
"title": "饮马长城窟行",
|
||||
"content":
|
||||
"塞外悲风切,交河冰已结。瀚海百重波,阴山千里雪。迥戍危烽火,层峦引高节。悠悠卷旆旌,饮马出长城。寒沙连骑迹,朔吹断边声。胡尘清玉塞,羌笛韵金钲。绝漠干戈戢,车徒振原隰。都尉反龙堆,将军旋马邑。扬麾氛雾静,纪石功名立。荒裔一戎衣,灵台凯歌入。",
|
||||
"author_id": 165,
|
||||
"author_name": "李世民",
|
||||
"author_avatar": "",
|
||||
"author_bio": "",
|
||||
"dynasty_id": 6,
|
||||
"dynasty_name": "唐代",
|
||||
"favor_num": 0,
|
||||
"share_num": 0,
|
||||
"comment_num": 0,
|
||||
"collect_num": 0,
|
||||
"seal_num": 0,
|
||||
"honor_points": 0,
|
||||
"version": 0,
|
||||
"deleted": false,
|
||||
"favored": false,
|
||||
},
|
||||
{
|
||||
"id": 510,
|
||||
"title": "执契静三边",
|
||||
"content":
|
||||
"执契静三边,持衡临万姓。玉彩辉关烛,金华流日镜。 无为宇宙清,有美璇玑正。皎佩星连景,飘衣云结庆。 戢武耀七德,升文辉九功。烟波澄旧碧,尘火息前红。 霜野韬莲剑,关城罢月弓。钱缀榆天合,新城柳塞空。 花销葱岭雪,縠尽流沙雾。秋驾转兢怀,春冰弥轸虑。 书绝龙庭羽,烽休凤穴戍。衣宵寝二难,食旰餐三惧。 翦暴兴先废,除凶存昔亡。圆盖归天壤,方舆入地荒。 孔海池京邑,双河沼帝乡。循躬思励己,抚俗愧时康。 元首伫盐梅,股肱惟辅弼。羽贤崆岭四,翼圣襄城七。 浇俗庶反淳,替文聊就质。已知隆至道,共欢区宇一。",
|
||||
"author_id": 165,
|
||||
"author_name": "李世民",
|
||||
"author_avatar": "",
|
||||
"author_bio": "",
|
||||
"dynasty_id": 6,
|
||||
"dynasty_name": "唐代",
|
||||
"favor_num": 0,
|
||||
"share_num": 0,
|
||||
"comment_num": 0,
|
||||
"collect_num": 0,
|
||||
"seal_num": 0,
|
||||
"honor_points": 0,
|
||||
"version": 0,
|
||||
"deleted": false,
|
||||
"favored": false,
|
||||
},
|
||||
{
|
||||
"id": 511,
|
||||
"title": "正日临朝",
|
||||
"content":
|
||||
"条风开献节,灰律动初阳。百蛮奉遐赆,万国朝未央。 虽无舜禹迹,幸欣天地康。车轨同八表,书文混四方。 赫奕俨冠盖,纷纶盛服章。羽旄飞驰道,钟鼓震岩廊。 组练辉霞色,霜戟耀朝光。晨宵怀至理,终愧抚遐荒。",
|
||||
"author_id": 165,
|
||||
"author_name": "李世民",
|
||||
"author_avatar": "",
|
||||
"author_bio": "",
|
||||
"dynasty_id": 6,
|
||||
"dynasty_name": "唐代",
|
||||
"favor_num": 0,
|
||||
"share_num": 0,
|
||||
"comment_num": 0,
|
||||
"collect_num": 0,
|
||||
"seal_num": 0,
|
||||
"honor_points": 0,
|
||||
"version": 0,
|
||||
"deleted": false,
|
||||
"favored": false,
|
||||
},
|
||||
{
|
||||
"id": 512,
|
||||
"title": "幸武功庆善宫",
|
||||
"content":
|
||||
"寿丘惟旧迹,酆邑乃前基。粤予承累圣,悬弧亦在兹。 弱龄逢运改,提剑郁匡时。指麾八荒定,怀柔万国夷。 梯山咸入款,驾海亦来思。单于陪武帐,日逐卫文lq. 端扆朝四岳,无为任百司。霜节明秋景,轻冰结水湄。 芸黄遍原隰,禾颖积京畿。共乐还乡宴,欢比大风诗。",
|
||||
"author_id": 165,
|
||||
"author_name": "李世民",
|
||||
"author_avatar": "",
|
||||
"author_bio": "",
|
||||
"dynasty_id": 6,
|
||||
"dynasty_name": "唐代",
|
||||
"favor_num": 0,
|
||||
"share_num": 0,
|
||||
"comment_num": 0,
|
||||
"collect_num": 0,
|
||||
"seal_num": 0,
|
||||
"honor_points": 0,
|
||||
"version": 0,
|
||||
"deleted": false,
|
||||
"favored": false,
|
||||
},
|
||||
{
|
||||
"id": 513,
|
||||
"title": "重幸武功",
|
||||
"content":
|
||||
"代马依朔吹,惊禽愁昔丛。况兹承眷德,怀旧感深衷。 积善忻馀庆,畅武悦成功。垂衣天下治,端拱车书同。 白水巡前迹,丹陵幸旧宫。列筵欢故老,高宴聚新丰。 驻跸抚田畯,回舆访牧童。瑞气萦丹阙,祥烟散碧空。 孤屿含霜白,遥山带日红。于焉欢击筑,聊以咏南风。",
|
||||
"author_id": 165,
|
||||
"author_name": "李世民",
|
||||
"author_avatar": "",
|
||||
"author_bio": "",
|
||||
"dynasty_id": 6,
|
||||
"dynasty_name": "唐代",
|
||||
"favor_num": 0,
|
||||
"share_num": 0,
|
||||
"comment_num": 0,
|
||||
"collect_num": 0,
|
||||
"seal_num": 0,
|
||||
"honor_points": 0,
|
||||
"version": 0,
|
||||
"deleted": false,
|
||||
"favored": false,
|
||||
},
|
||||
{
|
||||
"id": 514,
|
||||
"title": "经破薛举战地",
|
||||
"content":
|
||||
"昔年怀壮气,提戈初仗节。心随朗日高,志与秋霜洁。 移锋惊电起,转战长河决。营碎落星沉,阵卷横云裂。 一挥氛沴静,再举鲸鲵灭。于兹俯旧原,属目驻华轩。 沉沙无故迹,减灶有残痕。浪霞穿水净,峰雾抱莲昏。 世途亟流易,人事殊今昔。长想眺前踪,抚躬聊自适。",
|
||||
"author_id": 165,
|
||||
"author_name": "李世民",
|
||||
"author_avatar": "",
|
||||
"author_bio": "",
|
||||
"dynasty_id": 6,
|
||||
"dynasty_name": "唐代",
|
||||
"favor_num": 0,
|
||||
"share_num": 0,
|
||||
"comment_num": 0,
|
||||
"collect_num": 0,
|
||||
"seal_num": 0,
|
||||
"honor_points": 0,
|
||||
"version": 0,
|
||||
"deleted": false,
|
||||
"favored": false,
|
||||
},
|
||||
{
|
||||
"id": 515,
|
||||
"title": "过旧宅二首",
|
||||
"content":
|
||||
"新丰停翠辇,谯邑驻鸣笳。园荒一径断,苔古半阶斜。 前池消旧水,昔树发今花。一朝辞此地,四海遂为家。 金舆巡白水,玉辇驻新丰。纽落藤披架,花残菊破丛。 叶铺荒草蔓,流竭半池空。纫珮兰凋径,舒圭叶翦桐。 昔地一蕃内,今宅九围中。架海波澄镜,韬戈器反农。 八表文同轨,无劳歌大风。",
|
||||
"author_id": 165,
|
||||
"author_name": "李世民",
|
||||
"author_avatar": "",
|
||||
"author_bio": "",
|
||||
"dynasty_id": 6,
|
||||
"dynasty_name": "唐代",
|
||||
"favor_num": 0,
|
||||
"share_num": 0,
|
||||
"comment_num": 0,
|
||||
"collect_num": 0,
|
||||
"seal_num": 0,
|
||||
"honor_points": 0,
|
||||
"version": 0,
|
||||
"deleted": false,
|
||||
"favored": false,
|
||||
},
|
||||
{
|
||||
"id": 516,
|
||||
"title": "还陕述怀",
|
||||
"content":
|
||||
"慨然抚长剑,济世岂邀名。星旂纷电举,日羽肃天行。 遍野屯万骑,临原驻五营。登山麾武节,背水纵神兵。 在昔戎戈动,今来宇宙平。",
|
||||
"author_id": 165,
|
||||
"author_name": "李世民",
|
||||
"author_avatar": "",
|
||||
"author_bio": "",
|
||||
"dynasty_id": 6,
|
||||
"dynasty_name": "唐代",
|
||||
"favor_num": 0,
|
||||
"share_num": 0,
|
||||
"comment_num": 0,
|
||||
"collect_num": 0,
|
||||
"seal_num": 0,
|
||||
"honor_points": 0,
|
||||
"version": 0,
|
||||
"deleted": false,
|
||||
"favored": false,
|
||||
},
|
||||
{
|
||||
"id": 517,
|
||||
"title": "入潼关",
|
||||
"content":
|
||||
"崤函称地险,襟带壮两京。霜峰直临道,冰河曲绕城。 古木参差影,寒猿断续声。冠盖往来合,风尘朝夕惊。 高谈先马度,伪晓预鸡鸣。弃繻怀远志,封泥负壮情。 别有真人气,安知名不名。",
|
||||
"author_id": 165,
|
||||
"author_name": "李世民",
|
||||
"author_avatar": "",
|
||||
"author_bio": "",
|
||||
"dynasty_id": 6,
|
||||
"dynasty_name": "唐代",
|
||||
"favor_num": 0,
|
||||
"share_num": 0,
|
||||
"comment_num": 0,
|
||||
"collect_num": 0,
|
||||
"seal_num": 0,
|
||||
"honor_points": 0,
|
||||
"version": 0,
|
||||
"deleted": false,
|
||||
"favored": false,
|
||||
},
|
||||
],
|
||||
"page": 1,
|
||||
"size": 10,
|
||||
"total": 73942,
|
||||
},
|
||||
ReqUrl.getPoetryDetail: {
|
||||
"poetry": {
|
||||
"id": 508,
|
||||
"title": "帝京篇十首",
|
||||
"content":
|
||||
"秦川雄帝宅,函谷壮皇居。绮殿千寻起,离宫百雉馀。 连薨遥接汉,飞观迥凌虚。云日隐层阙,风烟出绮疏。 岩廊罢机务,崇文聊驻辇。玉匣启龙图,金绳披凤篆。 韦编断仍续,缥帙舒还卷。对此乃淹留,欹案观坟典。 移步出词林,停舆欣武宴。雕弓写明月,骏马疑流电。 惊雁落虚弦,啼猿悲急箭。阅赏诚多美,于兹乃忘倦。 鸣笳临乐馆,眺听欢芳节。急管韵朱弦,清歌凝白雪。 彩凤肃来仪,玄鹤纷成列。去兹郑卫声,雅音方可悦。 芳辰追逸趣,禁苑信多奇。桥形通汉上,峰势接云危。 烟霞交隐映,花鸟自参差。何如肆辙迹,万里赏瑶池。 飞盖去芳园,兰桡游翠渚。萍间日彩乱,荷处香风举。 桂楫满中川,弦歌振长屿。岂必汾河曲,方为欢宴所。 落日双阙昏,回舆九重暮。长烟散初碧,皎月澄轻素。 搴幌玩琴书,开轩引云雾。斜汉耿层阁,清风摇玉树。 欢乐难再逢,芳辰良可惜。玉酒泛云罍,兰殽陈绮席。 千钟合尧禹,百兽谐金石。得志重寸阴,忘怀轻尺璧。 建章欢赏夕,二八尽妖妍。罗绮昭阳殿,芬芳玳瑁筵。 佩移星正动,扇掩月初圆。无劳上悬圃,即此对神仙。 以兹游观极,悠然独长想。披卷览前踪,抚躬寻既往。 望古茅茨约,瞻今兰殿广。人道恶高危,虚心戒盈荡。 奉天竭诚敬,临民思惠养。纳善察忠谏,明科慎刑赏。 六五诚难继,四三非易仰。广待淳化敷,方嗣云亭响。",
|
||||
"author_id": 165,
|
||||
"author_name": "李世民",
|
||||
"author_avatar": "",
|
||||
"author_bio": "",
|
||||
"dynasty_id": 6,
|
||||
"dynasty_name": "唐代",
|
||||
"favor_num": 0,
|
||||
"share_num": 0,
|
||||
"comment_num": 0,
|
||||
"collect_num": 0,
|
||||
"seal_num": 0,
|
||||
"honor_points": 0,
|
||||
"version": 0,
|
||||
"deleted": false,
|
||||
"favored": false,
|
||||
},
|
||||
},
|
||||
};
|
||||
3
lib/helpers/log.dart
Normal file
3
lib/helpers/log.dart
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import 'package:logging/logging.dart';
|
||||
|
||||
final console = Logger("@leonmin");
|
||||
29
lib/logics/adapters/poetry.dart
Normal file
29
lib/logics/adapters/poetry.dart
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import 'package:flutter_samples/logics/entities/api/api_poetry.dart';
|
||||
import 'package:flutter_samples/logics/entities/page/poetry.dart';
|
||||
|
||||
class PoetryAdapter {
|
||||
// 格式化诗词数据(将ApiPoetry转换为Poetry)
|
||||
// 真实开发这里会处理成需要的格式, 这里仅仅是一个示例
|
||||
static Poetry fromAPIPoetryToPoetry(ApiPoetry v) {
|
||||
return Poetry(
|
||||
id: v.id,
|
||||
title: v.title,
|
||||
content: v.content,
|
||||
authorId: v.authorId,
|
||||
authorName: v.authorName,
|
||||
authorAvatar: v.authorAvatar,
|
||||
authorBio: v.authorBio,
|
||||
dynastyId: v.dynastyId,
|
||||
dynastyName: v.dynastyName,
|
||||
favorNum: v.favorNum,
|
||||
shareNum: v.shareNum,
|
||||
commentNum: v.commentNum,
|
||||
collectNum: v.collectNum,
|
||||
sealNum: v.sealNum,
|
||||
honorPoints: v.honorPoints,
|
||||
version: v.version,
|
||||
deleted: v.deleted,
|
||||
favored: v.favored,
|
||||
);
|
||||
}
|
||||
}
|
||||
20
lib/logics/entities/api/api_list.dart
Normal file
20
lib/logics/entities/api/api_list.dart
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
part 'api_list.freezed.dart';
|
||||
part 'api_list.g.dart';
|
||||
|
||||
@Freezed(genericArgumentFactories: true)
|
||||
abstract class ApiList<T> with _$ApiList<T> {
|
||||
const factory ApiList({
|
||||
@Default('') String cursor,
|
||||
@Default(1) int page,
|
||||
@Default(10) int size,
|
||||
@Default(0) int total,
|
||||
@Default([]) List<T> list,
|
||||
}) = _ApiList<T>;
|
||||
|
||||
factory ApiList.fromJson(
|
||||
Map<String, Object?> json,
|
||||
T Function(Object?) fromJsonT,
|
||||
) => _$ApiListFromJson(json, fromJsonT);
|
||||
}
|
||||
178
lib/logics/entities/api/api_list.freezed.dart
Normal file
178
lib/logics/entities/api/api_list.freezed.dart
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'api_list.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ApiList<T> implements DiagnosticableTreeMixin {
|
||||
|
||||
String get cursor; int get page; int get size; int get total; List<T> get list;
|
||||
/// Create a copy of ApiList
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$ApiListCopyWith<T, ApiList<T>> get copyWith => _$ApiListCopyWithImpl<T, ApiList<T>>(this as ApiList<T>, _$identity);
|
||||
|
||||
/// Serializes this ApiList to a JSON map.
|
||||
Map<String, dynamic> toJson(Object? Function(T) toJsonT);
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'ApiList<$T>'))
|
||||
..add(DiagnosticsProperty('cursor', cursor))..add(DiagnosticsProperty('page', page))..add(DiagnosticsProperty('size', size))..add(DiagnosticsProperty('total', total))..add(DiagnosticsProperty('list', list));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ApiList<T>&&(identical(other.cursor, cursor) || other.cursor == cursor)&&(identical(other.page, page) || other.page == page)&&(identical(other.size, size) || other.size == size)&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other.list, list));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,cursor,page,size,total,const DeepCollectionEquality().hash(list));
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'ApiList<$T>(cursor: $cursor, page: $page, size: $size, total: $total, list: $list)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $ApiListCopyWith<T,$Res> {
|
||||
factory $ApiListCopyWith(ApiList<T> value, $Res Function(ApiList<T>) _then) = _$ApiListCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String cursor, int page, int size, int total, List<T> list
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$ApiListCopyWithImpl<T,$Res>
|
||||
implements $ApiListCopyWith<T, $Res> {
|
||||
_$ApiListCopyWithImpl(this._self, this._then);
|
||||
|
||||
final ApiList<T> _self;
|
||||
final $Res Function(ApiList<T>) _then;
|
||||
|
||||
/// Create a copy of ApiList
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? cursor = null,Object? page = null,Object? size = null,Object? total = null,Object? list = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
cursor: null == cursor ? _self.cursor : cursor // ignore: cast_nullable_to_non_nullable
|
||||
as String,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||
as int,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable
|
||||
as int,total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||
as int,list: null == list ? _self.list : list // ignore: cast_nullable_to_non_nullable
|
||||
as List<T>,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable(genericArgumentFactories: true)
|
||||
|
||||
class _ApiList<T> with DiagnosticableTreeMixin implements ApiList<T> {
|
||||
const _ApiList({this.cursor = '', this.page = 1, this.size = 10, this.total = 0, final List<T> list = const []}): _list = list;
|
||||
factory _ApiList.fromJson(Map<String, dynamic> json,T Function(Object?) fromJsonT) => _$ApiListFromJson(json,fromJsonT);
|
||||
|
||||
@override@JsonKey() final String cursor;
|
||||
@override@JsonKey() final int page;
|
||||
@override@JsonKey() final int size;
|
||||
@override@JsonKey() final int total;
|
||||
final List<T> _list;
|
||||
@override@JsonKey() List<T> get list {
|
||||
if (_list is EqualUnmodifiableListView) return _list;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_list);
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of ApiList
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ApiListCopyWith<T, _ApiList<T>> get copyWith => __$ApiListCopyWithImpl<T, _ApiList<T>>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson(Object? Function(T) toJsonT) {
|
||||
return _$ApiListToJson<T>(this, toJsonT);
|
||||
}
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'ApiList<$T>'))
|
||||
..add(DiagnosticsProperty('cursor', cursor))..add(DiagnosticsProperty('page', page))..add(DiagnosticsProperty('size', size))..add(DiagnosticsProperty('total', total))..add(DiagnosticsProperty('list', list));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ApiList<T>&&(identical(other.cursor, cursor) || other.cursor == cursor)&&(identical(other.page, page) || other.page == page)&&(identical(other.size, size) || other.size == size)&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other._list, _list));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,cursor,page,size,total,const DeepCollectionEquality().hash(_list));
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'ApiList<$T>(cursor: $cursor, page: $page, size: $size, total: $total, list: $list)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ApiListCopyWith<T,$Res> implements $ApiListCopyWith<T, $Res> {
|
||||
factory _$ApiListCopyWith(_ApiList<T> value, $Res Function(_ApiList<T>) _then) = __$ApiListCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String cursor, int page, int size, int total, List<T> list
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ApiListCopyWithImpl<T,$Res>
|
||||
implements _$ApiListCopyWith<T, $Res> {
|
||||
__$ApiListCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _ApiList<T> _self;
|
||||
final $Res Function(_ApiList<T>) _then;
|
||||
|
||||
/// Create a copy of ApiList
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? cursor = null,Object? page = null,Object? size = null,Object? total = null,Object? list = null,}) {
|
||||
return _then(_ApiList<T>(
|
||||
cursor: null == cursor ? _self.cursor : cursor // ignore: cast_nullable_to_non_nullable
|
||||
as String,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||
as int,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable
|
||||
as int,total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||
as int,list: null == list ? _self._list : list // ignore: cast_nullable_to_non_nullable
|
||||
as List<T>,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
29
lib/logics/entities/api/api_list.g.dart
Normal file
29
lib/logics/entities/api/api_list.g.dart
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'api_list.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_ApiList<T> _$ApiListFromJson<T>(
|
||||
Map<String, dynamic> json,
|
||||
T Function(Object? json) fromJsonT,
|
||||
) => _ApiList<T>(
|
||||
cursor: json['cursor'] as String? ?? '',
|
||||
page: (json['page'] as num?)?.toInt() ?? 1,
|
||||
size: (json['size'] as num?)?.toInt() ?? 10,
|
||||
total: (json['total'] as num?)?.toInt() ?? 0,
|
||||
list: (json['list'] as List<dynamic>?)?.map(fromJsonT).toList() ?? const [],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ApiListToJson<T>(
|
||||
_ApiList<T> instance,
|
||||
Object? Function(T value) toJsonT,
|
||||
) => <String, dynamic>{
|
||||
'cursor': instance.cursor,
|
||||
'page': instance.page,
|
||||
'size': instance.size,
|
||||
'total': instance.total,
|
||||
'list': instance.list.map(toJsonT).toList(),
|
||||
};
|
||||
41
lib/logics/entities/api/api_poetry.dart
Normal file
41
lib/logics/entities/api/api_poetry.dart
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
part 'api_poetry.freezed.dart';
|
||||
part 'api_poetry.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class ApiPoetry with _$ApiPoetry {
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
const factory ApiPoetry({
|
||||
@Default(0) int id,
|
||||
@Default('') String title,
|
||||
@Default('') String content,
|
||||
@Default(0) int authorId,
|
||||
@Default('') String authorName,
|
||||
@Default('') String authorAvatar,
|
||||
@Default('') String authorBio,
|
||||
@Default(0) int dynastyId,
|
||||
@Default('') String dynastyName,
|
||||
@Default(0) int favorNum,
|
||||
@Default(0) int shareNum,
|
||||
@Default(0) int commentNum,
|
||||
@Default(0) int collectNum,
|
||||
@Default(0) int sealNum,
|
||||
@Default(0) int honorPoints,
|
||||
@Default(0) int version,
|
||||
@Default(false) bool deleted,
|
||||
@Default(false) bool favored,
|
||||
}) = _ApiPoetry;
|
||||
|
||||
factory ApiPoetry.fromJson(Map<String, Object?> json) =>
|
||||
_$ApiPoetryFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class ApiPoetryData with _$ApiPoetryData {
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
const factory ApiPoetryData({required ApiPoetry poetry}) = _ApiPoetryData;
|
||||
|
||||
factory ApiPoetryData.fromJson(Map<String, Object?> json) =>
|
||||
_$ApiPoetryDataFromJson(json);
|
||||
}
|
||||
374
lib/logics/entities/api/api_poetry.freezed.dart
Normal file
374
lib/logics/entities/api/api_poetry.freezed.dart
Normal file
|
|
@ -0,0 +1,374 @@
|
|||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'api_poetry.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ApiPoetry implements DiagnosticableTreeMixin {
|
||||
|
||||
int get id; String get title; String get content; int get authorId; String get authorName; String get authorAvatar; String get authorBio; int get dynastyId; String get dynastyName; int get favorNum; int get shareNum; int get commentNum; int get collectNum; int get sealNum; int get honorPoints; int get version; bool get deleted; bool get favored;
|
||||
/// Create a copy of ApiPoetry
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$ApiPoetryCopyWith<ApiPoetry> get copyWith => _$ApiPoetryCopyWithImpl<ApiPoetry>(this as ApiPoetry, _$identity);
|
||||
|
||||
/// Serializes this ApiPoetry to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'ApiPoetry'))
|
||||
..add(DiagnosticsProperty('id', id))..add(DiagnosticsProperty('title', title))..add(DiagnosticsProperty('content', content))..add(DiagnosticsProperty('authorId', authorId))..add(DiagnosticsProperty('authorName', authorName))..add(DiagnosticsProperty('authorAvatar', authorAvatar))..add(DiagnosticsProperty('authorBio', authorBio))..add(DiagnosticsProperty('dynastyId', dynastyId))..add(DiagnosticsProperty('dynastyName', dynastyName))..add(DiagnosticsProperty('favorNum', favorNum))..add(DiagnosticsProperty('shareNum', shareNum))..add(DiagnosticsProperty('commentNum', commentNum))..add(DiagnosticsProperty('collectNum', collectNum))..add(DiagnosticsProperty('sealNum', sealNum))..add(DiagnosticsProperty('honorPoints', honorPoints))..add(DiagnosticsProperty('version', version))..add(DiagnosticsProperty('deleted', deleted))..add(DiagnosticsProperty('favored', favored));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ApiPoetry&&(identical(other.id, id) || other.id == id)&&(identical(other.title, title) || other.title == title)&&(identical(other.content, content) || other.content == content)&&(identical(other.authorId, authorId) || other.authorId == authorId)&&(identical(other.authorName, authorName) || other.authorName == authorName)&&(identical(other.authorAvatar, authorAvatar) || other.authorAvatar == authorAvatar)&&(identical(other.authorBio, authorBio) || other.authorBio == authorBio)&&(identical(other.dynastyId, dynastyId) || other.dynastyId == dynastyId)&&(identical(other.dynastyName, dynastyName) || other.dynastyName == dynastyName)&&(identical(other.favorNum, favorNum) || other.favorNum == favorNum)&&(identical(other.shareNum, shareNum) || other.shareNum == shareNum)&&(identical(other.commentNum, commentNum) || other.commentNum == commentNum)&&(identical(other.collectNum, collectNum) || other.collectNum == collectNum)&&(identical(other.sealNum, sealNum) || other.sealNum == sealNum)&&(identical(other.honorPoints, honorPoints) || other.honorPoints == honorPoints)&&(identical(other.version, version) || other.version == version)&&(identical(other.deleted, deleted) || other.deleted == deleted)&&(identical(other.favored, favored) || other.favored == favored));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,title,content,authorId,authorName,authorAvatar,authorBio,dynastyId,dynastyName,favorNum,shareNum,commentNum,collectNum,sealNum,honorPoints,version,deleted,favored);
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'ApiPoetry(id: $id, title: $title, content: $content, authorId: $authorId, authorName: $authorName, authorAvatar: $authorAvatar, authorBio: $authorBio, dynastyId: $dynastyId, dynastyName: $dynastyName, favorNum: $favorNum, shareNum: $shareNum, commentNum: $commentNum, collectNum: $collectNum, sealNum: $sealNum, honorPoints: $honorPoints, version: $version, deleted: $deleted, favored: $favored)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $ApiPoetryCopyWith<$Res> {
|
||||
factory $ApiPoetryCopyWith(ApiPoetry value, $Res Function(ApiPoetry) _then) = _$ApiPoetryCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int id, String title, String content, int authorId, String authorName, String authorAvatar, String authorBio, int dynastyId, String dynastyName, int favorNum, int shareNum, int commentNum, int collectNum, int sealNum, int honorPoints, int version, bool deleted, bool favored
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$ApiPoetryCopyWithImpl<$Res>
|
||||
implements $ApiPoetryCopyWith<$Res> {
|
||||
_$ApiPoetryCopyWithImpl(this._self, this._then);
|
||||
|
||||
final ApiPoetry _self;
|
||||
final $Res Function(ApiPoetry) _then;
|
||||
|
||||
/// Create a copy of ApiPoetry
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? title = null,Object? content = null,Object? authorId = null,Object? authorName = null,Object? authorAvatar = null,Object? authorBio = null,Object? dynastyId = null,Object? dynastyName = null,Object? favorNum = null,Object? shareNum = null,Object? commentNum = null,Object? collectNum = null,Object? sealNum = null,Object? honorPoints = null,Object? version = null,Object? deleted = null,Object? favored = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as int,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||
as String,content: null == content ? _self.content : content // ignore: cast_nullable_to_non_nullable
|
||||
as String,authorId: null == authorId ? _self.authorId : authorId // ignore: cast_nullable_to_non_nullable
|
||||
as int,authorName: null == authorName ? _self.authorName : authorName // ignore: cast_nullable_to_non_nullable
|
||||
as String,authorAvatar: null == authorAvatar ? _self.authorAvatar : authorAvatar // ignore: cast_nullable_to_non_nullable
|
||||
as String,authorBio: null == authorBio ? _self.authorBio : authorBio // ignore: cast_nullable_to_non_nullable
|
||||
as String,dynastyId: null == dynastyId ? _self.dynastyId : dynastyId // ignore: cast_nullable_to_non_nullable
|
||||
as int,dynastyName: null == dynastyName ? _self.dynastyName : dynastyName // ignore: cast_nullable_to_non_nullable
|
||||
as String,favorNum: null == favorNum ? _self.favorNum : favorNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,shareNum: null == shareNum ? _self.shareNum : shareNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,commentNum: null == commentNum ? _self.commentNum : commentNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,collectNum: null == collectNum ? _self.collectNum : collectNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,sealNum: null == sealNum ? _self.sealNum : sealNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,honorPoints: null == honorPoints ? _self.honorPoints : honorPoints // ignore: cast_nullable_to_non_nullable
|
||||
as int,version: null == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
|
||||
as int,deleted: null == deleted ? _self.deleted : deleted // ignore: cast_nullable_to_non_nullable
|
||||
as bool,favored: null == favored ? _self.favored : favored // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
class _ApiPoetry with DiagnosticableTreeMixin implements ApiPoetry {
|
||||
const _ApiPoetry({this.id = 0, this.title = '', this.content = '', this.authorId = 0, this.authorName = '', this.authorAvatar = '', this.authorBio = '', this.dynastyId = 0, this.dynastyName = '', this.favorNum = 0, this.shareNum = 0, this.commentNum = 0, this.collectNum = 0, this.sealNum = 0, this.honorPoints = 0, this.version = 0, this.deleted = false, this.favored = false});
|
||||
factory _ApiPoetry.fromJson(Map<String, dynamic> json) => _$ApiPoetryFromJson(json);
|
||||
|
||||
@override@JsonKey() final int id;
|
||||
@override@JsonKey() final String title;
|
||||
@override@JsonKey() final String content;
|
||||
@override@JsonKey() final int authorId;
|
||||
@override@JsonKey() final String authorName;
|
||||
@override@JsonKey() final String authorAvatar;
|
||||
@override@JsonKey() final String authorBio;
|
||||
@override@JsonKey() final int dynastyId;
|
||||
@override@JsonKey() final String dynastyName;
|
||||
@override@JsonKey() final int favorNum;
|
||||
@override@JsonKey() final int shareNum;
|
||||
@override@JsonKey() final int commentNum;
|
||||
@override@JsonKey() final int collectNum;
|
||||
@override@JsonKey() final int sealNum;
|
||||
@override@JsonKey() final int honorPoints;
|
||||
@override@JsonKey() final int version;
|
||||
@override@JsonKey() final bool deleted;
|
||||
@override@JsonKey() final bool favored;
|
||||
|
||||
/// Create a copy of ApiPoetry
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ApiPoetryCopyWith<_ApiPoetry> get copyWith => __$ApiPoetryCopyWithImpl<_ApiPoetry>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$ApiPoetryToJson(this, );
|
||||
}
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'ApiPoetry'))
|
||||
..add(DiagnosticsProperty('id', id))..add(DiagnosticsProperty('title', title))..add(DiagnosticsProperty('content', content))..add(DiagnosticsProperty('authorId', authorId))..add(DiagnosticsProperty('authorName', authorName))..add(DiagnosticsProperty('authorAvatar', authorAvatar))..add(DiagnosticsProperty('authorBio', authorBio))..add(DiagnosticsProperty('dynastyId', dynastyId))..add(DiagnosticsProperty('dynastyName', dynastyName))..add(DiagnosticsProperty('favorNum', favorNum))..add(DiagnosticsProperty('shareNum', shareNum))..add(DiagnosticsProperty('commentNum', commentNum))..add(DiagnosticsProperty('collectNum', collectNum))..add(DiagnosticsProperty('sealNum', sealNum))..add(DiagnosticsProperty('honorPoints', honorPoints))..add(DiagnosticsProperty('version', version))..add(DiagnosticsProperty('deleted', deleted))..add(DiagnosticsProperty('favored', favored));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ApiPoetry&&(identical(other.id, id) || other.id == id)&&(identical(other.title, title) || other.title == title)&&(identical(other.content, content) || other.content == content)&&(identical(other.authorId, authorId) || other.authorId == authorId)&&(identical(other.authorName, authorName) || other.authorName == authorName)&&(identical(other.authorAvatar, authorAvatar) || other.authorAvatar == authorAvatar)&&(identical(other.authorBio, authorBio) || other.authorBio == authorBio)&&(identical(other.dynastyId, dynastyId) || other.dynastyId == dynastyId)&&(identical(other.dynastyName, dynastyName) || other.dynastyName == dynastyName)&&(identical(other.favorNum, favorNum) || other.favorNum == favorNum)&&(identical(other.shareNum, shareNum) || other.shareNum == shareNum)&&(identical(other.commentNum, commentNum) || other.commentNum == commentNum)&&(identical(other.collectNum, collectNum) || other.collectNum == collectNum)&&(identical(other.sealNum, sealNum) || other.sealNum == sealNum)&&(identical(other.honorPoints, honorPoints) || other.honorPoints == honorPoints)&&(identical(other.version, version) || other.version == version)&&(identical(other.deleted, deleted) || other.deleted == deleted)&&(identical(other.favored, favored) || other.favored == favored));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,title,content,authorId,authorName,authorAvatar,authorBio,dynastyId,dynastyName,favorNum,shareNum,commentNum,collectNum,sealNum,honorPoints,version,deleted,favored);
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'ApiPoetry(id: $id, title: $title, content: $content, authorId: $authorId, authorName: $authorName, authorAvatar: $authorAvatar, authorBio: $authorBio, dynastyId: $dynastyId, dynastyName: $dynastyName, favorNum: $favorNum, shareNum: $shareNum, commentNum: $commentNum, collectNum: $collectNum, sealNum: $sealNum, honorPoints: $honorPoints, version: $version, deleted: $deleted, favored: $favored)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ApiPoetryCopyWith<$Res> implements $ApiPoetryCopyWith<$Res> {
|
||||
factory _$ApiPoetryCopyWith(_ApiPoetry value, $Res Function(_ApiPoetry) _then) = __$ApiPoetryCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int id, String title, String content, int authorId, String authorName, String authorAvatar, String authorBio, int dynastyId, String dynastyName, int favorNum, int shareNum, int commentNum, int collectNum, int sealNum, int honorPoints, int version, bool deleted, bool favored
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ApiPoetryCopyWithImpl<$Res>
|
||||
implements _$ApiPoetryCopyWith<$Res> {
|
||||
__$ApiPoetryCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _ApiPoetry _self;
|
||||
final $Res Function(_ApiPoetry) _then;
|
||||
|
||||
/// Create a copy of ApiPoetry
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? title = null,Object? content = null,Object? authorId = null,Object? authorName = null,Object? authorAvatar = null,Object? authorBio = null,Object? dynastyId = null,Object? dynastyName = null,Object? favorNum = null,Object? shareNum = null,Object? commentNum = null,Object? collectNum = null,Object? sealNum = null,Object? honorPoints = null,Object? version = null,Object? deleted = null,Object? favored = null,}) {
|
||||
return _then(_ApiPoetry(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as int,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||
as String,content: null == content ? _self.content : content // ignore: cast_nullable_to_non_nullable
|
||||
as String,authorId: null == authorId ? _self.authorId : authorId // ignore: cast_nullable_to_non_nullable
|
||||
as int,authorName: null == authorName ? _self.authorName : authorName // ignore: cast_nullable_to_non_nullable
|
||||
as String,authorAvatar: null == authorAvatar ? _self.authorAvatar : authorAvatar // ignore: cast_nullable_to_non_nullable
|
||||
as String,authorBio: null == authorBio ? _self.authorBio : authorBio // ignore: cast_nullable_to_non_nullable
|
||||
as String,dynastyId: null == dynastyId ? _self.dynastyId : dynastyId // ignore: cast_nullable_to_non_nullable
|
||||
as int,dynastyName: null == dynastyName ? _self.dynastyName : dynastyName // ignore: cast_nullable_to_non_nullable
|
||||
as String,favorNum: null == favorNum ? _self.favorNum : favorNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,shareNum: null == shareNum ? _self.shareNum : shareNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,commentNum: null == commentNum ? _self.commentNum : commentNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,collectNum: null == collectNum ? _self.collectNum : collectNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,sealNum: null == sealNum ? _self.sealNum : sealNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,honorPoints: null == honorPoints ? _self.honorPoints : honorPoints // ignore: cast_nullable_to_non_nullable
|
||||
as int,version: null == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
|
||||
as int,deleted: null == deleted ? _self.deleted : deleted // ignore: cast_nullable_to_non_nullable
|
||||
as bool,favored: null == favored ? _self.favored : favored // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ApiPoetryData implements DiagnosticableTreeMixin {
|
||||
|
||||
ApiPoetry get poetry;
|
||||
/// Create a copy of ApiPoetryData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$ApiPoetryDataCopyWith<ApiPoetryData> get copyWith => _$ApiPoetryDataCopyWithImpl<ApiPoetryData>(this as ApiPoetryData, _$identity);
|
||||
|
||||
/// Serializes this ApiPoetryData to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'ApiPoetryData'))
|
||||
..add(DiagnosticsProperty('poetry', poetry));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ApiPoetryData&&(identical(other.poetry, poetry) || other.poetry == poetry));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,poetry);
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'ApiPoetryData(poetry: $poetry)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $ApiPoetryDataCopyWith<$Res> {
|
||||
factory $ApiPoetryDataCopyWith(ApiPoetryData value, $Res Function(ApiPoetryData) _then) = _$ApiPoetryDataCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
ApiPoetry poetry
|
||||
});
|
||||
|
||||
|
||||
$ApiPoetryCopyWith<$Res> get poetry;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$ApiPoetryDataCopyWithImpl<$Res>
|
||||
implements $ApiPoetryDataCopyWith<$Res> {
|
||||
_$ApiPoetryDataCopyWithImpl(this._self, this._then);
|
||||
|
||||
final ApiPoetryData _self;
|
||||
final $Res Function(ApiPoetryData) _then;
|
||||
|
||||
/// Create a copy of ApiPoetryData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? poetry = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
poetry: null == poetry ? _self.poetry : poetry // ignore: cast_nullable_to_non_nullable
|
||||
as ApiPoetry,
|
||||
));
|
||||
}
|
||||
/// Create a copy of ApiPoetryData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ApiPoetryCopyWith<$Res> get poetry {
|
||||
|
||||
return $ApiPoetryCopyWith<$Res>(_self.poetry, (value) {
|
||||
return _then(_self.copyWith(poetry: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
class _ApiPoetryData with DiagnosticableTreeMixin implements ApiPoetryData {
|
||||
const _ApiPoetryData({required this.poetry});
|
||||
factory _ApiPoetryData.fromJson(Map<String, dynamic> json) => _$ApiPoetryDataFromJson(json);
|
||||
|
||||
@override final ApiPoetry poetry;
|
||||
|
||||
/// Create a copy of ApiPoetryData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$ApiPoetryDataCopyWith<_ApiPoetryData> get copyWith => __$ApiPoetryDataCopyWithImpl<_ApiPoetryData>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$ApiPoetryDataToJson(this, );
|
||||
}
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'ApiPoetryData'))
|
||||
..add(DiagnosticsProperty('poetry', poetry));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ApiPoetryData&&(identical(other.poetry, poetry) || other.poetry == poetry));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,poetry);
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'ApiPoetryData(poetry: $poetry)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$ApiPoetryDataCopyWith<$Res> implements $ApiPoetryDataCopyWith<$Res> {
|
||||
factory _$ApiPoetryDataCopyWith(_ApiPoetryData value, $Res Function(_ApiPoetryData) _then) = __$ApiPoetryDataCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
ApiPoetry poetry
|
||||
});
|
||||
|
||||
|
||||
@override $ApiPoetryCopyWith<$Res> get poetry;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$ApiPoetryDataCopyWithImpl<$Res>
|
||||
implements _$ApiPoetryDataCopyWith<$Res> {
|
||||
__$ApiPoetryDataCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _ApiPoetryData _self;
|
||||
final $Res Function(_ApiPoetryData) _then;
|
||||
|
||||
/// Create a copy of ApiPoetryData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? poetry = null,}) {
|
||||
return _then(_ApiPoetryData(
|
||||
poetry: null == poetry ? _self.poetry : poetry // ignore: cast_nullable_to_non_nullable
|
||||
as ApiPoetry,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of ApiPoetryData
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ApiPoetryCopyWith<$Res> get poetry {
|
||||
|
||||
return $ApiPoetryCopyWith<$Res>(_self.poetry, (value) {
|
||||
return _then(_self.copyWith(poetry: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
58
lib/logics/entities/api/api_poetry.g.dart
Normal file
58
lib/logics/entities/api/api_poetry.g.dart
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'api_poetry.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_ApiPoetry _$ApiPoetryFromJson(Map<String, dynamic> json) => _ApiPoetry(
|
||||
id: (json['id'] as num?)?.toInt() ?? 0,
|
||||
title: json['title'] as String? ?? '',
|
||||
content: json['content'] as String? ?? '',
|
||||
authorId: (json['author_id'] as num?)?.toInt() ?? 0,
|
||||
authorName: json['author_name'] as String? ?? '',
|
||||
authorAvatar: json['author_avatar'] as String? ?? '',
|
||||
authorBio: json['author_bio'] as String? ?? '',
|
||||
dynastyId: (json['dynasty_id'] as num?)?.toInt() ?? 0,
|
||||
dynastyName: json['dynasty_name'] as String? ?? '',
|
||||
favorNum: (json['favor_num'] as num?)?.toInt() ?? 0,
|
||||
shareNum: (json['share_num'] as num?)?.toInt() ?? 0,
|
||||
commentNum: (json['comment_num'] as num?)?.toInt() ?? 0,
|
||||
collectNum: (json['collect_num'] as num?)?.toInt() ?? 0,
|
||||
sealNum: (json['seal_num'] as num?)?.toInt() ?? 0,
|
||||
honorPoints: (json['honor_points'] as num?)?.toInt() ?? 0,
|
||||
version: (json['version'] as num?)?.toInt() ?? 0,
|
||||
deleted: json['deleted'] as bool? ?? false,
|
||||
favored: json['favored'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ApiPoetryToJson(_ApiPoetry instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'title': instance.title,
|
||||
'content': instance.content,
|
||||
'author_id': instance.authorId,
|
||||
'author_name': instance.authorName,
|
||||
'author_avatar': instance.authorAvatar,
|
||||
'author_bio': instance.authorBio,
|
||||
'dynasty_id': instance.dynastyId,
|
||||
'dynasty_name': instance.dynastyName,
|
||||
'favor_num': instance.favorNum,
|
||||
'share_num': instance.shareNum,
|
||||
'comment_num': instance.commentNum,
|
||||
'collect_num': instance.collectNum,
|
||||
'seal_num': instance.sealNum,
|
||||
'honor_points': instance.honorPoints,
|
||||
'version': instance.version,
|
||||
'deleted': instance.deleted,
|
||||
'favored': instance.favored,
|
||||
};
|
||||
|
||||
_ApiPoetryData _$ApiPoetryDataFromJson(Map<String, dynamic> json) =>
|
||||
_ApiPoetryData(
|
||||
poetry: ApiPoetry.fromJson(json['poetry'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ApiPoetryDataToJson(_ApiPoetryData instance) =>
|
||||
<String, dynamic>{'poetry': instance.poetry};
|
||||
25
lib/logics/entities/page/page_list.dart
Normal file
25
lib/logics/entities/page/page_list.dart
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
part 'page_list.freezed.dart';
|
||||
|
||||
@Freezed(genericArgumentFactories: true)
|
||||
abstract class PageList<T> with _$PageList<T> {
|
||||
const factory PageList({
|
||||
@Default('') String cursor,
|
||||
@Default(1) int page,
|
||||
@Default(10) int size,
|
||||
@Default(0) int total,
|
||||
@Default([]) List<T> list,
|
||||
@Default(false) bool loadAll,
|
||||
@Default(false) bool loading,
|
||||
}) = _PageList<T>;
|
||||
static const PageList<dynamic> empty = PageList<dynamic>(
|
||||
cursor: '',
|
||||
page: 1,
|
||||
size: 10,
|
||||
total: 0,
|
||||
list: [],
|
||||
loadAll: false,
|
||||
loading: false,
|
||||
);
|
||||
}
|
||||
178
lib/logics/entities/page/page_list.freezed.dart
Normal file
178
lib/logics/entities/page/page_list.freezed.dart
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'page_list.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$PageList<T> implements DiagnosticableTreeMixin {
|
||||
|
||||
String get cursor; int get page; int get size; int get total; List<T> get list; bool get loadAll; bool get loading;
|
||||
/// Create a copy of PageList
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PageListCopyWith<T, PageList<T>> get copyWith => _$PageListCopyWithImpl<T, PageList<T>>(this as PageList<T>, _$identity);
|
||||
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'PageList<$T>'))
|
||||
..add(DiagnosticsProperty('cursor', cursor))..add(DiagnosticsProperty('page', page))..add(DiagnosticsProperty('size', size))..add(DiagnosticsProperty('total', total))..add(DiagnosticsProperty('list', list))..add(DiagnosticsProperty('loadAll', loadAll))..add(DiagnosticsProperty('loading', loading));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PageList<T>&&(identical(other.cursor, cursor) || other.cursor == cursor)&&(identical(other.page, page) || other.page == page)&&(identical(other.size, size) || other.size == size)&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other.list, list)&&(identical(other.loadAll, loadAll) || other.loadAll == loadAll)&&(identical(other.loading, loading) || other.loading == loading));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,cursor,page,size,total,const DeepCollectionEquality().hash(list),loadAll,loading);
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'PageList<$T>(cursor: $cursor, page: $page, size: $size, total: $total, list: $list, loadAll: $loadAll, loading: $loading)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PageListCopyWith<T,$Res> {
|
||||
factory $PageListCopyWith(PageList<T> value, $Res Function(PageList<T>) _then) = _$PageListCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String cursor, int page, int size, int total, List<T> list, bool loadAll, bool loading
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PageListCopyWithImpl<T,$Res>
|
||||
implements $PageListCopyWith<T, $Res> {
|
||||
_$PageListCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PageList<T> _self;
|
||||
final $Res Function(PageList<T>) _then;
|
||||
|
||||
/// Create a copy of PageList
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? cursor = null,Object? page = null,Object? size = null,Object? total = null,Object? list = null,Object? loadAll = null,Object? loading = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
cursor: null == cursor ? _self.cursor : cursor // ignore: cast_nullable_to_non_nullable
|
||||
as String,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||
as int,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable
|
||||
as int,total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||
as int,list: null == list ? _self.list : list // ignore: cast_nullable_to_non_nullable
|
||||
as List<T>,loadAll: null == loadAll ? _self.loadAll : loadAll // ignore: cast_nullable_to_non_nullable
|
||||
as bool,loading: null == loading ? _self.loading : loading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _PageList<T> with DiagnosticableTreeMixin implements PageList<T> {
|
||||
const _PageList({this.cursor = '', this.page = 1, this.size = 10, this.total = 0, final List<T> list = const [], this.loadAll = false, this.loading = false}): _list = list;
|
||||
|
||||
|
||||
@override@JsonKey() final String cursor;
|
||||
@override@JsonKey() final int page;
|
||||
@override@JsonKey() final int size;
|
||||
@override@JsonKey() final int total;
|
||||
final List<T> _list;
|
||||
@override@JsonKey() List<T> get list {
|
||||
if (_list is EqualUnmodifiableListView) return _list;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_list);
|
||||
}
|
||||
|
||||
@override@JsonKey() final bool loadAll;
|
||||
@override@JsonKey() final bool loading;
|
||||
|
||||
/// Create a copy of PageList
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PageListCopyWith<T, _PageList<T>> get copyWith => __$PageListCopyWithImpl<T, _PageList<T>>(this, _$identity);
|
||||
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'PageList<$T>'))
|
||||
..add(DiagnosticsProperty('cursor', cursor))..add(DiagnosticsProperty('page', page))..add(DiagnosticsProperty('size', size))..add(DiagnosticsProperty('total', total))..add(DiagnosticsProperty('list', list))..add(DiagnosticsProperty('loadAll', loadAll))..add(DiagnosticsProperty('loading', loading));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PageList<T>&&(identical(other.cursor, cursor) || other.cursor == cursor)&&(identical(other.page, page) || other.page == page)&&(identical(other.size, size) || other.size == size)&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other._list, _list)&&(identical(other.loadAll, loadAll) || other.loadAll == loadAll)&&(identical(other.loading, loading) || other.loading == loading));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,cursor,page,size,total,const DeepCollectionEquality().hash(_list),loadAll,loading);
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'PageList<$T>(cursor: $cursor, page: $page, size: $size, total: $total, list: $list, loadAll: $loadAll, loading: $loading)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PageListCopyWith<T,$Res> implements $PageListCopyWith<T, $Res> {
|
||||
factory _$PageListCopyWith(_PageList<T> value, $Res Function(_PageList<T>) _then) = __$PageListCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String cursor, int page, int size, int total, List<T> list, bool loadAll, bool loading
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PageListCopyWithImpl<T,$Res>
|
||||
implements _$PageListCopyWith<T, $Res> {
|
||||
__$PageListCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PageList<T> _self;
|
||||
final $Res Function(_PageList<T>) _then;
|
||||
|
||||
/// Create a copy of PageList
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? cursor = null,Object? page = null,Object? size = null,Object? total = null,Object? list = null,Object? loadAll = null,Object? loading = null,}) {
|
||||
return _then(_PageList<T>(
|
||||
cursor: null == cursor ? _self.cursor : cursor // ignore: cast_nullable_to_non_nullable
|
||||
as String,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||
as int,size: null == size ? _self.size : size // ignore: cast_nullable_to_non_nullable
|
||||
as int,total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||
as int,list: null == list ? _self._list : list // ignore: cast_nullable_to_non_nullable
|
||||
as List<T>,loadAll: null == loadAll ? _self.loadAll : loadAll // ignore: cast_nullable_to_non_nullable
|
||||
as bool,loading: null == loading ? _self.loading : loading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
29
lib/logics/entities/page/poetry.dart
Normal file
29
lib/logics/entities/page/poetry.dart
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
part 'poetry.freezed.dart';
|
||||
part 'poetry.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class Poetry with _$Poetry {
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
const factory Poetry({
|
||||
@Default(0) int id,
|
||||
@Default('') String title,
|
||||
@Default('') String content,
|
||||
@Default(0) int authorId,
|
||||
@Default('') String authorName,
|
||||
@Default('') String authorAvatar,
|
||||
@Default('') String authorBio,
|
||||
@Default(0) int dynastyId,
|
||||
@Default('') String dynastyName,
|
||||
@Default(0) int favorNum,
|
||||
@Default(0) int shareNum,
|
||||
@Default(0) int commentNum,
|
||||
@Default(0) int collectNum,
|
||||
@Default(0) int sealNum,
|
||||
@Default(0) int honorPoints,
|
||||
@Default(0) int version,
|
||||
@Default(false) bool deleted,
|
||||
@Default(false) bool favored,
|
||||
}) = _Poetry;
|
||||
}
|
||||
205
lib/logics/entities/page/poetry.freezed.dart
Normal file
205
lib/logics/entities/page/poetry.freezed.dart
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'poetry.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$Poetry implements DiagnosticableTreeMixin {
|
||||
|
||||
int get id; String get title; String get content; int get authorId; String get authorName; String get authorAvatar; String get authorBio; int get dynastyId; String get dynastyName; int get favorNum; int get shareNum; int get commentNum; int get collectNum; int get sealNum; int get honorPoints; int get version; bool get deleted; bool get favored;
|
||||
/// Create a copy of Poetry
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PoetryCopyWith<Poetry> get copyWith => _$PoetryCopyWithImpl<Poetry>(this as Poetry, _$identity);
|
||||
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'Poetry'))
|
||||
..add(DiagnosticsProperty('id', id))..add(DiagnosticsProperty('title', title))..add(DiagnosticsProperty('content', content))..add(DiagnosticsProperty('authorId', authorId))..add(DiagnosticsProperty('authorName', authorName))..add(DiagnosticsProperty('authorAvatar', authorAvatar))..add(DiagnosticsProperty('authorBio', authorBio))..add(DiagnosticsProperty('dynastyId', dynastyId))..add(DiagnosticsProperty('dynastyName', dynastyName))..add(DiagnosticsProperty('favorNum', favorNum))..add(DiagnosticsProperty('shareNum', shareNum))..add(DiagnosticsProperty('commentNum', commentNum))..add(DiagnosticsProperty('collectNum', collectNum))..add(DiagnosticsProperty('sealNum', sealNum))..add(DiagnosticsProperty('honorPoints', honorPoints))..add(DiagnosticsProperty('version', version))..add(DiagnosticsProperty('deleted', deleted))..add(DiagnosticsProperty('favored', favored));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is Poetry&&(identical(other.id, id) || other.id == id)&&(identical(other.title, title) || other.title == title)&&(identical(other.content, content) || other.content == content)&&(identical(other.authorId, authorId) || other.authorId == authorId)&&(identical(other.authorName, authorName) || other.authorName == authorName)&&(identical(other.authorAvatar, authorAvatar) || other.authorAvatar == authorAvatar)&&(identical(other.authorBio, authorBio) || other.authorBio == authorBio)&&(identical(other.dynastyId, dynastyId) || other.dynastyId == dynastyId)&&(identical(other.dynastyName, dynastyName) || other.dynastyName == dynastyName)&&(identical(other.favorNum, favorNum) || other.favorNum == favorNum)&&(identical(other.shareNum, shareNum) || other.shareNum == shareNum)&&(identical(other.commentNum, commentNum) || other.commentNum == commentNum)&&(identical(other.collectNum, collectNum) || other.collectNum == collectNum)&&(identical(other.sealNum, sealNum) || other.sealNum == sealNum)&&(identical(other.honorPoints, honorPoints) || other.honorPoints == honorPoints)&&(identical(other.version, version) || other.version == version)&&(identical(other.deleted, deleted) || other.deleted == deleted)&&(identical(other.favored, favored) || other.favored == favored));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,title,content,authorId,authorName,authorAvatar,authorBio,dynastyId,dynastyName,favorNum,shareNum,commentNum,collectNum,sealNum,honorPoints,version,deleted,favored);
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'Poetry(id: $id, title: $title, content: $content, authorId: $authorId, authorName: $authorName, authorAvatar: $authorAvatar, authorBio: $authorBio, dynastyId: $dynastyId, dynastyName: $dynastyName, favorNum: $favorNum, shareNum: $shareNum, commentNum: $commentNum, collectNum: $collectNum, sealNum: $sealNum, honorPoints: $honorPoints, version: $version, deleted: $deleted, favored: $favored)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PoetryCopyWith<$Res> {
|
||||
factory $PoetryCopyWith(Poetry value, $Res Function(Poetry) _then) = _$PoetryCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int id, String title, String content, int authorId, String authorName, String authorAvatar, String authorBio, int dynastyId, String dynastyName, int favorNum, int shareNum, int commentNum, int collectNum, int sealNum, int honorPoints, int version, bool deleted, bool favored
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PoetryCopyWithImpl<$Res>
|
||||
implements $PoetryCopyWith<$Res> {
|
||||
_$PoetryCopyWithImpl(this._self, this._then);
|
||||
|
||||
final Poetry _self;
|
||||
final $Res Function(Poetry) _then;
|
||||
|
||||
/// Create a copy of Poetry
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? title = null,Object? content = null,Object? authorId = null,Object? authorName = null,Object? authorAvatar = null,Object? authorBio = null,Object? dynastyId = null,Object? dynastyName = null,Object? favorNum = null,Object? shareNum = null,Object? commentNum = null,Object? collectNum = null,Object? sealNum = null,Object? honorPoints = null,Object? version = null,Object? deleted = null,Object? favored = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as int,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||
as String,content: null == content ? _self.content : content // ignore: cast_nullable_to_non_nullable
|
||||
as String,authorId: null == authorId ? _self.authorId : authorId // ignore: cast_nullable_to_non_nullable
|
||||
as int,authorName: null == authorName ? _self.authorName : authorName // ignore: cast_nullable_to_non_nullable
|
||||
as String,authorAvatar: null == authorAvatar ? _self.authorAvatar : authorAvatar // ignore: cast_nullable_to_non_nullable
|
||||
as String,authorBio: null == authorBio ? _self.authorBio : authorBio // ignore: cast_nullable_to_non_nullable
|
||||
as String,dynastyId: null == dynastyId ? _self.dynastyId : dynastyId // ignore: cast_nullable_to_non_nullable
|
||||
as int,dynastyName: null == dynastyName ? _self.dynastyName : dynastyName // ignore: cast_nullable_to_non_nullable
|
||||
as String,favorNum: null == favorNum ? _self.favorNum : favorNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,shareNum: null == shareNum ? _self.shareNum : shareNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,commentNum: null == commentNum ? _self.commentNum : commentNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,collectNum: null == collectNum ? _self.collectNum : collectNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,sealNum: null == sealNum ? _self.sealNum : sealNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,honorPoints: null == honorPoints ? _self.honorPoints : honorPoints // ignore: cast_nullable_to_non_nullable
|
||||
as int,version: null == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
|
||||
as int,deleted: null == deleted ? _self.deleted : deleted // ignore: cast_nullable_to_non_nullable
|
||||
as bool,favored: null == favored ? _self.favored : favored // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
class _Poetry with DiagnosticableTreeMixin implements Poetry {
|
||||
const _Poetry({this.id = 0, this.title = '', this.content = '', this.authorId = 0, this.authorName = '', this.authorAvatar = '', this.authorBio = '', this.dynastyId = 0, this.dynastyName = '', this.favorNum = 0, this.shareNum = 0, this.commentNum = 0, this.collectNum = 0, this.sealNum = 0, this.honorPoints = 0, this.version = 0, this.deleted = false, this.favored = false});
|
||||
|
||||
|
||||
@override@JsonKey() final int id;
|
||||
@override@JsonKey() final String title;
|
||||
@override@JsonKey() final String content;
|
||||
@override@JsonKey() final int authorId;
|
||||
@override@JsonKey() final String authorName;
|
||||
@override@JsonKey() final String authorAvatar;
|
||||
@override@JsonKey() final String authorBio;
|
||||
@override@JsonKey() final int dynastyId;
|
||||
@override@JsonKey() final String dynastyName;
|
||||
@override@JsonKey() final int favorNum;
|
||||
@override@JsonKey() final int shareNum;
|
||||
@override@JsonKey() final int commentNum;
|
||||
@override@JsonKey() final int collectNum;
|
||||
@override@JsonKey() final int sealNum;
|
||||
@override@JsonKey() final int honorPoints;
|
||||
@override@JsonKey() final int version;
|
||||
@override@JsonKey() final bool deleted;
|
||||
@override@JsonKey() final bool favored;
|
||||
|
||||
/// Create a copy of Poetry
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PoetryCopyWith<_Poetry> get copyWith => __$PoetryCopyWithImpl<_Poetry>(this, _$identity);
|
||||
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'Poetry'))
|
||||
..add(DiagnosticsProperty('id', id))..add(DiagnosticsProperty('title', title))..add(DiagnosticsProperty('content', content))..add(DiagnosticsProperty('authorId', authorId))..add(DiagnosticsProperty('authorName', authorName))..add(DiagnosticsProperty('authorAvatar', authorAvatar))..add(DiagnosticsProperty('authorBio', authorBio))..add(DiagnosticsProperty('dynastyId', dynastyId))..add(DiagnosticsProperty('dynastyName', dynastyName))..add(DiagnosticsProperty('favorNum', favorNum))..add(DiagnosticsProperty('shareNum', shareNum))..add(DiagnosticsProperty('commentNum', commentNum))..add(DiagnosticsProperty('collectNum', collectNum))..add(DiagnosticsProperty('sealNum', sealNum))..add(DiagnosticsProperty('honorPoints', honorPoints))..add(DiagnosticsProperty('version', version))..add(DiagnosticsProperty('deleted', deleted))..add(DiagnosticsProperty('favored', favored));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _Poetry&&(identical(other.id, id) || other.id == id)&&(identical(other.title, title) || other.title == title)&&(identical(other.content, content) || other.content == content)&&(identical(other.authorId, authorId) || other.authorId == authorId)&&(identical(other.authorName, authorName) || other.authorName == authorName)&&(identical(other.authorAvatar, authorAvatar) || other.authorAvatar == authorAvatar)&&(identical(other.authorBio, authorBio) || other.authorBio == authorBio)&&(identical(other.dynastyId, dynastyId) || other.dynastyId == dynastyId)&&(identical(other.dynastyName, dynastyName) || other.dynastyName == dynastyName)&&(identical(other.favorNum, favorNum) || other.favorNum == favorNum)&&(identical(other.shareNum, shareNum) || other.shareNum == shareNum)&&(identical(other.commentNum, commentNum) || other.commentNum == commentNum)&&(identical(other.collectNum, collectNum) || other.collectNum == collectNum)&&(identical(other.sealNum, sealNum) || other.sealNum == sealNum)&&(identical(other.honorPoints, honorPoints) || other.honorPoints == honorPoints)&&(identical(other.version, version) || other.version == version)&&(identical(other.deleted, deleted) || other.deleted == deleted)&&(identical(other.favored, favored) || other.favored == favored));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,title,content,authorId,authorName,authorAvatar,authorBio,dynastyId,dynastyName,favorNum,shareNum,commentNum,collectNum,sealNum,honorPoints,version,deleted,favored);
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'Poetry(id: $id, title: $title, content: $content, authorId: $authorId, authorName: $authorName, authorAvatar: $authorAvatar, authorBio: $authorBio, dynastyId: $dynastyId, dynastyName: $dynastyName, favorNum: $favorNum, shareNum: $shareNum, commentNum: $commentNum, collectNum: $collectNum, sealNum: $sealNum, honorPoints: $honorPoints, version: $version, deleted: $deleted, favored: $favored)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PoetryCopyWith<$Res> implements $PoetryCopyWith<$Res> {
|
||||
factory _$PoetryCopyWith(_Poetry value, $Res Function(_Poetry) _then) = __$PoetryCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int id, String title, String content, int authorId, String authorName, String authorAvatar, String authorBio, int dynastyId, String dynastyName, int favorNum, int shareNum, int commentNum, int collectNum, int sealNum, int honorPoints, int version, bool deleted, bool favored
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PoetryCopyWithImpl<$Res>
|
||||
implements _$PoetryCopyWith<$Res> {
|
||||
__$PoetryCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _Poetry _self;
|
||||
final $Res Function(_Poetry) _then;
|
||||
|
||||
/// Create a copy of Poetry
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? title = null,Object? content = null,Object? authorId = null,Object? authorName = null,Object? authorAvatar = null,Object? authorBio = null,Object? dynastyId = null,Object? dynastyName = null,Object? favorNum = null,Object? shareNum = null,Object? commentNum = null,Object? collectNum = null,Object? sealNum = null,Object? honorPoints = null,Object? version = null,Object? deleted = null,Object? favored = null,}) {
|
||||
return _then(_Poetry(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as int,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable
|
||||
as String,content: null == content ? _self.content : content // ignore: cast_nullable_to_non_nullable
|
||||
as String,authorId: null == authorId ? _self.authorId : authorId // ignore: cast_nullable_to_non_nullable
|
||||
as int,authorName: null == authorName ? _self.authorName : authorName // ignore: cast_nullable_to_non_nullable
|
||||
as String,authorAvatar: null == authorAvatar ? _self.authorAvatar : authorAvatar // ignore: cast_nullable_to_non_nullable
|
||||
as String,authorBio: null == authorBio ? _self.authorBio : authorBio // ignore: cast_nullable_to_non_nullable
|
||||
as String,dynastyId: null == dynastyId ? _self.dynastyId : dynastyId // ignore: cast_nullable_to_non_nullable
|
||||
as int,dynastyName: null == dynastyName ? _self.dynastyName : dynastyName // ignore: cast_nullable_to_non_nullable
|
||||
as String,favorNum: null == favorNum ? _self.favorNum : favorNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,shareNum: null == shareNum ? _self.shareNum : shareNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,commentNum: null == commentNum ? _self.commentNum : commentNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,collectNum: null == collectNum ? _self.collectNum : collectNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,sealNum: null == sealNum ? _self.sealNum : sealNum // ignore: cast_nullable_to_non_nullable
|
||||
as int,honorPoints: null == honorPoints ? _self.honorPoints : honorPoints // ignore: cast_nullable_to_non_nullable
|
||||
as int,version: null == version ? _self.version : version // ignore: cast_nullable_to_non_nullable
|
||||
as int,deleted: null == deleted ? _self.deleted : deleted // ignore: cast_nullable_to_non_nullable
|
||||
as bool,favored: null == favored ? _self.favored : favored // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
49
lib/logics/entities/page/poetry.g.dart
Normal file
49
lib/logics/entities/page/poetry.g.dart
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'poetry.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_Poetry _$PoetryFromJson(Map<String, dynamic> json) => _Poetry(
|
||||
id: (json['id'] as num?)?.toInt() ?? 0,
|
||||
title: json['title'] as String? ?? '',
|
||||
content: json['content'] as String? ?? '',
|
||||
authorId: (json['author_id'] as num?)?.toInt() ?? 0,
|
||||
authorName: json['author_name'] as String? ?? '',
|
||||
authorAvatar: json['author_avatar'] as String? ?? '',
|
||||
authorBio: json['author_bio'] as String? ?? '',
|
||||
dynastyId: (json['dynasty_id'] as num?)?.toInt() ?? 0,
|
||||
dynastyName: json['dynasty_name'] as String? ?? '',
|
||||
favorNum: (json['favor_num'] as num?)?.toInt() ?? 0,
|
||||
shareNum: (json['share_num'] as num?)?.toInt() ?? 0,
|
||||
commentNum: (json['comment_num'] as num?)?.toInt() ?? 0,
|
||||
collectNum: (json['collect_num'] as num?)?.toInt() ?? 0,
|
||||
sealNum: (json['seal_num'] as num?)?.toInt() ?? 0,
|
||||
honorPoints: (json['honor_points'] as num?)?.toInt() ?? 0,
|
||||
version: (json['version'] as num?)?.toInt() ?? 0,
|
||||
deleted: json['deleted'] as bool? ?? false,
|
||||
favored: json['favored'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$PoetryToJson(_Poetry instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'title': instance.title,
|
||||
'content': instance.content,
|
||||
'author_id': instance.authorId,
|
||||
'author_name': instance.authorName,
|
||||
'author_avatar': instance.authorAvatar,
|
||||
'author_bio': instance.authorBio,
|
||||
'dynasty_id': instance.dynastyId,
|
||||
'dynasty_name': instance.dynastyName,
|
||||
'favor_num': instance.favorNum,
|
||||
'share_num': instance.shareNum,
|
||||
'comment_num': instance.commentNum,
|
||||
'collect_num': instance.collectNum,
|
||||
'seal_num': instance.sealNum,
|
||||
'honor_points': instance.honorPoints,
|
||||
'version': instance.version,
|
||||
'deleted': instance.deleted,
|
||||
'favored': instance.favored,
|
||||
};
|
||||
13
lib/logics/entities/state/poetry_detail.dart
Normal file
13
lib/logics/entities/state/poetry_detail.dart
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import 'package:flutter_samples/helpers/constants/index.dart';
|
||||
import 'package:flutter_samples/logics/entities/page/poetry.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
part 'poetry_detail.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class PoetryDetailState with _$PoetryDetailState {
|
||||
const factory PoetryDetailState({
|
||||
@Default(0) int poetryId,
|
||||
@Default(emptyPoetry) Poetry poetry,
|
||||
}) = _PoetryDetailState;
|
||||
}
|
||||
175
lib/logics/entities/state/poetry_detail.freezed.dart
Normal file
175
lib/logics/entities/state/poetry_detail.freezed.dart
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'poetry_detail.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$PoetryDetailState implements DiagnosticableTreeMixin {
|
||||
|
||||
int get poetryId; Poetry get poetry;
|
||||
/// Create a copy of PoetryDetailState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PoetryDetailStateCopyWith<PoetryDetailState> get copyWith => _$PoetryDetailStateCopyWithImpl<PoetryDetailState>(this as PoetryDetailState, _$identity);
|
||||
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'PoetryDetailState'))
|
||||
..add(DiagnosticsProperty('poetryId', poetryId))..add(DiagnosticsProperty('poetry', poetry));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PoetryDetailState&&(identical(other.poetryId, poetryId) || other.poetryId == poetryId)&&(identical(other.poetry, poetry) || other.poetry == poetry));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,poetryId,poetry);
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'PoetryDetailState(poetryId: $poetryId, poetry: $poetry)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PoetryDetailStateCopyWith<$Res> {
|
||||
factory $PoetryDetailStateCopyWith(PoetryDetailState value, $Res Function(PoetryDetailState) _then) = _$PoetryDetailStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
int poetryId, Poetry poetry
|
||||
});
|
||||
|
||||
|
||||
$PoetryCopyWith<$Res> get poetry;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PoetryDetailStateCopyWithImpl<$Res>
|
||||
implements $PoetryDetailStateCopyWith<$Res> {
|
||||
_$PoetryDetailStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PoetryDetailState _self;
|
||||
final $Res Function(PoetryDetailState) _then;
|
||||
|
||||
/// Create a copy of PoetryDetailState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? poetryId = null,Object? poetry = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
poetryId: null == poetryId ? _self.poetryId : poetryId // ignore: cast_nullable_to_non_nullable
|
||||
as int,poetry: null == poetry ? _self.poetry : poetry // ignore: cast_nullable_to_non_nullable
|
||||
as Poetry,
|
||||
));
|
||||
}
|
||||
/// Create a copy of PoetryDetailState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$PoetryCopyWith<$Res> get poetry {
|
||||
|
||||
return $PoetryCopyWith<$Res>(_self.poetry, (value) {
|
||||
return _then(_self.copyWith(poetry: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _PoetryDetailState with DiagnosticableTreeMixin implements PoetryDetailState {
|
||||
const _PoetryDetailState({this.poetryId = 0, this.poetry = emptyPoetry});
|
||||
|
||||
|
||||
@override@JsonKey() final int poetryId;
|
||||
@override@JsonKey() final Poetry poetry;
|
||||
|
||||
/// Create a copy of PoetryDetailState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PoetryDetailStateCopyWith<_PoetryDetailState> get copyWith => __$PoetryDetailStateCopyWithImpl<_PoetryDetailState>(this, _$identity);
|
||||
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'PoetryDetailState'))
|
||||
..add(DiagnosticsProperty('poetryId', poetryId))..add(DiagnosticsProperty('poetry', poetry));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PoetryDetailState&&(identical(other.poetryId, poetryId) || other.poetryId == poetryId)&&(identical(other.poetry, poetry) || other.poetry == poetry));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,poetryId,poetry);
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'PoetryDetailState(poetryId: $poetryId, poetry: $poetry)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PoetryDetailStateCopyWith<$Res> implements $PoetryDetailStateCopyWith<$Res> {
|
||||
factory _$PoetryDetailStateCopyWith(_PoetryDetailState value, $Res Function(_PoetryDetailState) _then) = __$PoetryDetailStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
int poetryId, Poetry poetry
|
||||
});
|
||||
|
||||
|
||||
@override $PoetryCopyWith<$Res> get poetry;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PoetryDetailStateCopyWithImpl<$Res>
|
||||
implements _$PoetryDetailStateCopyWith<$Res> {
|
||||
__$PoetryDetailStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PoetryDetailState _self;
|
||||
final $Res Function(_PoetryDetailState) _then;
|
||||
|
||||
/// Create a copy of PoetryDetailState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? poetryId = null,Object? poetry = null,}) {
|
||||
return _then(_PoetryDetailState(
|
||||
poetryId: null == poetryId ? _self.poetryId : poetryId // ignore: cast_nullable_to_non_nullable
|
||||
as int,poetry: null == poetry ? _self.poetry : poetry // ignore: cast_nullable_to_non_nullable
|
||||
as Poetry,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of PoetryDetailState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$PoetryCopyWith<$Res> get poetry {
|
||||
|
||||
return $PoetryCopyWith<$Res>(_self.poetry, (value) {
|
||||
return _then(_self.copyWith(poetry: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
13
lib/logics/entities/state/poetry_list.dart
Normal file
13
lib/logics/entities/state/poetry_list.dart
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import 'package:flutter_samples/helpers/constants/index.dart';
|
||||
import 'package:flutter_samples/logics/entities/page/page_list.dart';
|
||||
import 'package:flutter_samples/logics/entities/page/poetry.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
part 'poetry_list.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class PoetryListState with _$PoetryListState {
|
||||
const factory PoetryListState({
|
||||
@Default(emptyPoetryList) PageList<Poetry> poetryData,
|
||||
}) = _PoetryListState;
|
||||
}
|
||||
172
lib/logics/entities/state/poetry_list.freezed.dart
Normal file
172
lib/logics/entities/state/poetry_list.freezed.dart
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
// dart format width=80
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'poetry_list.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$PoetryListState implements DiagnosticableTreeMixin {
|
||||
|
||||
PageList<Poetry> get poetryData;
|
||||
/// Create a copy of PoetryListState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PoetryListStateCopyWith<PoetryListState> get copyWith => _$PoetryListStateCopyWithImpl<PoetryListState>(this as PoetryListState, _$identity);
|
||||
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'PoetryListState'))
|
||||
..add(DiagnosticsProperty('poetryData', poetryData));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PoetryListState&&(identical(other.poetryData, poetryData) || other.poetryData == poetryData));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,poetryData);
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'PoetryListState(poetryData: $poetryData)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PoetryListStateCopyWith<$Res> {
|
||||
factory $PoetryListStateCopyWith(PoetryListState value, $Res Function(PoetryListState) _then) = _$PoetryListStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
PageList<Poetry> poetryData
|
||||
});
|
||||
|
||||
|
||||
$PageListCopyWith<Poetry, $Res> get poetryData;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PoetryListStateCopyWithImpl<$Res>
|
||||
implements $PoetryListStateCopyWith<$Res> {
|
||||
_$PoetryListStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PoetryListState _self;
|
||||
final $Res Function(PoetryListState) _then;
|
||||
|
||||
/// Create a copy of PoetryListState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? poetryData = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
poetryData: null == poetryData ? _self.poetryData : poetryData // ignore: cast_nullable_to_non_nullable
|
||||
as PageList<Poetry>,
|
||||
));
|
||||
}
|
||||
/// Create a copy of PoetryListState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$PageListCopyWith<Poetry, $Res> get poetryData {
|
||||
|
||||
return $PageListCopyWith<Poetry, $Res>(_self.poetryData, (value) {
|
||||
return _then(_self.copyWith(poetryData: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _PoetryListState with DiagnosticableTreeMixin implements PoetryListState {
|
||||
const _PoetryListState({this.poetryData = emptyPoetryList});
|
||||
|
||||
|
||||
@override@JsonKey() final PageList<Poetry> poetryData;
|
||||
|
||||
/// Create a copy of PoetryListState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PoetryListStateCopyWith<_PoetryListState> get copyWith => __$PoetryListStateCopyWithImpl<_PoetryListState>(this, _$identity);
|
||||
|
||||
|
||||
@override
|
||||
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
||||
properties
|
||||
..add(DiagnosticsProperty('type', 'PoetryListState'))
|
||||
..add(DiagnosticsProperty('poetryData', poetryData));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PoetryListState&&(identical(other.poetryData, poetryData) || other.poetryData == poetryData));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,poetryData);
|
||||
|
||||
@override
|
||||
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
|
||||
return 'PoetryListState(poetryData: $poetryData)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PoetryListStateCopyWith<$Res> implements $PoetryListStateCopyWith<$Res> {
|
||||
factory _$PoetryListStateCopyWith(_PoetryListState value, $Res Function(_PoetryListState) _then) = __$PoetryListStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
PageList<Poetry> poetryData
|
||||
});
|
||||
|
||||
|
||||
@override $PageListCopyWith<Poetry, $Res> get poetryData;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PoetryListStateCopyWithImpl<$Res>
|
||||
implements _$PoetryListStateCopyWith<$Res> {
|
||||
__$PoetryListStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PoetryListState _self;
|
||||
final $Res Function(_PoetryListState) _then;
|
||||
|
||||
/// Create a copy of PoetryListState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? poetryData = null,}) {
|
||||
return _then(_PoetryListState(
|
||||
poetryData: null == poetryData ? _self.poetryData : poetryData // ignore: cast_nullable_to_non_nullable
|
||||
as PageList<Poetry>,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of PoetryListState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$PageListCopyWith<Poetry, $Res> get poetryData {
|
||||
|
||||
return $PageListCopyWith<Poetry, $Res>(_self.poetryData, (value) {
|
||||
return _then(_self.copyWith(poetryData: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
44
lib/logics/models/poetry.dart
Normal file
44
lib/logics/models/poetry.dart
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_samples/helpers/constants/api.dart';
|
||||
import 'package:flutter_samples/helpers/dio.dart';
|
||||
import 'package:flutter_samples/logics/adapters/poetry.dart';
|
||||
import 'package:flutter_samples/logics/entities/api/api_list.dart';
|
||||
import 'package:flutter_samples/logics/entities/api/api_poetry.dart';
|
||||
import 'package:flutter_samples/logics/entities/page/poetry.dart';
|
||||
|
||||
class PoetryModel {
|
||||
// 获取诗词列表
|
||||
Future<ApiList<Poetry>> getPoetryList(Map<String, dynamic> params) async {
|
||||
final Response<dynamic> resp = await DioRequest.post(
|
||||
ReqUrl.getPoetryList,
|
||||
params,
|
||||
);
|
||||
final ApiList<ApiPoetry> data = ApiList.fromJson(
|
||||
resp.data,
|
||||
(json) => ApiPoetry.fromJson(json as Map<String, dynamic>),
|
||||
);
|
||||
return ApiList<Poetry>(
|
||||
list:
|
||||
data.list.map((e) => PoetryAdapter.fromAPIPoetryToPoetry(e)).toList(),
|
||||
cursor: data.cursor,
|
||||
page: data.page,
|
||||
size: data.size,
|
||||
total: data.total,
|
||||
);
|
||||
}
|
||||
|
||||
// 获取诗词详情
|
||||
Future<Poetry> getPoetryDetail(Map<String, dynamic> params) async {
|
||||
final Response<dynamic> resp = await DioRequest.post(
|
||||
ReqUrl.getPoetryDetail,
|
||||
params,
|
||||
);
|
||||
final ApiPoetryData data = ApiPoetryData.fromJson(resp.data);
|
||||
return PoetryAdapter.fromAPIPoetryToPoetry(data.poetry);
|
||||
}
|
||||
}
|
||||
|
||||
final poetryProvider = Provider((ref) {
|
||||
return PoetryModel();
|
||||
});
|
||||
37
lib/logics/services/poetry_detail.dart
Normal file
37
lib/logics/services/poetry_detail.dart
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_samples/logics/entities/state/poetry_detail.dart';
|
||||
import 'package:flutter_samples/logics/models/poetry.dart';
|
||||
import 'package:flutter_samples/utils/index.dart';
|
||||
|
||||
class PoetryDetailService extends StateNotifier<PoetryDetailState> {
|
||||
final PoetryModel _poetryModel;
|
||||
PoetryDetailService(this._poetryModel) : super(const PoetryDetailState());
|
||||
|
||||
void setUp(int id) {
|
||||
state = state.copyWith(poetryId: id);
|
||||
queryPoetryDetail();
|
||||
}
|
||||
|
||||
tapPoetry() {
|
||||
showNoneMsg('用户点击了诗词');
|
||||
}
|
||||
|
||||
// 获取诗词列表
|
||||
Future<void> queryPoetryDetail() async {
|
||||
try {
|
||||
if (state.poetryId < 1) {
|
||||
return;
|
||||
}
|
||||
final poetry = await _poetryModel.getPoetryDetail({'id': state.poetryId});
|
||||
state = state.copyWith(poetry: poetry);
|
||||
} catch (e) {
|
||||
// Handle error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final poetryDetailServiceProvider =
|
||||
StateNotifierProvider<PoetryDetailService, PoetryDetailState>((ref) {
|
||||
final poetryModel = ref.read(poetryProvider);
|
||||
return PoetryDetailService(poetryModel);
|
||||
});
|
||||
73
lib/logics/services/poetry_list.dart
Normal file
73
lib/logics/services/poetry_list.dart
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_samples/helpers/constants/route.dart';
|
||||
import 'package:flutter_samples/logics/entities/page/poetry.dart';
|
||||
import 'package:flutter_samples/logics/entities/state/poetry_list.dart';
|
||||
import 'package:flutter_samples/logics/models/poetry.dart';
|
||||
import 'package:flutter_samples/router/router.dart';
|
||||
|
||||
class PoetryListService extends StateNotifier<PoetryListState> {
|
||||
final PoetryModel _poetryModel;
|
||||
PoetryListService(this._poetryModel) : super(const PoetryListState());
|
||||
|
||||
void setUp() {
|
||||
queryPoetryList();
|
||||
}
|
||||
|
||||
void toPoetryDetailPage(Poetry poetry) {
|
||||
router.pushNamed(
|
||||
Routes.poetry,
|
||||
queryParameters: {'id': poetry.id.toString()},
|
||||
);
|
||||
}
|
||||
|
||||
// 分页加载更多
|
||||
Future<void> queryMorePoetryList() async {
|
||||
final loading = state.poetryData.loading;
|
||||
final loadAll = state.poetryData.loadAll;
|
||||
if (loading || loadAll) return;
|
||||
await queryPoetryList();
|
||||
}
|
||||
|
||||
// 获取诗词列表
|
||||
Future<void> queryPoetryList() async {
|
||||
try {
|
||||
final size = state.poetryData.size;
|
||||
final page = state.poetryData.page;
|
||||
final loading = state.poetryData.loading;
|
||||
final loadAll = state.poetryData.loadAll;
|
||||
if (loading || loadAll) {
|
||||
return;
|
||||
}
|
||||
state = state.copyWith(
|
||||
poetryData: state.poetryData.copyWith(loading: true),
|
||||
);
|
||||
final resp = await _poetryModel.getPoetryList({
|
||||
'page': page,
|
||||
'size': size,
|
||||
});
|
||||
state = state.copyWith(
|
||||
poetryData: state.poetryData.copyWith(
|
||||
list:
|
||||
page == 1 ? resp.list : [...state.poetryData.list, ...resp.list],
|
||||
page: resp.page,
|
||||
size: resp.size,
|
||||
total: resp.total,
|
||||
loadAll: resp.list.length < size,
|
||||
loading: false,
|
||||
),
|
||||
);
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
state = state.copyWith(
|
||||
poetryData: state.poetryData.copyWith(loading: false),
|
||||
);
|
||||
} catch (e) {
|
||||
// Handle error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final poetryListServiceProvider =
|
||||
StateNotifierProvider<PoetryListService, PoetryListState>((ref) {
|
||||
final poetryModel = ref.read(poetryProvider);
|
||||
return PoetryListService(poetryModel);
|
||||
});
|
||||
142
lib/main.dart
142
lib/main.dart
|
|
@ -1,7 +1,15 @@
|
|||
import 'dart:developer' as developer;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_samples/router/router.dart';
|
||||
import 'package:flutter_samples/styles/styles.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MyApp());
|
||||
_setupLogging();
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
runApp(const ProviderScope(child: MyApp()));
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
|
|
@ -10,113 +18,37 @@ class MyApp extends StatelessWidget {
|
|||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
return MaterialApp.router(
|
||||
theme: ThemeData(
|
||||
// This is the theme of your application.
|
||||
//
|
||||
// TRY THIS: Try running your application with "flutter run". You'll see
|
||||
// the application has a purple toolbar. Then, without quitting the app,
|
||||
// try changing the seedColor in the colorScheme below to Colors.green
|
||||
// and then invoke "hot reload" (save your changes or press the "hot
|
||||
// reload" button in a Flutter-supported IDE, or press "r" if you used
|
||||
// the command line to start the app).
|
||||
//
|
||||
// Notice that the counter didn't reset back to zero; the application
|
||||
// state is not lost during the reload. To reset the state, use hot
|
||||
// restart instead.
|
||||
//
|
||||
// This works for code too, not just values: Most code changes can be
|
||||
// tested with just a hot reload.
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
),
|
||||
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyHomePage extends StatefulWidget {
|
||||
const MyHomePage({super.key, required this.title});
|
||||
|
||||
// This widget is the home page of your application. It is stateful, meaning
|
||||
// that it has a State object (defined below) that contains fields that affect
|
||||
// how it looks.
|
||||
|
||||
// This class is the configuration for the state. It holds the values (in this
|
||||
// case the title) provided by the parent (in this case the App widget) and
|
||||
// used by the build method of the State. Fields in a Widget subclass are
|
||||
// always marked "final".
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
State<MyHomePage> createState() => _MyHomePageState();
|
||||
}
|
||||
|
||||
class _MyHomePageState extends State<MyHomePage> {
|
||||
int _counter = 0;
|
||||
|
||||
void _incrementCounter() {
|
||||
setState(() {
|
||||
// This call to setState tells the Flutter framework that something has
|
||||
// changed in this State, which causes it to rerun the build method below
|
||||
// so that the display can reflect the updated values. If we changed
|
||||
// _counter without calling setState(), then the build method would not be
|
||||
// called again, and so nothing would appear to happen.
|
||||
_counter++;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// This method is rerun every time setState is called, for instance as done
|
||||
// by the _incrementCounter method above.
|
||||
//
|
||||
// The Flutter framework has been optimized to make rerunning build methods
|
||||
// fast, so that you can just rebuild anything that needs updating rather
|
||||
// than having to individually change instances of widgets.
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
// TRY THIS: Try changing the color here to a specific color (to
|
||||
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
|
||||
// change color while the other colors stay the same.
|
||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||||
// Here we take the value from the MyHomePage object that was created by
|
||||
// the App.build method, and use it to set our appbar title.
|
||||
title: Text(widget.title),
|
||||
),
|
||||
body: Center(
|
||||
// Center is a layout widget. It takes a single child and positions it
|
||||
// in the middle of the parent.
|
||||
child: Column(
|
||||
// Column is also a layout widget. It takes a list of children and
|
||||
// arranges them vertically. By default, it sizes itself to fit its
|
||||
// children horizontally, and tries to be as tall as its parent.
|
||||
//
|
||||
// Column has various properties to control how it sizes itself and
|
||||
// how it positions its children. Here we use mainAxisAlignment to
|
||||
// center the children vertically; the main axis here is the vertical
|
||||
// axis because Columns are vertical (the cross axis would be
|
||||
// horizontal).
|
||||
//
|
||||
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
|
||||
// action in the IDE, or press "p" in the console), to see the
|
||||
// wireframe for each widget.
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
const Text('You have pushed the button this many times:'),
|
||||
Text(
|
||||
'$_counter',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
],
|
||||
fontFamily: 'PingFang SC',
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: $styles.colors.mainColor),
|
||||
useMaterial3: true,
|
||||
scaffoldBackgroundColor: $styles.colors.bgColor,
|
||||
bottomNavigationBarTheme: BottomNavigationBarThemeData(
|
||||
backgroundColor: $styles.colors.bgColor,
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: _incrementCounter,
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.add),
|
||||
), // This trailing comma makes auto-formatting nicer for build methods.
|
||||
routerConfig: router,
|
||||
debugShowCheckedModeBanner: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _setupLogging() {
|
||||
Logger.root.level = Level.ALL; // Set the default log level
|
||||
Logger.root.onRecord.listen((LogRecord record) {
|
||||
developer.log(
|
||||
record.message, // 主要信息
|
||||
time: record.time, // 日志时间
|
||||
sequenceNumber: record.sequenceNumber, // 序列号
|
||||
level: record.level.value, // 日志级别 (数字表示)
|
||||
name: record.loggerName, // 记录器名称
|
||||
zone: record.zone, // Zone 信息 (通常为 null)
|
||||
error: record.error, // 错误对象 (如果有)
|
||||
stackTrace: record.stackTrace, // 堆栈跟踪 (如果有)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/// Global helpers
|
||||
AppStyle get $styles => AppStyle();
|
||||
|
|
|
|||
29
lib/router/router.dart
Normal file
29
lib/router/router.dart
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_samples/helpers/constants/route.dart';
|
||||
import 'package:flutter_samples/ui/home.dart';
|
||||
import 'package:flutter_samples/ui/poetry.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
||||
final GoRouter router = GoRouter(
|
||||
initialLocation: Routes.home,
|
||||
navigatorKey: navigatorKey,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: Routes.home,
|
||||
name: Routes.home,
|
||||
builder: (context, state) {
|
||||
return PoetryListPage();
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: Routes.poetry,
|
||||
name: Routes.poetry,
|
||||
builder: (context, state) {
|
||||
// todo
|
||||
final int id = int.tryParse(state.uri.queryParameters['id'] ?? '') ?? 0;
|
||||
return PoetryDetailPage(id: id);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
13
lib/styles/colors.dart
Normal file
13
lib/styles/colors.dart
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppColors {
|
||||
final Color mainColor = const Color(0xFF960405);
|
||||
final Color bgColor = const Color(0xFFF0F0F0);
|
||||
final Color borderColor = const Color(0xFFCCCCCC);
|
||||
final Color iconColor = const Color(0xFF555555);
|
||||
final Color shadowColor = Colors.black.withValues(alpha: 0.25);
|
||||
final Color white = const Color(0xFFFFFFFF);
|
||||
final Color black = const Color(0xFF333333);
|
||||
final Color gray = const Color(0xFF666666);
|
||||
final Color grey = const Color(0xFF999999);
|
||||
}
|
||||
32
lib/styles/styles.dart
Normal file
32
lib/styles/styles.dart
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_samples/styles/colors.dart';
|
||||
|
||||
@immutable
|
||||
class AppStyle {
|
||||
final AppColors colors = AppColors();
|
||||
final TextStyle normalText = const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF333333),
|
||||
fontWeight: FontWeight.w400,
|
||||
);
|
||||
final TextStyle grayText = const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF666666),
|
||||
fontWeight: FontWeight.w400,
|
||||
);
|
||||
final TextStyle tagText = const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFFFFFFFF),
|
||||
fontWeight: FontWeight.w400,
|
||||
);
|
||||
final TextStyle redText = const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color.fromARGB(255, 225, 8, 8),
|
||||
fontWeight: FontWeight.w600,
|
||||
);
|
||||
final TextStyle headerText = const TextStyle(
|
||||
fontSize: 16,
|
||||
color: Color(0xFF333333),
|
||||
fontWeight: FontWeight.w600,
|
||||
);
|
||||
}
|
||||
60
lib/ui/home.dart
Normal file
60
lib/ui/home.dart
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_samples/components/PoetryCard.dart';
|
||||
import 'package:flutter_samples/logics/services/poetry_list.dart';
|
||||
|
||||
class PoetryListPage extends ConsumerStatefulWidget {
|
||||
const PoetryListPage({super.key});
|
||||
|
||||
@override
|
||||
ConsumerState<PoetryListPage> createState() => _PoetryListPageState();
|
||||
}
|
||||
|
||||
class _PoetryListPageState extends ConsumerState<PoetryListPage> {
|
||||
final ScrollController _controller = ScrollController();
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// 初始化数据
|
||||
ref.read(poetryListServiceProvider.notifier).setUp();
|
||||
});
|
||||
// 监听滚动事件
|
||||
_controller.addListener(listener);
|
||||
}
|
||||
|
||||
void listener() {
|
||||
if (_controller.position.pixels >=
|
||||
_controller.position.maxScrollExtent - 200) {
|
||||
// 加载更多
|
||||
ref.read(poetryListServiceProvider.notifier).queryMorePoetryList();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final state = ref.watch(poetryListServiceProvider);
|
||||
final service = ref.read(poetryListServiceProvider.notifier);
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('诗词列表')),
|
||||
body:
|
||||
state.poetryData.list.isEmpty
|
||||
? const Center(child: Text("暂无数据"))
|
||||
: ListView.builder(
|
||||
itemCount:
|
||||
state.poetryData.list.length +
|
||||
(state.poetryData.loadAll ? 1 : 0),
|
||||
itemBuilder: (_, index) {
|
||||
final poetry = state.poetryData.list[index];
|
||||
return Poetrycard(
|
||||
poetry: poetry,
|
||||
onClick: () {
|
||||
// 点击诗词
|
||||
service.toPoetryDetailPage(poetry);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
59
lib/ui/poetry.dart
Normal file
59
lib/ui/poetry.dart
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_samples/components/PoetryCard.dart';
|
||||
import 'package:flutter_samples/logics/services/poetry_detail.dart';
|
||||
import 'package:flutter_samples/main.dart';
|
||||
|
||||
class PoetryDetailPage extends ConsumerStatefulWidget {
|
||||
final int id;
|
||||
const PoetryDetailPage({super.key, required this.id});
|
||||
|
||||
@override
|
||||
ConsumerState<PoetryDetailPage> createState() => _PoetryDetailPageState();
|
||||
}
|
||||
|
||||
class _PoetryDetailPageState extends ConsumerState<PoetryDetailPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// 重置数据
|
||||
ref.invalidate(poetryDetailServiceProvider);
|
||||
// 初始化数据
|
||||
ref.read(poetryDetailServiceProvider.notifier).setUp(widget.id);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final state = ref.watch(poetryDetailServiceProvider);
|
||||
final service = ref.read(poetryDetailServiceProvider.notifier);
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('诗词详情')),
|
||||
body:
|
||||
state.poetry.title.isEmpty
|
||||
? const Center(child: Text("暂无数据"))
|
||||
: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 15,
|
||||
vertical: 15,
|
||||
),
|
||||
decoration: BoxDecoration(color: $styles.colors.white),
|
||||
child: Poetrycard(
|
||||
poetry: state.poetry,
|
||||
onClick: () {
|
||||
// 点击诗词
|
||||
service.tapPoetry();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
16
lib/utils/index.dart
Normal file
16
lib/utils/index.dart
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
|
||||
void showNoneMsg(String msg) {
|
||||
Fluttertoast.showToast(
|
||||
msg: msg,
|
||||
toastLength: Toast.LENGTH_SHORT,
|
||||
gravity: ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: 1,
|
||||
backgroundColor: Colors.black.withAlpha(200),
|
||||
textColor: Colors.white,
|
||||
webPosition: 'center',
|
||||
webBgColor: 'rgba(0, 0, 0, 0.75)',
|
||||
fontSize: 16.0,
|
||||
);
|
||||
}
|
||||
|
|
@ -1 +1,2 @@
|
|||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
||||
#include "ephemeral/Flutter-Generated.xcconfig"
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
||||
#include "ephemeral/Flutter-Generated.xcconfig"
|
||||
|
|
|
|||
42
macos/Podfile
Normal file
42
macos/Podfile
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
platform :osx, '10.14'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
project 'Runner', {
|
||||
'Debug' => :debug,
|
||||
'Profile' => :release,
|
||||
'Release' => :release,
|
||||
}
|
||||
|
||||
def flutter_root
|
||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
|
||||
unless File.exist?(generated_xcode_build_settings_path)
|
||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
|
||||
end
|
||||
|
||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||
return matches[1].strip if matches
|
||||
end
|
||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
|
||||
end
|
||||
|
||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||
|
||||
flutter_macos_podfile_setup
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
|
||||
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
|
||||
target 'RunnerTests' do
|
||||
inherit! :search_paths
|
||||
end
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_macos_build_settings(target)
|
||||
end
|
||||
end
|
||||
447
pubspec.lock
447
pubspec.lock
|
|
@ -1,6 +1,30 @@
|
|||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
_fe_analyzer_shared:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: _fe_analyzer_shared
|
||||
sha256: e55636ed79578b9abca5fecf9437947798f5ef7456308b5cb85720b793eac92f
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "82.0.0"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
sha256: "13c1e6c6fd460522ea840abec3f677cc226f5fec7872c04ad7b425517ccf54f7"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "7.4.4"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.7.0"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -17,6 +41,70 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
build:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build
|
||||
sha256: cef23f1eda9b57566c81e2133d196f8e3df48f244b317368d65c5943d91148f0
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.4.2"
|
||||
build_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_config
|
||||
sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
build_daemon:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_daemon
|
||||
sha256: "8e928697a82be082206edb0b9c99c5a4ad6bc31c9e9b8b2f291ae65cd4a25daa"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "4.0.4"
|
||||
build_resolvers:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_resolvers
|
||||
sha256: b9e4fda21d846e192628e7a4f6deda6888c36b5b69ba02ff291a01fd529140f0
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.4.4"
|
||||
build_runner:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: build_runner
|
||||
sha256: "058fe9dce1de7d69c4b84fada934df3e0153dd000758c4d65964d0166779aa99"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.4.15"
|
||||
build_runner_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_runner_core
|
||||
sha256: "22e3aa1c80e0ada3722fe5b63fd43d9c8990759d0a2cf489c8c5d7b2bdebc021"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "8.0.0"
|
||||
built_collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: built_collection
|
||||
sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "5.1.1"
|
||||
built_value:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: built_value
|
||||
sha256: ea90e81dc4a25a043d9bee692d20ed6d1c4a1662a28c03a96417446c093ed6b4
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "8.9.5"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -25,6 +113,14 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
checked_yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: checked_yaml
|
||||
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -33,6 +129,14 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
code_builder:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: code_builder
|
||||
sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "4.10.1"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -41,6 +145,22 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.19.1"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: convert
|
||||
sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.1.2"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.6"
|
||||
cupertino_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -49,6 +169,30 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.8"
|
||||
dart_style:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_style
|
||||
sha256: "27eb0ae77836989a3bc541ce55595e8ceee0992807f14511552a898ddd0d88ac"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
dio:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: dio
|
||||
sha256: "253a18bbd4851fecba42f7343a1df3a9a4c1d31a2c1b37e221086b4fa8c8dbc9"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "5.8.0+1"
|
||||
dio_web_adapter:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dio_web_adapter
|
||||
sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -57,6 +201,22 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.3.2"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: file
|
||||
sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "7.0.1"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fixnum
|
||||
sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
|
|
@ -70,11 +230,136 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "5.0.0"
|
||||
flutter_riverpod:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_riverpod
|
||||
sha256: "9532ee6db4a943a1ed8383072a2e3eeda041db5657cdf6d2acecf3c21ecbe7e1"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.6.1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_web_plugins:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
fluttertoast:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: fluttertoast
|
||||
sha256: "25e51620424d92d3db3832464774a6143b5053f15e382d8ffbfd40b6e795dcf1"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "8.2.12"
|
||||
freezed:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: freezed
|
||||
sha256: "6022db4c7bfa626841b2a10f34dd1e1b68e8f8f9650db6112dcdeeca45ca793c"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.6"
|
||||
freezed_annotation:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: freezed_annotation
|
||||
sha256: c87ff004c8aa6af2d531668b46a4ea379f7191dc6dfa066acd53d506da6e044b
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: frontend_server_client
|
||||
sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
glob:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: glob
|
||||
sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
go_router:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: go_router
|
||||
sha256: "2b9ba6d4c247457c35a6622f1dee6aab6694a4e15237ff7c32320345044112b6"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "15.1.1"
|
||||
graphs:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: graphs
|
||||
sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
http:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http
|
||||
sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
http_multi_server:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_multi_server
|
||||
sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.2.2"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_parser
|
||||
sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "4.1.2"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: io
|
||||
sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.7.2"
|
||||
json_annotation:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: json_annotation
|
||||
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "4.9.0"
|
||||
json_serializable:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: json_serializable
|
||||
sha256: c50ef5fc083d5b5e12eef489503ba3bf5ccc899e487d691584699b4bdefeea8c
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "6.9.5"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -107,6 +392,14 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "5.1.1"
|
||||
logging:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: logging
|
||||
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -131,6 +424,22 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.16.0"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: mime
|
||||
sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
package_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_config
|
||||
sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -139,11 +448,75 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pool
|
||||
sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.5.1"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pub_semver
|
||||
sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
pubspec_parse:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pubspec_parse
|
||||
sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.5.0"
|
||||
riverpod:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: riverpod
|
||||
sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.6.1"
|
||||
shelf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf
|
||||
sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.4.2"
|
||||
shelf_web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_web_socket
|
||||
sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
source_gen:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_gen
|
||||
sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
source_helper:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_helper
|
||||
sha256: "86d247119aedce8e63f4751bd9626fc9613255935558447569ad42f9f5b48b3c"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.3.5"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -160,6 +533,14 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.12.1"
|
||||
state_notifier:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: state_notifier
|
||||
sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -168,6 +549,14 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
stream_transform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_transform
|
||||
sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -192,6 +581,22 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.7.4"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: timing
|
||||
sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: typed_data
|
||||
sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -208,6 +613,46 @@ packages:
|
|||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "14.3.1"
|
||||
watcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: watcher
|
||||
sha256: "69da27e49efa56a15f8afe8f4438c4ec02eff0a117df1b22ea4aad194fe1c104"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web
|
||||
sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web_socket
|
||||
sha256: bfe6f435f6ec49cb6c01da1e275ae4228719e59a6b067048c51e72d9d63bcc4b
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
web_socket_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web_socket_channel
|
||||
sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: yaml
|
||||
sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.1.3"
|
||||
sdks:
|
||||
dart: ">=3.7.2 <4.0.0"
|
||||
flutter: ">=3.18.0-18.0.pre.54"
|
||||
flutter: ">=3.22.0"
|
||||
|
|
|
|||
11
pubspec.yaml
11
pubspec.yaml
|
|
@ -34,6 +34,14 @@ dependencies:
|
|||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.8
|
||||
dio: ^5.8.0+1
|
||||
freezed_annotation: ^3.0.0
|
||||
json_annotation: ^4.9.0
|
||||
logging: ^1.3.0
|
||||
go_router: ^15.1.1
|
||||
riverpod: ^2.6.1
|
||||
flutter_riverpod: ^2.6.1
|
||||
fluttertoast: ^8.2.12
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
@ -45,6 +53,9 @@ dev_dependencies:
|
|||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^5.0.0
|
||||
build_runner: ^2.4.15
|
||||
freezed: ^3.0.6
|
||||
json_serializable: ^6.9.5
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user