Showing
8 changed files
with
403 additions
and
312 deletions
lib/account/models/my_videos_entity.dart
0 → 100644
| 1 | +import 'dart:convert'; | ||
| 2 | +import 'package:Parlando/generated/json/base/json_field.dart'; | ||
| 3 | +import 'package:Parlando/generated/json/my_videos_entity.g.dart'; | ||
| 4 | + | ||
| 5 | +@JsonSerializable() | ||
| 6 | +class MyVideosEntity { | ||
| 7 | + String? status; | ||
| 8 | + int? code; | ||
| 9 | + String? message; | ||
| 10 | + List<MyVideosData>? data; | ||
| 11 | + MyVideosError? error; | ||
| 12 | + | ||
| 13 | + MyVideosEntity(); | ||
| 14 | + | ||
| 15 | + factory MyVideosEntity.fromJson(Map<String, dynamic> json) => | ||
| 16 | + $MyVideosEntityFromJson(json); | ||
| 17 | + | ||
| 18 | + Map<String, dynamic> toJson() => $MyVideosEntityToJson(this); | ||
| 19 | + | ||
| 20 | + @override | ||
| 21 | + String toString() { | ||
| 22 | + return jsonEncode(this); | ||
| 23 | + } | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +@JsonSerializable() | ||
| 27 | +class MyVideosData { | ||
| 28 | + int? id; | ||
| 29 | + @JSONField(name: "user_id") | ||
| 30 | + int? userId; | ||
| 31 | + String? title; | ||
| 32 | + String? content; | ||
| 33 | + String? url; | ||
| 34 | + int? type; | ||
| 35 | + String? duration; | ||
| 36 | + String? size; | ||
| 37 | + @JSONField(name: "poem_id") | ||
| 38 | + int? poemId; | ||
| 39 | + @JSONField(name: "temp_id") | ||
| 40 | + int? tempId; | ||
| 41 | + String? thumbnail; | ||
| 42 | + dynamic bgm; | ||
| 43 | + String? praise; | ||
| 44 | + String? view; | ||
| 45 | + String? collect; | ||
| 46 | + String? share; | ||
| 47 | + String? comment; | ||
| 48 | + String? state; | ||
| 49 | + @JSONField(name: "is_publish") | ||
| 50 | + String? isPublish; | ||
| 51 | + @JSONField(name: "is_check") | ||
| 52 | + String? isCheck; | ||
| 53 | + @JSONField(name: "created_at") | ||
| 54 | + String? createdAt; | ||
| 55 | + @JSONField(name: "updated_at") | ||
| 56 | + String? updatedAt; | ||
| 57 | + | ||
| 58 | + MyVideosData(); | ||
| 59 | + | ||
| 60 | + factory MyVideosData.fromJson(Map<String, dynamic> json) => | ||
| 61 | + $MyVideosDataFromJson(json); | ||
| 62 | + | ||
| 63 | + Map<String, dynamic> toJson() => $MyVideosDataToJson(this); | ||
| 64 | + | ||
| 65 | + @override | ||
| 66 | + String toString() { | ||
| 67 | + return jsonEncode(this); | ||
| 68 | + } | ||
| 69 | +} | ||
| 70 | + | ||
| 71 | +@JsonSerializable() | ||
| 72 | +class MyVideosError { | ||
| 73 | + MyVideosError(); | ||
| 74 | + | ||
| 75 | + factory MyVideosError.fromJson(Map<String, dynamic> json) => | ||
| 76 | + $MyVideosErrorFromJson(json); | ||
| 77 | + | ||
| 78 | + Map<String, dynamic> toJson() => $MyVideosErrorToJson(this); | ||
| 79 | + | ||
| 80 | + @override | ||
| 81 | + String toString() { | ||
| 82 | + return jsonEncode(this); | ||
| 83 | + } | ||
| 84 | +} |
| 1 | +import 'package:Parlando/account/models/my_videos_entity.dart'; | ||
| 1 | import 'package:Parlando/account/models/user_entity.dart'; | 2 | import 'package:Parlando/account/models/user_entity.dart'; |
| 2 | import 'package:Parlando/account/view_models/account_view_model.dart'; | 3 | import 'package:Parlando/account/view_models/account_view_model.dart'; |
| 3 | import 'package:Parlando/apis/api_response.dart'; | 4 | import 'package:Parlando/apis/api_response.dart'; |
| 4 | import 'package:Parlando/login/login_router.dart'; | 5 | import 'package:Parlando/login/login_router.dart'; |
| 6 | +import 'package:Parlando/net/dio_utils.dart'; | ||
| 7 | +import 'package:Parlando/net/http_api.dart'; | ||
| 5 | import 'package:Parlando/res/constant.dart'; | 8 | import 'package:Parlando/res/constant.dart'; |
| 6 | import 'package:Parlando/routers/routers.dart'; | 9 | import 'package:Parlando/routers/routers.dart'; |
| 7 | import 'package:cached_network_image/cached_network_image.dart'; | 10 | import 'package:cached_network_image/cached_network_image.dart'; |
| ... | @@ -12,6 +15,7 @@ import 'package:Parlando/poem/poem_router.dart'; | ... | @@ -12,6 +15,7 @@ import 'package:Parlando/poem/poem_router.dart'; |
| 12 | import 'package:Parlando/routers/fluro_navigator.dart'; | 15 | import 'package:Parlando/routers/fluro_navigator.dart'; |
| 13 | import 'package:Parlando/setting/setting_router.dart'; | 16 | import 'package:Parlando/setting/setting_router.dart'; |
| 14 | import 'package:Parlando/tiktok/style/style.dart'; | 17 | import 'package:Parlando/tiktok/style/style.dart'; |
| 18 | +import 'package:getwidget/getwidget.dart'; | ||
| 15 | import 'package:provider/provider.dart'; | 19 | import 'package:provider/provider.dart'; |
| 16 | import 'package:tapped/tapped.dart'; | 20 | import 'package:tapped/tapped.dart'; |
| 17 | import 'package:flutter_gen/gen_l10n/Parlando_localizations.dart'; | 21 | import 'package:flutter_gen/gen_l10n/Parlando_localizations.dart'; |
| ... | @@ -35,10 +39,13 @@ class AccountPage extends StatefulWidget { | ... | @@ -35,10 +39,13 @@ class AccountPage extends StatefulWidget { |
| 35 | final Function? onSwitch; | 39 | final Function? onSwitch; |
| 36 | 40 | ||
| 37 | @override | 41 | @override |
| 38 | - _AccountPageState createState() => _AccountPageState(); | 42 | + AccountPageState createState() => AccountPageState(); |
| 39 | } | 43 | } |
| 40 | 44 | ||
| 41 | -class _AccountPageState extends State<AccountPage> { | 45 | +class AccountPageState extends State<AccountPage> { |
| 46 | + bool isLoadMyVideos = false; | ||
| 47 | + List<Widget> videos = <Widget>[]; | ||
| 48 | + | ||
| 42 | @override | 49 | @override |
| 43 | void initState() { | 50 | void initState() { |
| 44 | super.initState(); | 51 | super.initState(); |
| ... | @@ -48,6 +55,24 @@ class _AccountPageState extends State<AccountPage> { | ... | @@ -48,6 +55,24 @@ class _AccountPageState extends State<AccountPage> { |
| 48 | .setSelectedAccount(null); | 55 | .setSelectedAccount(null); |
| 49 | Provider.of<AccountViewProvider>(context, listen: false) | 56 | Provider.of<AccountViewProvider>(context, listen: false) |
| 50 | .fetchAccountData('0'); | 57 | .fetchAccountData('0'); |
| 58 | + | ||
| 59 | + isLoadMyVideos = true; | ||
| 60 | + // 加载作品 | ||
| 61 | + DioUtils.instance.asyncRequestNetwork<MyVideosEntity>( | ||
| 62 | + Method.get, | ||
| 63 | + HttpApi.myVideos, | ||
| 64 | + params: [], | ||
| 65 | + onSuccess: (data) { | ||
| 66 | + for (MyVideosData each in data!.data!) { | ||
| 67 | + videos.add(_SmallVideo()); | ||
| 68 | + } | ||
| 69 | + isLoadMyVideos = false; | ||
| 70 | + setState(() {}); | ||
| 71 | + }, | ||
| 72 | + onError: (code, msg) { | ||
| 73 | + isLoadMyVideos = false; | ||
| 74 | + }, | ||
| 75 | + ); | ||
| 51 | } else { | 76 | } else { |
| 52 | NavigatorUtils.push(context, LoginRouter.loginPage, replace: true); | 77 | NavigatorUtils.push(context, LoginRouter.loginPage, replace: true); |
| 53 | } | 78 | } |
| ... | @@ -61,7 +86,7 @@ class _AccountPageState extends State<AccountPage> { | ... | @@ -61,7 +86,7 @@ class _AccountPageState extends State<AccountPage> { |
| 61 | case Status.LOADING: | 86 | case Status.LOADING: |
| 62 | return const Center(child: CircularProgressIndicator()); | 87 | return const Center(child: CircularProgressIndicator()); |
| 63 | case Status.COMPLETED: | 88 | case Status.COMPLETED: |
| 64 | - UserData _user = apiResponse.data as UserData; | 89 | + UserData user = apiResponse.data as UserData; |
| 65 | Widget likeButton = Container( | 90 | Widget likeButton = Container( |
| 66 | color: ColorPlate.white, | 91 | color: ColorPlate.white, |
| 67 | child: Row( | 92 | child: Row( |
| ... | @@ -105,16 +130,13 @@ class _AccountPageState extends State<AccountPage> { | ... | @@ -105,16 +130,13 @@ class _AccountPageState extends State<AccountPage> { |
| 105 | placeholder: (context, url) => | 130 | placeholder: (context, url) => |
| 106 | const CircularProgressIndicator(), | 131 | const CircularProgressIndicator(), |
| 107 | errorWidget: (context, url, error) => const Icon(Icons.error), | 132 | errorWidget: (context, url, error) => const Icon(Icons.error), |
| 108 | - imageUrl: _user.avatar!, | 133 | + imageUrl: user.avatar!, |
| 109 | ), | 134 | ), |
| 110 | ), | 135 | ), |
| 111 | ), | 136 | ), |
| 112 | ), | 137 | ), |
| 113 | ); | 138 | ); |
| 114 | Widget body = ListView( | 139 | Widget body = ListView( |
| 115 | - physics: const BouncingScrollPhysics( | ||
| 116 | - parent: AlwaysScrollableScrollPhysics(), | ||
| 117 | - ), | ||
| 118 | children: <Widget>[ | 140 | children: <Widget>[ |
| 119 | Stack( | 141 | Stack( |
| 120 | alignment: Alignment.bottomLeft, | 142 | alignment: Alignment.bottomLeft, |
| ... | @@ -140,6 +162,30 @@ class _AccountPageState extends State<AccountPage> { | ... | @@ -140,6 +162,30 @@ class _AccountPageState extends State<AccountPage> { |
| 140 | }, | 162 | }, |
| 141 | ), | 163 | ), |
| 142 | ), | 164 | ), |
| 165 | + Positioned( | ||
| 166 | + right: 5.px, | ||
| 167 | + top: 10.px, | ||
| 168 | + child: Container( | ||
| 169 | + alignment: Alignment.centerRight, | ||
| 170 | + height: 64.px, | ||
| 171 | + width: 64.px, | ||
| 172 | + child: Row( | ||
| 173 | + mainAxisAlignment: MainAxisAlignment.end, | ||
| 174 | + children: [ | ||
| 175 | + IconButton( | ||
| 176 | + icon: const Icon( | ||
| 177 | + Icons.settings_outlined, | ||
| 178 | + color: Colors.black54, | ||
| 179 | + ), | ||
| 180 | + onPressed: () { | ||
| 181 | + NavigatorUtils.push( | ||
| 182 | + context, SettingRouter.settingPage); | ||
| 183 | + }, | ||
| 184 | + ), | ||
| 185 | + ], | ||
| 186 | + ), | ||
| 187 | + ), | ||
| 188 | + ), | ||
| 143 | ], | 189 | ], |
| 144 | ), | 190 | ), |
| 145 | Container( | 191 | Container( |
| ... | @@ -153,7 +199,7 @@ class _AccountPageState extends State<AccountPage> { | ... | @@ -153,7 +199,7 @@ class _AccountPageState extends State<AccountPage> { |
| 153 | crossAxisAlignment: CrossAxisAlignment.start, | 199 | crossAxisAlignment: CrossAxisAlignment.start, |
| 154 | children: <Widget>[ | 200 | children: <Widget>[ |
| 155 | Text( | 201 | Text( |
| 156 | - _user.email ?? '@唐宋八大家TOP8', | 202 | + user.email ?? '@唐宋八大家TOP8', |
| 157 | style: StandardTextStyle.big, | 203 | style: StandardTextStyle.big, |
| 158 | ), | 204 | ), |
| 159 | Container(height: 8.px), | 205 | Container(height: 8.px), |
| ... | @@ -203,7 +249,20 @@ class _AccountPageState extends State<AccountPage> { | ... | @@ -203,7 +249,20 @@ class _AccountPageState extends State<AccountPage> { |
| 203 | ), | 249 | ), |
| 204 | ), | 250 | ), |
| 205 | ), | 251 | ), |
| 206 | - const _UserVideoTable(), | 252 | + SizedBox( |
| 253 | + width: double.infinity, | ||
| 254 | + height: 500, | ||
| 255 | + child: isLoadMyVideos | ||
| 256 | + ? const GFLoader() | ||
| 257 | + : GridView( | ||
| 258 | + gridDelegate: | ||
| 259 | + const SliverGridDelegateWithFixedCrossAxisCount( | ||
| 260 | + crossAxisCount: 3, //横轴三个子widget | ||
| 261 | + childAspectRatio: 1.0 //宽高比为1时,子widget | ||
| 262 | + ), | ||
| 263 | + children: videos, | ||
| 264 | + ), | ||
| 265 | + ), | ||
| 207 | ], | 266 | ], |
| 208 | ), | 267 | ), |
| 209 | ), | 268 | ), |
| ... | @@ -211,44 +270,7 @@ class _AccountPageState extends State<AccountPage> { | ... | @@ -211,44 +270,7 @@ class _AccountPageState extends State<AccountPage> { |
| 211 | ); | 270 | ); |
| 212 | return Scaffold( | 271 | return Scaffold( |
| 213 | body: Container( | 272 | body: Container( |
| 214 | - decoration: const BoxDecoration( | 273 | + child: body, |
| 215 | - image: DecorationImage( | ||
| 216 | - image: AssetImage("assets/images/poem/poem_background.png"), | ||
| 217 | - fit: BoxFit.fill, | ||
| 218 | - ), | ||
| 219 | - ), | ||
| 220 | - child: Stack( | ||
| 221 | - alignment: Alignment.topCenter, | ||
| 222 | - children: <Widget>[ | ||
| 223 | - Container( | ||
| 224 | - margin: const EdgeInsets.only(top: 500), | ||
| 225 | - height: double.infinity, | ||
| 226 | - width: double.infinity, | ||
| 227 | - color: ColorPlate.white, | ||
| 228 | - ), | ||
| 229 | - body, | ||
| 230 | - Container( | ||
| 231 | - alignment: Alignment.centerRight, | ||
| 232 | - height: 64.px, | ||
| 233 | - width: double.infinity, | ||
| 234 | - child: Row( | ||
| 235 | - mainAxisAlignment: MainAxisAlignment.end, | ||
| 236 | - children: [ | ||
| 237 | - IconButton( | ||
| 238 | - icon: const Icon( | ||
| 239 | - Icons.settings_outlined, | ||
| 240 | - color: Colors.black54, | ||
| 241 | - ), | ||
| 242 | - onPressed: () { | ||
| 243 | - NavigatorUtils.push( | ||
| 244 | - context, SettingRouter.settingPage); | ||
| 245 | - }, | ||
| 246 | - ), | ||
| 247 | - ], | ||
| 248 | - ), | ||
| 249 | - ), | ||
| 250 | - ], | ||
| 251 | - ), | ||
| 252 | ), | 274 | ), |
| 253 | bottomNavigationBar: Consumer( | 275 | bottomNavigationBar: Consumer( |
| 254 | builder: (_, provider, __) { | 276 | builder: (_, provider, __) { |
| ... | @@ -298,7 +320,7 @@ class _AccountPageState extends State<AccountPage> { | ... | @@ -298,7 +320,7 @@ class _AccountPageState extends State<AccountPage> { |
| 298 | ); | 320 | ); |
| 299 | case Status.ERROR: | 321 | case Status.ERROR: |
| 300 | return Center( | 322 | return Center( |
| 301 | - child: Text('暂时无法获取数据,请稍候再试!' + apiResponse.message.toString()), | 323 | + child: Text('暂时无法获取数据,请稍候再试!${apiResponse.message}'), |
| 302 | ); | 324 | ); |
| 303 | case Status.INITIAL: | 325 | case Status.INITIAL: |
| 304 | default: | 326 | default: |
| ... | @@ -326,14 +348,14 @@ class _MembershipButton extends StatelessWidget { | ... | @@ -326,14 +348,14 @@ class _MembershipButton extends StatelessWidget { |
| 326 | ), | 348 | ), |
| 327 | margin: EdgeInsets.all(8.px), | 349 | margin: EdgeInsets.all(8.px), |
| 328 | alignment: Alignment.center, | 350 | alignment: Alignment.center, |
| 329 | - child: Text( | ||
| 330 | - title, | ||
| 331 | - style: const TextStyle(color: ColorPlate.orange), | ||
| 332 | - ), | ||
| 333 | decoration: BoxDecoration( | 351 | decoration: BoxDecoration( |
| 334 | border: Border.all(color: ColorPlate.orange), | 352 | border: Border.all(color: ColorPlate.orange), |
| 335 | borderRadius: BorderRadius.circular(4.px), | 353 | borderRadius: BorderRadius.circular(4.px), |
| 336 | ), | 354 | ), |
| 355 | + child: Text( | ||
| 356 | + title, | ||
| 357 | + style: const TextStyle(color: ColorPlate.orange), | ||
| 358 | + ), | ||
| 337 | ); | 359 | ); |
| 338 | } | 360 | } |
| 339 | } | 361 | } |
| ... | @@ -466,12 +488,11 @@ class _PointSelectTextButton extends StatelessWidget { | ... | @@ -466,12 +488,11 @@ class _PointSelectTextButton extends StatelessWidget { |
| 466 | final String title; | 488 | final String title; |
| 467 | final Function? onTap; | 489 | final Function? onTap; |
| 468 | 490 | ||
| 469 | - const _PointSelectTextButton( | 491 | + const _PointSelectTextButton(this.isSelect, |
| 470 | - this.isSelect, | 492 | + this.title, { |
| 471 | - this.title, { | 493 | + Key? key, |
| 472 | - Key? key, | 494 | + this.onTap, |
| 473 | - this.onTap, | 495 | + }) : super(key: key); |
| 474 | - }) : super(key: key); | ||
| 475 | 496 | ||
| 476 | @override | 497 | @override |
| 477 | Widget build(BuildContext context) { | 498 | Widget build(BuildContext context) { |
| ... | @@ -481,13 +502,13 @@ class _PointSelectTextButton extends StatelessWidget { | ... | @@ -481,13 +502,13 @@ class _PointSelectTextButton extends StatelessWidget { |
| 481 | children: <Widget>[ | 502 | children: <Widget>[ |
| 482 | isSelect | 503 | isSelect |
| 483 | ? Container( | 504 | ? Container( |
| 484 | - width: 6.px, | 505 | + width: 6.px, |
| 485 | - height: 6.px, | 506 | + height: 6.px, |
| 486 | - decoration: BoxDecoration( | 507 | + decoration: BoxDecoration( |
| 487 | - color: ColorPlate.orange, | 508 | + color: ColorPlate.orange, |
| 488 | - borderRadius: BorderRadius.circular(3), | 509 | + borderRadius: BorderRadius.circular(3), |
| 489 | - ), | 510 | + ), |
| 490 | - ) | 511 | + ) |
| 491 | : Container(), | 512 | : Container(), |
| 492 | Container( | 513 | Container( |
| 493 | padding: const EdgeInsets.only(left: 2), | 514 | padding: const EdgeInsets.only(left: 2), |
| ... | @@ -506,12 +527,11 @@ class TextGroup extends StatelessWidget { | ... | @@ -506,12 +527,11 @@ class TextGroup extends StatelessWidget { |
| 506 | final String title, tag; | 527 | final String title, tag; |
| 507 | final Color? color; | 528 | final Color? color; |
| 508 | 529 | ||
| 509 | - const TextGroup( | 530 | + const TextGroup(this.title, |
| 510 | - this.title, | 531 | + this.tag, { |
| 511 | - this.tag, { | 532 | + Key? key, |
| 512 | - Key? key, | 533 | + this.color, |
| 513 | - this.color, | 534 | + }) : super(key: key); |
| 514 | - }) : super(key: key); | ||
| 515 | 535 | ||
| 516 | @override | 536 | @override |
| 517 | Widget build(BuildContext context) { | 537 | Widget build(BuildContext context) { | ... | ... |
| ... | @@ -4,6 +4,7 @@ | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | ||
| 5 | // This file is automatically generated. DO NOT EDIT, all your changes would be lost. | 5 | // This file is automatically generated. DO NOT EDIT, all your changes would be lost. |
| 6 | import 'package:flutter/material.dart'; | 6 | import 'package:flutter/material.dart'; |
| 7 | +import 'package:Parlando/account/models/my_videos_entity.dart'; | ||
| 7 | import 'package:Parlando/account/models/upload_avatar_entity.dart'; | 8 | import 'package:Parlando/account/models/upload_avatar_entity.dart'; |
| 8 | import 'package:Parlando/account/models/user_entity.dart'; | 9 | import 'package:Parlando/account/models/user_entity.dart'; |
| 9 | import 'package:Parlando/category/models/category_entity.dart'; | 10 | import 'package:Parlando/category/models/category_entity.dart'; |
| ... | @@ -21,6 +22,9 @@ typedef JsonConvertFunction<T> = T Function(Map<String, dynamic> json); | ... | @@ -21,6 +22,9 @@ typedef JsonConvertFunction<T> = T Function(Map<String, dynamic> json); |
| 21 | 22 | ||
| 22 | class JsonConvert { | 23 | class JsonConvert { |
| 23 | static final Map<String, JsonConvertFunction> _convertFuncMap = { | 24 | static final Map<String, JsonConvertFunction> _convertFuncMap = { |
| 25 | + (MyVideosEntity).toString(): MyVideosEntity.fromJson, | ||
| 26 | + (MyVideosData).toString(): MyVideosData.fromJson, | ||
| 27 | + (MyVideosError).toString(): MyVideosError.fromJson, | ||
| 24 | (UploadAvatarEntity).toString(): UploadAvatarEntity.fromJson, | 28 | (UploadAvatarEntity).toString(): UploadAvatarEntity.fromJson, |
| 25 | (UploadAvatarData).toString(): UploadAvatarData.fromJson, | 29 | (UploadAvatarData).toString(): UploadAvatarData.fromJson, |
| 26 | (UploadAvatarError).toString(): UploadAvatarError.fromJson, | 30 | (UploadAvatarError).toString(): UploadAvatarError.fromJson, |
| ... | @@ -38,9 +42,6 @@ class JsonConvert { | ... | @@ -38,9 +42,6 @@ class JsonConvert { |
| 38 | (CategoryItemEntity).toString(): CategoryItemEntity.fromJson, | 42 | (CategoryItemEntity).toString(): CategoryItemEntity.fromJson, |
| 39 | (HomeEntity).toString(): HomeEntity.fromJson, | 43 | (HomeEntity).toString(): HomeEntity.fromJson, |
| 40 | (HomeData).toString(): HomeData.fromJson, | 44 | (HomeData).toString(): HomeData.fromJson, |
| 41 | - (HomeDataData).toString(): HomeDataData.fromJson, | ||
| 42 | - (HomeDataMeta).toString(): HomeDataMeta.fromJson, | ||
| 43 | - (HomeDataMetaPagination).toString(): HomeDataMetaPagination.fromJson, | ||
| 44 | (HomeError).toString(): HomeError.fromJson, | 45 | (HomeError).toString(): HomeError.fromJson, |
| 45 | (SettingEntity).toString(): SettingEntity.fromJson, | 46 | (SettingEntity).toString(): SettingEntity.fromJson, |
| 46 | (SettingData).toString(): SettingData.fromJson, | 47 | (SettingData).toString(): SettingData.fromJson, |
| ... | @@ -134,6 +135,24 @@ class JsonConvert { | ... | @@ -134,6 +135,24 @@ class JsonConvert { |
| 134 | 135 | ||
| 135 | //list is returned by type | 136 | //list is returned by type |
| 136 | static M? _getListChildType<M>(List<Map<String, dynamic>> data) { | 137 | static M? _getListChildType<M>(List<Map<String, dynamic>> data) { |
| 138 | + if (<MyVideosEntity>[] is M) { | ||
| 139 | + return data | ||
| 140 | + .map<MyVideosEntity>( | ||
| 141 | + (Map<String, dynamic> e) => MyVideosEntity.fromJson(e)) | ||
| 142 | + .toList() as M; | ||
| 143 | + } | ||
| 144 | + if (<MyVideosData>[] is M) { | ||
| 145 | + return data | ||
| 146 | + .map<MyVideosData>( | ||
| 147 | + (Map<String, dynamic> e) => MyVideosData.fromJson(e)) | ||
| 148 | + .toList() as M; | ||
| 149 | + } | ||
| 150 | + if (<MyVideosError>[] is M) { | ||
| 151 | + return data | ||
| 152 | + .map<MyVideosError>( | ||
| 153 | + (Map<String, dynamic> e) => MyVideosError.fromJson(e)) | ||
| 154 | + .toList() as M; | ||
| 155 | + } | ||
| 137 | if (<UploadAvatarEntity>[] is M) { | 156 | if (<UploadAvatarEntity>[] is M) { |
| 138 | return data | 157 | return data |
| 139 | .map<UploadAvatarEntity>( | 158 | .map<UploadAvatarEntity>( |
| ... | @@ -225,24 +244,6 @@ class JsonConvert { | ... | @@ -225,24 +244,6 @@ class JsonConvert { |
| 225 | .map<HomeData>((Map<String, dynamic> e) => HomeData.fromJson(e)) | 244 | .map<HomeData>((Map<String, dynamic> e) => HomeData.fromJson(e)) |
| 226 | .toList() as M; | 245 | .toList() as M; |
| 227 | } | 246 | } |
| 228 | - if (<HomeDataData>[] is M) { | ||
| 229 | - return data | ||
| 230 | - .map<HomeDataData>( | ||
| 231 | - (Map<String, dynamic> e) => HomeDataData.fromJson(e)) | ||
| 232 | - .toList() as M; | ||
| 233 | - } | ||
| 234 | - if (<HomeDataMeta>[] is M) { | ||
| 235 | - return data | ||
| 236 | - .map<HomeDataMeta>( | ||
| 237 | - (Map<String, dynamic> e) => HomeDataMeta.fromJson(e)) | ||
| 238 | - .toList() as M; | ||
| 239 | - } | ||
| 240 | - if (<HomeDataMetaPagination>[] is M) { | ||
| 241 | - return data | ||
| 242 | - .map<HomeDataMetaPagination>( | ||
| 243 | - (Map<String, dynamic> e) => HomeDataMetaPagination.fromJson(e)) | ||
| 244 | - .toList() as M; | ||
| 245 | - } | ||
| 246 | if (<HomeError>[] is M) { | 247 | if (<HomeError>[] is M) { |
| 247 | return data | 248 | return data |
| 248 | .map<HomeError>((Map<String, dynamic> e) => HomeError.fromJson(e)) | 249 | .map<HomeError>((Map<String, dynamic> e) => HomeError.fromJson(e)) | ... | ... |
| ... | @@ -15,7 +15,8 @@ HomeEntity $HomeEntityFromJson(Map<String, dynamic> json) { | ... | @@ -15,7 +15,8 @@ HomeEntity $HomeEntityFromJson(Map<String, dynamic> json) { |
| 15 | if (message != null) { | 15 | if (message != null) { |
| 16 | homeEntity.message = message; | 16 | homeEntity.message = message; |
| 17 | } | 17 | } |
| 18 | - final HomeData? data = jsonConvert.convert<HomeData>(json['data']); | 18 | + final List<HomeData>? data = |
| 19 | + jsonConvert.convertListNotNull<HomeData>(json['data']); | ||
| 19 | if (data != null) { | 20 | if (data != null) { |
| 20 | homeEntity.data = data; | 21 | homeEntity.data = data; |
| 21 | } | 22 | } |
| ... | @@ -31,126 +32,69 @@ Map<String, dynamic> $HomeEntityToJson(HomeEntity entity) { | ... | @@ -31,126 +32,69 @@ Map<String, dynamic> $HomeEntityToJson(HomeEntity entity) { |
| 31 | data['status'] = entity.status; | 32 | data['status'] = entity.status; |
| 32 | data['code'] = entity.code; | 33 | data['code'] = entity.code; |
| 33 | data['message'] = entity.message; | 34 | data['message'] = entity.message; |
| 34 | - data['data'] = entity.data?.toJson(); | 35 | + data['data'] = entity.data?.map((v) => v.toJson()).toList(); |
| 35 | data['error'] = entity.error?.toJson(); | 36 | data['error'] = entity.error?.toJson(); |
| 36 | return data; | 37 | return data; |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 39 | HomeData $HomeDataFromJson(Map<String, dynamic> json) { | 40 | HomeData $HomeDataFromJson(Map<String, dynamic> json) { |
| 40 | final HomeData homeData = HomeData(); | 41 | final HomeData homeData = HomeData(); |
| 41 | - final List<HomeDataData>? data = | ||
| 42 | - jsonConvert.convertListNotNull<HomeDataData>(json['data']); | ||
| 43 | - if (data != null) { | ||
| 44 | - homeData.data = data; | ||
| 45 | - } | ||
| 46 | - final HomeDataMeta? meta = jsonConvert.convert<HomeDataMeta>(json['meta']); | ||
| 47 | - if (meta != null) { | ||
| 48 | - homeData.meta = meta; | ||
| 49 | - } | ||
| 50 | - return homeData; | ||
| 51 | -} | ||
| 52 | - | ||
| 53 | -Map<String, dynamic> $HomeDataToJson(HomeData entity) { | ||
| 54 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 55 | - data['data'] = entity.data?.map((v) => v.toJson()).toList(); | ||
| 56 | - data['meta'] = entity.meta?.toJson(); | ||
| 57 | - return data; | ||
| 58 | -} | ||
| 59 | - | ||
| 60 | -HomeDataData $HomeDataDataFromJson(Map<String, dynamic> json) { | ||
| 61 | - final HomeDataData homeDataData = HomeDataData(); | ||
| 62 | final int? id = jsonConvert.convert<int>(json['id']); | 42 | final int? id = jsonConvert.convert<int>(json['id']); |
| 63 | if (id != null) { | 43 | if (id != null) { |
| 64 | - homeDataData.id = id; | 44 | + homeData.id = id; |
| 65 | } | 45 | } |
| 66 | - final String? userId = jsonConvert.convert<String>(json['user_id']); | 46 | + final int? userId = jsonConvert.convert<int>(json['user_id']); |
| 67 | if (userId != null) { | 47 | if (userId != null) { |
| 68 | - homeDataData.userId = userId; | 48 | + homeData.userId = userId; |
| 69 | } | 49 | } |
| 70 | final String? title = jsonConvert.convert<String>(json['title']); | 50 | final String? title = jsonConvert.convert<String>(json['title']); |
| 71 | if (title != null) { | 51 | if (title != null) { |
| 72 | - homeDataData.title = title; | 52 | + homeData.title = title; |
| 73 | } | 53 | } |
| 74 | final String? content = jsonConvert.convert<String>(json['content']); | 54 | final String? content = jsonConvert.convert<String>(json['content']); |
| 75 | if (content != null) { | 55 | if (content != null) { |
| 76 | - homeDataData.content = content; | 56 | + homeData.content = content; |
| 77 | } | 57 | } |
| 78 | final String? url = jsonConvert.convert<String>(json['url']); | 58 | final String? url = jsonConvert.convert<String>(json['url']); |
| 79 | if (url != null) { | 59 | if (url != null) { |
| 80 | - homeDataData.url = url; | 60 | + homeData.url = url; |
| 81 | } | 61 | } |
| 82 | - final String? type = jsonConvert.convert<String>(json['type']); | 62 | + final int? type = jsonConvert.convert<int>(json['type']); |
| 83 | if (type != null) { | 63 | if (type != null) { |
| 84 | - homeDataData.type = type; | 64 | + homeData.type = type; |
| 85 | - } | ||
| 86 | - final String? duration = jsonConvert.convert<String>(json['duration']); | ||
| 87 | - if (duration != null) { | ||
| 88 | - homeDataData.duration = duration; | ||
| 89 | - } | ||
| 90 | - final String? size = jsonConvert.convert<String>(json['size']); | ||
| 91 | - if (size != null) { | ||
| 92 | - homeDataData.size = size; | ||
| 93 | } | 65 | } |
| 94 | - final String? poemId = jsonConvert.convert<String>(json['poem_id']); | 66 | + final int? poemId = jsonConvert.convert<int>(json['poem_id']); |
| 95 | if (poemId != null) { | 67 | if (poemId != null) { |
| 96 | - homeDataData.poemId = poemId; | 68 | + homeData.poemId = poemId; |
| 97 | } | 69 | } |
| 98 | - final String? tempId = jsonConvert.convert<String>(json['temp_id']); | 70 | + final int? tempId = jsonConvert.convert<int>(json['temp_id']); |
| 99 | if (tempId != null) { | 71 | if (tempId != null) { |
| 100 | - homeDataData.tempId = tempId; | 72 | + homeData.tempId = tempId; |
| 101 | - } | ||
| 102 | - final String? thumbnail = jsonConvert.convert<String>(json['thumbnail']); | ||
| 103 | - if (thumbnail != null) { | ||
| 104 | - homeDataData.thumbnail = thumbnail; | ||
| 105 | } | 73 | } |
| 106 | final String? bgm = jsonConvert.convert<String>(json['bgm']); | 74 | final String? bgm = jsonConvert.convert<String>(json['bgm']); |
| 107 | if (bgm != null) { | 75 | if (bgm != null) { |
| 108 | - homeDataData.bgm = bgm; | 76 | + homeData.bgm = bgm; |
| 109 | } | 77 | } |
| 110 | final String? praise = jsonConvert.convert<String>(json['praise']); | 78 | final String? praise = jsonConvert.convert<String>(json['praise']); |
| 111 | if (praise != null) { | 79 | if (praise != null) { |
| 112 | - homeDataData.praise = praise; | 80 | + homeData.praise = praise; |
| 113 | } | 81 | } |
| 114 | final String? view = jsonConvert.convert<String>(json['view']); | 82 | final String? view = jsonConvert.convert<String>(json['view']); |
| 115 | if (view != null) { | 83 | if (view != null) { |
| 116 | - homeDataData.view = view; | 84 | + homeData.view = view; |
| 117 | } | 85 | } |
| 118 | final String? collect = jsonConvert.convert<String>(json['collect']); | 86 | final String? collect = jsonConvert.convert<String>(json['collect']); |
| 119 | if (collect != null) { | 87 | if (collect != null) { |
| 120 | - homeDataData.collect = collect; | 88 | + homeData.collect = collect; |
| 121 | } | 89 | } |
| 122 | final String? share = jsonConvert.convert<String>(json['share']); | 90 | final String? share = jsonConvert.convert<String>(json['share']); |
| 123 | if (share != null) { | 91 | if (share != null) { |
| 124 | - homeDataData.share = share; | 92 | + homeData.share = share; |
| 125 | - } | ||
| 126 | - final String? comment = jsonConvert.convert<String>(json['comment']); | ||
| 127 | - if (comment != null) { | ||
| 128 | - homeDataData.comment = comment; | ||
| 129 | - } | ||
| 130 | - final String? state = jsonConvert.convert<String>(json['state']); | ||
| 131 | - if (state != null) { | ||
| 132 | - homeDataData.state = state; | ||
| 133 | - } | ||
| 134 | - final String? isPublish = jsonConvert.convert<String>(json['is_publish']); | ||
| 135 | - if (isPublish != null) { | ||
| 136 | - homeDataData.isPublish = isPublish; | ||
| 137 | } | 93 | } |
| 138 | - final String? isCheck = jsonConvert.convert<String>(json['is_check']); | 94 | + return homeData; |
| 139 | - if (isCheck != null) { | ||
| 140 | - homeDataData.isCheck = isCheck; | ||
| 141 | - } | ||
| 142 | - final String? createdAt = jsonConvert.convert<String>(json['created_at']); | ||
| 143 | - if (createdAt != null) { | ||
| 144 | - homeDataData.createdAt = createdAt; | ||
| 145 | - } | ||
| 146 | - final String? updatedAt = jsonConvert.convert<String>(json['updated_at']); | ||
| 147 | - if (updatedAt != null) { | ||
| 148 | - homeDataData.updatedAt = updatedAt; | ||
| 149 | - } | ||
| 150 | - return homeDataData; | ||
| 151 | } | 95 | } |
| 152 | 96 | ||
| 153 | -Map<String, dynamic> $HomeDataDataToJson(HomeDataData entity) { | 97 | +Map<String, dynamic> $HomeDataToJson(HomeData entity) { |
| 154 | final Map<String, dynamic> data = <String, dynamic>{}; | 98 | final Map<String, dynamic> data = <String, dynamic>{}; |
| 155 | data['id'] = entity.id; | 99 | data['id'] = entity.id; |
| 156 | data['user_id'] = entity.userId; | 100 | data['user_id'] = entity.userId; |
| ... | @@ -158,71 +102,13 @@ Map<String, dynamic> $HomeDataDataToJson(HomeDataData entity) { | ... | @@ -158,71 +102,13 @@ Map<String, dynamic> $HomeDataDataToJson(HomeDataData entity) { |
| 158 | data['content'] = entity.content; | 102 | data['content'] = entity.content; |
| 159 | data['url'] = entity.url; | 103 | data['url'] = entity.url; |
| 160 | data['type'] = entity.type; | 104 | data['type'] = entity.type; |
| 161 | - data['duration'] = entity.duration; | ||
| 162 | - data['size'] = entity.size; | ||
| 163 | data['poem_id'] = entity.poemId; | 105 | data['poem_id'] = entity.poemId; |
| 164 | data['temp_id'] = entity.tempId; | 106 | data['temp_id'] = entity.tempId; |
| 165 | - data['thumbnail'] = entity.thumbnail; | ||
| 166 | data['bgm'] = entity.bgm; | 107 | data['bgm'] = entity.bgm; |
| 167 | data['praise'] = entity.praise; | 108 | data['praise'] = entity.praise; |
| 168 | data['view'] = entity.view; | 109 | data['view'] = entity.view; |
| 169 | data['collect'] = entity.collect; | 110 | data['collect'] = entity.collect; |
| 170 | data['share'] = entity.share; | 111 | data['share'] = entity.share; |
| 171 | - data['comment'] = entity.comment; | ||
| 172 | - data['state'] = entity.state; | ||
| 173 | - data['is_publish'] = entity.isPublish; | ||
| 174 | - data['is_check'] = entity.isCheck; | ||
| 175 | - data['created_at'] = entity.createdAt; | ||
| 176 | - data['updated_at'] = entity.updatedAt; | ||
| 177 | - return data; | ||
| 178 | -} | ||
| 179 | - | ||
| 180 | -HomeDataMeta $HomeDataMetaFromJson(Map<String, dynamic> json) { | ||
| 181 | - final HomeDataMeta homeDataMeta = HomeDataMeta(); | ||
| 182 | - final HomeDataMetaPagination? pagination = | ||
| 183 | - jsonConvert.convert<HomeDataMetaPagination>(json['pagination']); | ||
| 184 | - if (pagination != null) { | ||
| 185 | - homeDataMeta.pagination = pagination; | ||
| 186 | - } | ||
| 187 | - return homeDataMeta; | ||
| 188 | -} | ||
| 189 | - | ||
| 190 | -Map<String, dynamic> $HomeDataMetaToJson(HomeDataMeta entity) { | ||
| 191 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 192 | - data['pagination'] = entity.pagination?.toJson(); | ||
| 193 | - return data; | ||
| 194 | -} | ||
| 195 | - | ||
| 196 | -HomeDataMetaPagination $HomeDataMetaPaginationFromJson( | ||
| 197 | - Map<String, dynamic> json) { | ||
| 198 | - final HomeDataMetaPagination homeDataMetaPagination = | ||
| 199 | - HomeDataMetaPagination(); | ||
| 200 | - final int? total = jsonConvert.convert<int>(json['total']); | ||
| 201 | - if (total != null) { | ||
| 202 | - homeDataMetaPagination.total = total; | ||
| 203 | - } | ||
| 204 | - final int? count = jsonConvert.convert<int>(json['count']); | ||
| 205 | - if (count != null) { | ||
| 206 | - homeDataMetaPagination.count = count; | ||
| 207 | - } | ||
| 208 | - final int? perPage = jsonConvert.convert<int>(json['per_page']); | ||
| 209 | - if (perPage != null) { | ||
| 210 | - homeDataMetaPagination.perPage = perPage; | ||
| 211 | - } | ||
| 212 | - final int? currentPage = jsonConvert.convert<int>(json['current_page']); | ||
| 213 | - if (currentPage != null) { | ||
| 214 | - homeDataMetaPagination.currentPage = currentPage; | ||
| 215 | - } | ||
| 216 | - return homeDataMetaPagination; | ||
| 217 | -} | ||
| 218 | - | ||
| 219 | -Map<String, dynamic> $HomeDataMetaPaginationToJson( | ||
| 220 | - HomeDataMetaPagination entity) { | ||
| 221 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 222 | - data['total'] = entity.total; | ||
| 223 | - data['count'] = entity.count; | ||
| 224 | - data['per_page'] = entity.perPage; | ||
| 225 | - data['current_page'] = entity.currentPage; | ||
| 226 | return data; | 112 | return data; |
| 227 | } | 113 | } |
| 228 | 114 | ||
| ... | @@ -234,4 +120,4 @@ HomeError $HomeErrorFromJson(Map<String, dynamic> json) { | ... | @@ -234,4 +120,4 @@ HomeError $HomeErrorFromJson(Map<String, dynamic> json) { |
| 234 | Map<String, dynamic> $HomeErrorToJson(HomeError entity) { | 120 | Map<String, dynamic> $HomeErrorToJson(HomeError entity) { |
| 235 | final Map<String, dynamic> data = <String, dynamic>{}; | 121 | final Map<String, dynamic> data = <String, dynamic>{}; |
| 236 | return data; | 122 | return data; |
| 237 | -} | 123 | +} |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
lib/generated/json/my_videos_entity.g.dart
0 → 100644
| 1 | +import 'package:Parlando/generated/json/base/json_convert_content.dart'; | ||
| 2 | +import 'package:Parlando/account/models/my_videos_entity.dart'; | ||
| 3 | + | ||
| 4 | +MyVideosEntity $MyVideosEntityFromJson(Map<String, dynamic> json) { | ||
| 5 | + final MyVideosEntity myVideosEntity = MyVideosEntity(); | ||
| 6 | + final String? status = jsonConvert.convert<String>(json['status']); | ||
| 7 | + if (status != null) { | ||
| 8 | + myVideosEntity.status = status; | ||
| 9 | + } | ||
| 10 | + final int? code = jsonConvert.convert<int>(json['code']); | ||
| 11 | + if (code != null) { | ||
| 12 | + myVideosEntity.code = code; | ||
| 13 | + } | ||
| 14 | + final String? message = jsonConvert.convert<String>(json['message']); | ||
| 15 | + if (message != null) { | ||
| 16 | + myVideosEntity.message = message; | ||
| 17 | + } | ||
| 18 | + final List<MyVideosData>? data = | ||
| 19 | + jsonConvert.convertListNotNull<MyVideosData>(json['data']); | ||
| 20 | + if (data != null) { | ||
| 21 | + myVideosEntity.data = data; | ||
| 22 | + } | ||
| 23 | + final MyVideosError? error = | ||
| 24 | + jsonConvert.convert<MyVideosError>(json['error']); | ||
| 25 | + if (error != null) { | ||
| 26 | + myVideosEntity.error = error; | ||
| 27 | + } | ||
| 28 | + return myVideosEntity; | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +Map<String, dynamic> $MyVideosEntityToJson(MyVideosEntity entity) { | ||
| 32 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 33 | + data['status'] = entity.status; | ||
| 34 | + data['code'] = entity.code; | ||
| 35 | + data['message'] = entity.message; | ||
| 36 | + data['data'] = entity.data?.map((v) => v.toJson()).toList(); | ||
| 37 | + data['error'] = entity.error?.toJson(); | ||
| 38 | + return data; | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +MyVideosData $MyVideosDataFromJson(Map<String, dynamic> json) { | ||
| 42 | + final MyVideosData myVideosData = MyVideosData(); | ||
| 43 | + final int? id = jsonConvert.convert<int>(json['id']); | ||
| 44 | + if (id != null) { | ||
| 45 | + myVideosData.id = id; | ||
| 46 | + } | ||
| 47 | + final int? userId = jsonConvert.convert<int>(json['user_id']); | ||
| 48 | + if (userId != null) { | ||
| 49 | + myVideosData.userId = userId; | ||
| 50 | + } | ||
| 51 | + final String? title = jsonConvert.convert<String>(json['title']); | ||
| 52 | + if (title != null) { | ||
| 53 | + myVideosData.title = title; | ||
| 54 | + } | ||
| 55 | + final String? content = jsonConvert.convert<String>(json['content']); | ||
| 56 | + if (content != null) { | ||
| 57 | + myVideosData.content = content; | ||
| 58 | + } | ||
| 59 | + final String? url = jsonConvert.convert<String>(json['url']); | ||
| 60 | + if (url != null) { | ||
| 61 | + myVideosData.url = url; | ||
| 62 | + } | ||
| 63 | + final int? type = jsonConvert.convert<int>(json['type']); | ||
| 64 | + if (type != null) { | ||
| 65 | + myVideosData.type = type; | ||
| 66 | + } | ||
| 67 | + final String? duration = jsonConvert.convert<String>(json['duration']); | ||
| 68 | + if (duration != null) { | ||
| 69 | + myVideosData.duration = duration; | ||
| 70 | + } | ||
| 71 | + final String? size = jsonConvert.convert<String>(json['size']); | ||
| 72 | + if (size != null) { | ||
| 73 | + myVideosData.size = size; | ||
| 74 | + } | ||
| 75 | + final int? poemId = jsonConvert.convert<int>(json['poem_id']); | ||
| 76 | + if (poemId != null) { | ||
| 77 | + myVideosData.poemId = poemId; | ||
| 78 | + } | ||
| 79 | + final int? tempId = jsonConvert.convert<int>(json['temp_id']); | ||
| 80 | + if (tempId != null) { | ||
| 81 | + myVideosData.tempId = tempId; | ||
| 82 | + } | ||
| 83 | + final String? thumbnail = jsonConvert.convert<String>(json['thumbnail']); | ||
| 84 | + if (thumbnail != null) { | ||
| 85 | + myVideosData.thumbnail = thumbnail; | ||
| 86 | + } | ||
| 87 | + final dynamic? bgm = jsonConvert.convert<dynamic>(json['bgm']); | ||
| 88 | + if (bgm != null) { | ||
| 89 | + myVideosData.bgm = bgm; | ||
| 90 | + } | ||
| 91 | + final String? praise = jsonConvert.convert<String>(json['praise']); | ||
| 92 | + if (praise != null) { | ||
| 93 | + myVideosData.praise = praise; | ||
| 94 | + } | ||
| 95 | + final String? view = jsonConvert.convert<String>(json['view']); | ||
| 96 | + if (view != null) { | ||
| 97 | + myVideosData.view = view; | ||
| 98 | + } | ||
| 99 | + final String? collect = jsonConvert.convert<String>(json['collect']); | ||
| 100 | + if (collect != null) { | ||
| 101 | + myVideosData.collect = collect; | ||
| 102 | + } | ||
| 103 | + final String? share = jsonConvert.convert<String>(json['share']); | ||
| 104 | + if (share != null) { | ||
| 105 | + myVideosData.share = share; | ||
| 106 | + } | ||
| 107 | + final String? comment = jsonConvert.convert<String>(json['comment']); | ||
| 108 | + if (comment != null) { | ||
| 109 | + myVideosData.comment = comment; | ||
| 110 | + } | ||
| 111 | + final String? state = jsonConvert.convert<String>(json['state']); | ||
| 112 | + if (state != null) { | ||
| 113 | + myVideosData.state = state; | ||
| 114 | + } | ||
| 115 | + final String? isPublish = jsonConvert.convert<String>(json['is_publish']); | ||
| 116 | + if (isPublish != null) { | ||
| 117 | + myVideosData.isPublish = isPublish; | ||
| 118 | + } | ||
| 119 | + final String? isCheck = jsonConvert.convert<String>(json['is_check']); | ||
| 120 | + if (isCheck != null) { | ||
| 121 | + myVideosData.isCheck = isCheck; | ||
| 122 | + } | ||
| 123 | + final String? createdAt = jsonConvert.convert<String>(json['created_at']); | ||
| 124 | + if (createdAt != null) { | ||
| 125 | + myVideosData.createdAt = createdAt; | ||
| 126 | + } | ||
| 127 | + final String? updatedAt = jsonConvert.convert<String>(json['updated_at']); | ||
| 128 | + if (updatedAt != null) { | ||
| 129 | + myVideosData.updatedAt = updatedAt; | ||
| 130 | + } | ||
| 131 | + return myVideosData; | ||
| 132 | +} | ||
| 133 | + | ||
| 134 | +Map<String, dynamic> $MyVideosDataToJson(MyVideosData entity) { | ||
| 135 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 136 | + data['id'] = entity.id; | ||
| 137 | + data['user_id'] = entity.userId; | ||
| 138 | + data['title'] = entity.title; | ||
| 139 | + data['content'] = entity.content; | ||
| 140 | + data['url'] = entity.url; | ||
| 141 | + data['type'] = entity.type; | ||
| 142 | + data['duration'] = entity.duration; | ||
| 143 | + data['size'] = entity.size; | ||
| 144 | + data['poem_id'] = entity.poemId; | ||
| 145 | + data['temp_id'] = entity.tempId; | ||
| 146 | + data['thumbnail'] = entity.thumbnail; | ||
| 147 | + data['bgm'] = entity.bgm; | ||
| 148 | + data['praise'] = entity.praise; | ||
| 149 | + data['view'] = entity.view; | ||
| 150 | + data['collect'] = entity.collect; | ||
| 151 | + data['share'] = entity.share; | ||
| 152 | + data['comment'] = entity.comment; | ||
| 153 | + data['state'] = entity.state; | ||
| 154 | + data['is_publish'] = entity.isPublish; | ||
| 155 | + data['is_check'] = entity.isCheck; | ||
| 156 | + data['created_at'] = entity.createdAt; | ||
| 157 | + data['updated_at'] = entity.updatedAt; | ||
| 158 | + return data; | ||
| 159 | +} | ||
| 160 | + | ||
| 161 | +MyVideosError $MyVideosErrorFromJson(Map<String, dynamic> json) { | ||
| 162 | + final MyVideosError myVideosError = MyVideosError(); | ||
| 163 | + return myVideosError; | ||
| 164 | +} | ||
| 165 | + | ||
| 166 | +Map<String, dynamic> $MyVideosErrorToJson(MyVideosError entity) { | ||
| 167 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 168 | + return data; | ||
| 169 | +} |
| ... | @@ -7,7 +7,7 @@ class HomeEntity { | ... | @@ -7,7 +7,7 @@ class HomeEntity { |
| 7 | String? status; | 7 | String? status; |
| 8 | int? code; | 8 | int? code; |
| 9 | String? message; | 9 | String? message; |
| 10 | - HomeData? data; | 10 | + List<HomeData>? data; |
| 11 | HomeError? error; | 11 | HomeError? error; |
| 12 | 12 | ||
| 13 | HomeEntity(); | 13 | HomeEntity(); |
| ... | @@ -25,99 +25,29 @@ class HomeEntity { | ... | @@ -25,99 +25,29 @@ class HomeEntity { |
| 25 | 25 | ||
| 26 | @JsonSerializable() | 26 | @JsonSerializable() |
| 27 | class HomeData { | 27 | class HomeData { |
| 28 | - List<HomeDataData>? data; | ||
| 29 | - HomeDataMeta? meta; | ||
| 30 | - | ||
| 31 | - HomeData(); | ||
| 32 | - | ||
| 33 | - factory HomeData.fromJson(Map<String, dynamic> json) => | ||
| 34 | - $HomeDataFromJson(json); | ||
| 35 | - | ||
| 36 | - Map<String, dynamic> toJson() => $HomeDataToJson(this); | ||
| 37 | - | ||
| 38 | - @override | ||
| 39 | - String toString() { | ||
| 40 | - return jsonEncode(this); | ||
| 41 | - } | ||
| 42 | -} | ||
| 43 | - | ||
| 44 | -@JsonSerializable() | ||
| 45 | -class HomeDataData { | ||
| 46 | int? id; | 28 | int? id; |
| 47 | @JSONField(name: "user_id") | 29 | @JSONField(name: "user_id") |
| 48 | - String? userId; | 30 | + int? userId; |
| 49 | String? title; | 31 | String? title; |
| 50 | String? content; | 32 | String? content; |
| 51 | String? url; | 33 | String? url; |
| 52 | - String? type; | 34 | + int? type; |
| 53 | - String? duration; | ||
| 54 | - String? size; | ||
| 55 | @JSONField(name: "poem_id") | 35 | @JSONField(name: "poem_id") |
| 56 | - String? poemId; | 36 | + int? poemId; |
| 57 | @JSONField(name: "temp_id") | 37 | @JSONField(name: "temp_id") |
| 58 | - String? tempId; | 38 | + int? tempId; |
| 59 | - String? thumbnail; | ||
| 60 | String? bgm; | 39 | String? bgm; |
| 61 | String? praise; | 40 | String? praise; |
| 62 | String? view; | 41 | String? view; |
| 63 | String? collect; | 42 | String? collect; |
| 64 | String? share; | 43 | String? share; |
| 65 | - String? comment; | ||
| 66 | - String? state; | ||
| 67 | - @JSONField(name: "is_publish") | ||
| 68 | - String? isPublish; | ||
| 69 | - @JSONField(name: "is_check") | ||
| 70 | - String? isCheck; | ||
| 71 | - @JSONField(name: "created_at") | ||
| 72 | - String? createdAt; | ||
| 73 | - @JSONField(name: "updated_at") | ||
| 74 | - String? updatedAt; | ||
| 75 | - | ||
| 76 | - HomeDataData(); | ||
| 77 | - | ||
| 78 | - factory HomeDataData.fromJson(Map<String, dynamic> json) => | ||
| 79 | - $HomeDataDataFromJson(json); | ||
| 80 | - | ||
| 81 | - Map<String, dynamic> toJson() => $HomeDataDataToJson(this); | ||
| 82 | - | ||
| 83 | - @override | ||
| 84 | - String toString() { | ||
| 85 | - return jsonEncode(this); | ||
| 86 | - } | ||
| 87 | -} | ||
| 88 | - | ||
| 89 | -@JsonSerializable() | ||
| 90 | -class HomeDataMeta { | ||
| 91 | - HomeDataMetaPagination? pagination; | ||
| 92 | - | ||
| 93 | - HomeDataMeta(); | ||
| 94 | 44 | ||
| 95 | - factory HomeDataMeta.fromJson(Map<String, dynamic> json) => | 45 | + HomeData(); |
| 96 | - $HomeDataMetaFromJson(json); | ||
| 97 | - | ||
| 98 | - Map<String, dynamic> toJson() => $HomeDataMetaToJson(this); | ||
| 99 | - | ||
| 100 | - @override | ||
| 101 | - String toString() { | ||
| 102 | - return jsonEncode(this); | ||
| 103 | - } | ||
| 104 | -} | ||
| 105 | - | ||
| 106 | -@JsonSerializable() | ||
| 107 | -class HomeDataMetaPagination { | ||
| 108 | - int? total; | ||
| 109 | - int? count; | ||
| 110 | - @JSONField(name: "per_page") | ||
| 111 | - int? perPage; | ||
| 112 | - @JSONField(name: "current_page") | ||
| 113 | - int? currentPage; | ||
| 114 | - | ||
| 115 | - HomeDataMetaPagination(); | ||
| 116 | 46 | ||
| 117 | - factory HomeDataMetaPagination.fromJson(Map<String, dynamic> json) => | 47 | + factory HomeData.fromJson(Map<String, dynamic> json) => |
| 118 | - $HomeDataMetaPaginationFromJson(json); | 48 | + $HomeDataFromJson(json); |
| 119 | 49 | ||
| 120 | - Map<String, dynamic> toJson() => $HomeDataMetaPaginationToJson(this); | 50 | + Map<String, dynamic> toJson() => $HomeDataToJson(this); |
| 121 | 51 | ||
| 122 | @override | 52 | @override |
| 123 | String toString() { | 53 | String toString() { |
| ... | @@ -138,4 +68,4 @@ class HomeError { | ... | @@ -138,4 +68,4 @@ class HomeError { |
| 138 | String toString() { | 68 | String toString() { |
| 139 | return jsonEncode(this); | 69 | return jsonEncode(this); |
| 140 | } | 70 | } |
| 141 | -} | 71 | +} |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -10,6 +10,7 @@ class HttpApi { | ... | @@ -10,6 +10,7 @@ class HttpApi { |
| 10 | static const String avatar = 'avatar'; | 10 | static const String avatar = 'avatar'; |
| 11 | static const String user = 'user'; | 11 | static const String user = 'user'; |
| 12 | static const String home = 'home'; | 12 | static const String home = 'home'; |
| 13 | + static const String myVideos = '/my/videos'; | ||
| 13 | static const String search = 'search/repositories'; | 14 | static const String search = 'search/repositories'; |
| 14 | static const String subscriptions = 'users/simplezhli/subscriptions'; | 15 | static const String subscriptions = 'users/simplezhli/subscriptions'; |
| 15 | static const String upload = 'uuc/upload-inco'; | 16 | static const String upload = 'uuc/upload-inco'; | ... | ... |
| ... | @@ -73,12 +73,12 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -73,12 +73,12 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 73 | DioUtils.instance.asyncRequestNetwork<HomeEntity>( | 73 | DioUtils.instance.asyncRequestNetwork<HomeEntity>( |
| 74 | Method.get, | 74 | Method.get, |
| 75 | HttpApi.home, | 75 | HttpApi.home, |
| 76 | - params: [], | 76 | + params: {'page_size': 80}, |
| 77 | onSuccess: (data) { | 77 | onSuccess: (data) { |
| 78 | isLoading = false; | 78 | isLoading = false; |
| 79 | setState(() {}); | 79 | setState(() {}); |
| 80 | List<UserVideo> videoDataList = <UserVideo>[]; | 80 | List<UserVideo> videoDataList = <UserVideo>[]; |
| 81 | - for (HomeDataData data in data!.data!.data!) { | 81 | + for (HomeData data in data!.data!) { |
| 82 | videoDataList.add( | 82 | videoDataList.add( |
| 83 | UserVideo( | 83 | UserVideo( |
| 84 | image: '', | 84 | image: '', |
| ... | @@ -224,7 +224,7 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { | ... | @@ -224,7 +224,7 @@ class PoemPageState extends State<PoemPage> with WidgetsBindingObserver { |
| 224 | Widget poem = TikTokVidePoem( | 224 | Widget poem = TikTokVidePoem( |
| 225 | title: "每日一言", | 225 | title: "每日一言", |
| 226 | poem: | 226 | poem: |
| 227 | - "清晨入古寺,初日照高林。\n曲径通幽处,禅房花木深。\n山光悦鸟性,潭影空人心。\n万籁此都寂,但余钟磬音。\n", | 227 | + "清晨入古寺,初日照高林。\n曲径通幽处,禅房花木深。\n山光悦鸟性,潭影空人心。\n万籁此都寂,但余钟磬音。\n", |
| 228 | author: "----《题破山寺后禅院》常建", | 228 | author: "----《题破山寺后禅院》常建", |
| 229 | onShowDetail: () { | 229 | onShowDetail: () { |
| 230 | tkController.animateToPage(TikTokPagePosition.right); | 230 | tkController.animateToPage(TikTokPagePosition.right); | ... | ... |
-
Please register or login to post a comment