Commit 4224b3f8899ff5a32b51162f1112cba607b76a44
1 parent
354ac7e6
feat:支付详情页ui
Showing
26 changed files
with
1643 additions
and
824 deletions
assets/images/apple_pay.png
0 → 100644
1.78 KB
assets/images/btn_pay.png
0 → 100644
45.8 KB
assets/images/checked.png
0 → 100644
3.2 KB
assets/images/unchecked.png
0 → 100644
3.12 KB
assets/images/weixin.png
0 → 100644
3.79 KB
assets/images/zhifubao.png
0 → 100644
4.64 KB
lib/app/app.dart
| @@ -2,8 +2,7 @@ import 'package:flutter/material.dart'; | @@ -2,8 +2,7 @@ import 'package:flutter/material.dart'; | ||
| 2 | import 'package:flutter_bloc/flutter_bloc.dart'; | 2 | import 'package:flutter_bloc/flutter_bloc.dart'; |
| 3 | import 'package:flutter_easyloading/flutter_easyloading.dart'; | 3 | import 'package:flutter_easyloading/flutter_easyloading.dart'; |
| 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 5 | -import 'package:responsive_framework/breakpoint.dart'; | ||
| 6 | -import 'package:responsive_framework/responsive_breakpoints.dart'; | 5 | +import 'package:responsive_framework/responsive_framework.dart'; |
| 7 | import 'package:wow_english/common/blocs/cachebloc/cache_bloc.dart'; | 6 | import 'package:wow_english/common/blocs/cachebloc/cache_bloc.dart'; |
| 8 | import 'package:wow_english/common/widgets/hide_keyboard_widget.dart'; | 7 | import 'package:wow_english/common/widgets/hide_keyboard_widget.dart'; |
| 9 | import 'package:wow_english/pages/tab/blocs/tab_bloc.dart'; | 8 | import 'package:wow_english/pages/tab/blocs/tab_bloc.dart'; |
lib/generated/json/aliyun_oss_upload_sts_entity.g.dart
| 1 | import 'package:wow_english/generated/json/base/json_convert_content.dart'; | 1 | import 'package:wow_english/generated/json/base/json_convert_content.dart'; |
| 2 | import 'package:wow_english/models/aliyun_oss_upload_sts_entity.dart'; | 2 | import 'package:wow_english/models/aliyun_oss_upload_sts_entity.dart'; |
| 3 | 3 | ||
| 4 | -AliyunOssUploadStsEntity $AliyunOssUploadStsEntityFromJson(Map<String, dynamic> json) { | ||
| 5 | - final AliyunOssUploadStsEntity aliyunOssUploadStsEntity = AliyunOssUploadStsEntity(); | ||
| 6 | - final String? securityToken = jsonConvert.convert<String>(json['securityToken']); | ||
| 7 | - if (securityToken != null) { | ||
| 8 | - aliyunOssUploadStsEntity.securityToken = securityToken; | ||
| 9 | - } | ||
| 10 | - final String? expiration = jsonConvert.convert<String>(json['expiration']); | ||
| 11 | - if (expiration != null) { | ||
| 12 | - aliyunOssUploadStsEntity.expiration = expiration; | ||
| 13 | - } | ||
| 14 | - final String? endpoint = jsonConvert.convert<String>(json['endpoint']); | ||
| 15 | - if (endpoint != null) { | ||
| 16 | - aliyunOssUploadStsEntity.endpoint = endpoint; | ||
| 17 | - } | ||
| 18 | - final String? fileKey = jsonConvert.convert<String>(json['fileKey']); | ||
| 19 | - if (fileKey != null) { | ||
| 20 | - aliyunOssUploadStsEntity.fileKey = fileKey; | ||
| 21 | - } | ||
| 22 | - final String? accessKeyId = jsonConvert.convert<String>(json['accessKeyId']); | ||
| 23 | - if (accessKeyId != null) { | ||
| 24 | - aliyunOssUploadStsEntity.accessKeyId = accessKeyId; | ||
| 25 | - } | ||
| 26 | - final String? accessKeySecret = jsonConvert.convert<String>(json['accessKeySecret']); | ||
| 27 | - if (accessKeySecret != null) { | ||
| 28 | - aliyunOssUploadStsEntity.accessKeySecret = accessKeySecret; | ||
| 29 | - } | ||
| 30 | - final String? bucket = jsonConvert.convert<String>(json['bucket']); | ||
| 31 | - if (bucket != null) { | ||
| 32 | - aliyunOssUploadStsEntity.bucket = bucket; | ||
| 33 | - } | ||
| 34 | - final String? ossDomain = jsonConvert.convert<String>(json['ossDomain']); | ||
| 35 | - if (ossDomain != null) { | ||
| 36 | - aliyunOssUploadStsEntity.ossDomain = ossDomain; | ||
| 37 | - } | ||
| 38 | - final String? host = jsonConvert.convert<String>(json['host']); | ||
| 39 | - if (host != null) { | ||
| 40 | - aliyunOssUploadStsEntity.host = host; | ||
| 41 | - } | ||
| 42 | - final AliyunOssUploadStsCallbackParam? callbackParam = jsonConvert.convert<AliyunOssUploadStsCallbackParam>(json['callbackParam']); | ||
| 43 | - if (callbackParam != null) { | ||
| 44 | - aliyunOssUploadStsEntity.callbackParam = callbackParam; | ||
| 45 | - } | ||
| 46 | - return aliyunOssUploadStsEntity; | 4 | +AliyunOssUploadStsEntity $AliyunOssUploadStsEntityFromJson( |
| 5 | + Map<String, dynamic> json) { | ||
| 6 | + final AliyunOssUploadStsEntity aliyunOssUploadStsEntity = AliyunOssUploadStsEntity(); | ||
| 7 | + final String? securityToken = jsonConvert.convert<String>( | ||
| 8 | + json['securityToken']); | ||
| 9 | + if (securityToken != null) { | ||
| 10 | + aliyunOssUploadStsEntity.securityToken = securityToken; | ||
| 11 | + } | ||
| 12 | + final String? expiration = jsonConvert.convert<String>(json['expiration']); | ||
| 13 | + if (expiration != null) { | ||
| 14 | + aliyunOssUploadStsEntity.expiration = expiration; | ||
| 15 | + } | ||
| 16 | + final String? endpoint = jsonConvert.convert<String>(json['endpoint']); | ||
| 17 | + if (endpoint != null) { | ||
| 18 | + aliyunOssUploadStsEntity.endpoint = endpoint; | ||
| 19 | + } | ||
| 20 | + final String? fileKey = jsonConvert.convert<String>(json['fileKey']); | ||
| 21 | + if (fileKey != null) { | ||
| 22 | + aliyunOssUploadStsEntity.fileKey = fileKey; | ||
| 23 | + } | ||
| 24 | + final String? accessKeyId = jsonConvert.convert<String>(json['accessKeyId']); | ||
| 25 | + if (accessKeyId != null) { | ||
| 26 | + aliyunOssUploadStsEntity.accessKeyId = accessKeyId; | ||
| 27 | + } | ||
| 28 | + final String? accessKeySecret = jsonConvert.convert<String>( | ||
| 29 | + json['accessKeySecret']); | ||
| 30 | + if (accessKeySecret != null) { | ||
| 31 | + aliyunOssUploadStsEntity.accessKeySecret = accessKeySecret; | ||
| 32 | + } | ||
| 33 | + final String? bucket = jsonConvert.convert<String>(json['bucket']); | ||
| 34 | + if (bucket != null) { | ||
| 35 | + aliyunOssUploadStsEntity.bucket = bucket; | ||
| 36 | + } | ||
| 37 | + final String? ossDomain = jsonConvert.convert<String>(json['ossDomain']); | ||
| 38 | + if (ossDomain != null) { | ||
| 39 | + aliyunOssUploadStsEntity.ossDomain = ossDomain; | ||
| 40 | + } | ||
| 41 | + final String? host = jsonConvert.convert<String>(json['host']); | ||
| 42 | + if (host != null) { | ||
| 43 | + aliyunOssUploadStsEntity.host = host; | ||
| 44 | + } | ||
| 45 | + final AliyunOssUploadStsCallbackParam? callbackParam = jsonConvert.convert< | ||
| 46 | + AliyunOssUploadStsCallbackParam>(json['callbackParam']); | ||
| 47 | + if (callbackParam != null) { | ||
| 48 | + aliyunOssUploadStsEntity.callbackParam = callbackParam; | ||
| 49 | + } | ||
| 50 | + return aliyunOssUploadStsEntity; | ||
| 47 | } | 51 | } |
| 48 | 52 | ||
| 49 | -Map<String, dynamic> $AliyunOssUploadStsEntityToJson(AliyunOssUploadStsEntity entity) { | ||
| 50 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 51 | - data['securityToken'] = entity.securityToken; | ||
| 52 | - data['expiration'] = entity.expiration; | ||
| 53 | - data['endpoint'] = entity.endpoint; | ||
| 54 | - data['fileKey'] = entity.fileKey; | ||
| 55 | - data['accessKeyId'] = entity.accessKeyId; | ||
| 56 | - data['accessKeySecret'] = entity.accessKeySecret; | ||
| 57 | - data['bucket'] = entity.bucket; | ||
| 58 | - data['ossDomain'] = entity.ossDomain; | ||
| 59 | - data['host'] = entity.host; | ||
| 60 | - data['callbackParam'] = entity.callbackParam.toJson(); | ||
| 61 | - return data; | 53 | +Map<String, dynamic> $AliyunOssUploadStsEntityToJson( |
| 54 | + AliyunOssUploadStsEntity entity) { | ||
| 55 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 56 | + data['securityToken'] = entity.securityToken; | ||
| 57 | + data['expiration'] = entity.expiration; | ||
| 58 | + data['endpoint'] = entity.endpoint; | ||
| 59 | + data['fileKey'] = entity.fileKey; | ||
| 60 | + data['accessKeyId'] = entity.accessKeyId; | ||
| 61 | + data['accessKeySecret'] = entity.accessKeySecret; | ||
| 62 | + data['bucket'] = entity.bucket; | ||
| 63 | + data['ossDomain'] = entity.ossDomain; | ||
| 64 | + data['host'] = entity.host; | ||
| 65 | + data['callbackParam'] = entity.callbackParam.toJson(); | ||
| 66 | + return data; | ||
| 62 | } | 67 | } |
| 63 | 68 | ||
| 64 | -AliyunOssUploadStsCallbackParam $AliyunOssUploadStsCallbackParamFromJson(Map<String, dynamic> json) { | ||
| 65 | - final AliyunOssUploadStsCallbackParam aliyunOssUploadStsCallbackParam = AliyunOssUploadStsCallbackParam(); | ||
| 66 | - final String? callbackBody = jsonConvert.convert<String>(json['callbackBody']); | ||
| 67 | - if (callbackBody != null) { | ||
| 68 | - aliyunOssUploadStsCallbackParam.callbackBody = callbackBody; | ||
| 69 | - } | ||
| 70 | - final String? callbackBodyType = jsonConvert.convert<String>(json['callbackBodyType']); | ||
| 71 | - if (callbackBodyType != null) { | ||
| 72 | - aliyunOssUploadStsCallbackParam.callbackBodyType = callbackBodyType; | ||
| 73 | - } | ||
| 74 | - final String? callbackUrl = jsonConvert.convert<String>(json['callbackUrl']); | ||
| 75 | - if (callbackUrl != null) { | ||
| 76 | - aliyunOssUploadStsCallbackParam.callbackUrl = callbackUrl; | ||
| 77 | - } | ||
| 78 | - return aliyunOssUploadStsCallbackParam; | 69 | +extension AliyunOssUploadStsEntityExtension on AliyunOssUploadStsEntity { |
| 70 | + AliyunOssUploadStsEntity copyWith({ | ||
| 71 | + String? securityToken, | ||
| 72 | + String? expiration, | ||
| 73 | + String? endpoint, | ||
| 74 | + String? fileKey, | ||
| 75 | + String? accessKeyId, | ||
| 76 | + String? accessKeySecret, | ||
| 77 | + String? bucket, | ||
| 78 | + String? ossDomain, | ||
| 79 | + String? host, | ||
| 80 | + AliyunOssUploadStsCallbackParam? callbackParam, | ||
| 81 | + }) { | ||
| 82 | + return AliyunOssUploadStsEntity() | ||
| 83 | + ..securityToken = securityToken ?? this.securityToken | ||
| 84 | + ..expiration = expiration ?? this.expiration | ||
| 85 | + ..endpoint = endpoint ?? this.endpoint | ||
| 86 | + ..fileKey = fileKey ?? this.fileKey | ||
| 87 | + ..accessKeyId = accessKeyId ?? this.accessKeyId | ||
| 88 | + ..accessKeySecret = accessKeySecret ?? this.accessKeySecret | ||
| 89 | + ..bucket = bucket ?? this.bucket | ||
| 90 | + ..ossDomain = ossDomain ?? this.ossDomain | ||
| 91 | + ..host = host ?? this.host | ||
| 92 | + ..callbackParam = callbackParam ?? this.callbackParam; | ||
| 93 | + } | ||
| 79 | } | 94 | } |
| 80 | 95 | ||
| 81 | -Map<String, dynamic> $AliyunOssUploadStsCallbackParamToJson(AliyunOssUploadStsCallbackParam entity) { | ||
| 82 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 83 | - data['callbackBody'] = entity.callbackBody; | ||
| 84 | - data['callbackBodyType'] = entity.callbackBodyType; | ||
| 85 | - data['callbackUrl'] = entity.callbackUrl; | ||
| 86 | - return data; | 96 | +AliyunOssUploadStsCallbackParam $AliyunOssUploadStsCallbackParamFromJson( |
| 97 | + Map<String, dynamic> json) { | ||
| 98 | + final AliyunOssUploadStsCallbackParam aliyunOssUploadStsCallbackParam = AliyunOssUploadStsCallbackParam(); | ||
| 99 | + final String? callbackBody = jsonConvert.convert<String>( | ||
| 100 | + json['callbackBody']); | ||
| 101 | + if (callbackBody != null) { | ||
| 102 | + aliyunOssUploadStsCallbackParam.callbackBody = callbackBody; | ||
| 103 | + } | ||
| 104 | + final String? callbackBodyType = jsonConvert.convert<String>( | ||
| 105 | + json['callbackBodyType']); | ||
| 106 | + if (callbackBodyType != null) { | ||
| 107 | + aliyunOssUploadStsCallbackParam.callbackBodyType = callbackBodyType; | ||
| 108 | + } | ||
| 109 | + final String? callbackUrl = jsonConvert.convert<String>(json['callbackUrl']); | ||
| 110 | + if (callbackUrl != null) { | ||
| 111 | + aliyunOssUploadStsCallbackParam.callbackUrl = callbackUrl; | ||
| 112 | + } | ||
| 113 | + return aliyunOssUploadStsCallbackParam; | ||
| 87 | } | 114 | } |
| 115 | + | ||
| 116 | +Map<String, dynamic> $AliyunOssUploadStsCallbackParamToJson( | ||
| 117 | + AliyunOssUploadStsCallbackParam entity) { | ||
| 118 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 119 | + data['callbackBody'] = entity.callbackBody; | ||
| 120 | + data['callbackBodyType'] = entity.callbackBodyType; | ||
| 121 | + data['callbackUrl'] = entity.callbackUrl; | ||
| 122 | + return data; | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | +extension AliyunOssUploadStsCallbackParamExtension on AliyunOssUploadStsCallbackParam { | ||
| 126 | + AliyunOssUploadStsCallbackParam copyWith({ | ||
| 127 | + String? callbackBody, | ||
| 128 | + String? callbackBodyType, | ||
| 129 | + String? callbackUrl, | ||
| 130 | + }) { | ||
| 131 | + return AliyunOssUploadStsCallbackParam() | ||
| 132 | + ..callbackBody = callbackBody ?? this.callbackBody | ||
| 133 | + ..callbackBodyType = callbackBodyType ?? this.callbackBodyType | ||
| 134 | + ..callbackUrl = callbackUrl ?? this.callbackUrl; | ||
| 135 | + } | ||
| 136 | +} | ||
| 88 | \ No newline at end of file | 137 | \ No newline at end of file |
lib/generated/json/base/json_convert_content.dart
| @@ -10,30 +10,47 @@ import 'package:wow_english/models/course_module_entity.dart'; | @@ -10,30 +10,47 @@ import 'package:wow_english/models/course_module_entity.dart'; | ||
| 10 | import 'package:wow_english/models/course_process_entity.dart'; | 10 | import 'package:wow_english/models/course_process_entity.dart'; |
| 11 | import 'package:wow_english/models/follow_read_entity.dart'; | 11 | import 'package:wow_english/models/follow_read_entity.dart'; |
| 12 | import 'package:wow_english/models/listen_entity.dart'; | 12 | import 'package:wow_english/models/listen_entity.dart'; |
| 13 | +import 'package:wow_english/models/product_entity.dart'; | ||
| 13 | import 'package:wow_english/models/read_content_entity.dart'; | 14 | import 'package:wow_english/models/read_content_entity.dart'; |
| 14 | import 'package:wow_english/models/user_entity.dart'; | 15 | import 'package:wow_english/models/user_entity.dart'; |
| 15 | 16 | ||
| 16 | JsonConvert jsonConvert = JsonConvert(); | 17 | JsonConvert jsonConvert = JsonConvert(); |
| 18 | + | ||
| 17 | typedef JsonConvertFunction<T> = T Function(Map<String, dynamic> json); | 19 | typedef JsonConvertFunction<T> = T Function(Map<String, dynamic> json); |
| 18 | typedef EnumConvertFunction<T> = T Function(String value); | 20 | typedef EnumConvertFunction<T> = T Function(String value); |
| 21 | +typedef ConvertExceptionHandler = void Function(Object error, StackTrace stackTrace); | ||
| 22 | +extension MapSafeExt<K, V> on Map<K, V> { | ||
| 23 | + T? getOrNull<T>(K? key) { | ||
| 24 | + if (!containsKey(key) || key == null) { | ||
| 25 | + return null; | ||
| 26 | + } else { | ||
| 27 | + return this[key] as T?; | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | +} | ||
| 19 | 31 | ||
| 20 | class JsonConvert { | 32 | class JsonConvert { |
| 21 | - static final Map<String, JsonConvertFunction> convertFuncMap = { | ||
| 22 | - (AliyunOssUploadStsEntity).toString(): AliyunOssUploadStsEntity.fromJson, | ||
| 23 | - (AliyunOssUploadStsCallbackParam).toString(): AliyunOssUploadStsCallbackParam.fromJson, | ||
| 24 | - (CourseEntity).toString(): CourseEntity.fromJson, | ||
| 25 | - (CourseCourseLessons).toString(): CourseCourseLessons.fromJson, | ||
| 26 | - (CourseModuleEntity).toString(): CourseModuleEntity.fromJson, | ||
| 27 | - (CourseProcessEntity).toString(): CourseProcessEntity.fromJson, | ||
| 28 | - (CourseProcessReadings).toString(): CourseProcessReadings.fromJson, | ||
| 29 | - (CourseProcessTopics).toString(): CourseProcessTopics.fromJson, | ||
| 30 | - (CourseProcessTopicsTopicAnswerList).toString(): CourseProcessTopicsTopicAnswerList.fromJson, | ||
| 31 | - (CourseProcessVideos).toString(): CourseProcessVideos.fromJson, | ||
| 32 | - (FollowReadEntity).toString(): FollowReadEntity.fromJson, | ||
| 33 | - (ListenEntity).toString(): ListenEntity.fromJson, | ||
| 34 | - (ReadContentEntity).toString(): ReadContentEntity.fromJson, | ||
| 35 | - (UserEntity).toString(): UserEntity.fromJson, | ||
| 36 | - }; | 33 | + static ConvertExceptionHandler? onError; |
| 34 | + JsonConvertClassCollection convertFuncMap = JsonConvertClassCollection(); | ||
| 35 | + | ||
| 36 | + /// When you are in the development, to generate a new model class, hot-reload doesn't find new generation model class, you can build on MaterialApp method called jsonConvert. ReassembleConvertFuncMap (); This method only works in a development environment | ||
| 37 | + /// https://flutter.cn/docs/development/tools/hot-reload | ||
| 38 | + /// class MyApp extends StatelessWidget { | ||
| 39 | + /// const MyApp({Key? key}) | ||
| 40 | + /// : super(key: key); | ||
| 41 | + /// | ||
| 42 | + /// @override | ||
| 43 | + /// Widget build(BuildContext context) { | ||
| 44 | + /// jsonConvert.reassembleConvertFuncMap(); | ||
| 45 | + /// return MaterialApp(); | ||
| 46 | + /// } | ||
| 47 | + /// } | ||
| 48 | + void reassembleConvertFuncMap() { | ||
| 49 | + bool isReleaseMode = const bool.fromEnvironment('dart.vm.product'); | ||
| 50 | + if (!isReleaseMode) { | ||
| 51 | + convertFuncMap = JsonConvertClassCollection(); | ||
| 52 | + } | ||
| 53 | + } | ||
| 37 | 54 | ||
| 38 | T? convert<T>(dynamic value, {EnumConvertFunction? enumConvert}) { | 55 | T? convert<T>(dynamic value, {EnumConvertFunction? enumConvert}) { |
| 39 | if (value == null) { | 56 | if (value == null) { |
| @@ -46,30 +63,43 @@ class JsonConvert { | @@ -46,30 +63,43 @@ class JsonConvert { | ||
| 46 | return _asT<T>(value, enumConvert: enumConvert); | 63 | return _asT<T>(value, enumConvert: enumConvert); |
| 47 | } catch (e, stackTrace) { | 64 | } catch (e, stackTrace) { |
| 48 | debugPrint('asT<$T> $e $stackTrace'); | 65 | debugPrint('asT<$T> $e $stackTrace'); |
| 66 | + if (onError != null) { | ||
| 67 | + onError!(e, stackTrace); | ||
| 68 | + } | ||
| 49 | return null; | 69 | return null; |
| 50 | } | 70 | } |
| 51 | } | 71 | } |
| 52 | 72 | ||
| 53 | - List<T?>? convertList<T>(List<dynamic>? value, {EnumConvertFunction? enumConvert}) { | 73 | + List<T?>? convertList<T>(List<dynamic>? value, |
| 74 | + {EnumConvertFunction? enumConvert}) { | ||
| 54 | if (value == null) { | 75 | if (value == null) { |
| 55 | return null; | 76 | return null; |
| 56 | } | 77 | } |
| 57 | try { | 78 | try { |
| 58 | - return value.map((dynamic e) => _asT<T>(e,enumConvert: enumConvert)).toList(); | 79 | + return value.map((dynamic e) => _asT<T>(e, enumConvert: enumConvert)) |
| 80 | + .toList(); | ||
| 59 | } catch (e, stackTrace) { | 81 | } catch (e, stackTrace) { |
| 60 | debugPrint('asT<$T> $e $stackTrace'); | 82 | debugPrint('asT<$T> $e $stackTrace'); |
| 83 | + if (onError != null) { | ||
| 84 | + onError!(e, stackTrace); | ||
| 85 | + } | ||
| 61 | return <T>[]; | 86 | return <T>[]; |
| 62 | } | 87 | } |
| 63 | } | 88 | } |
| 64 | 89 | ||
| 65 | -List<T>? convertListNotNull<T>(dynamic value, {EnumConvertFunction? enumConvert}) { | 90 | + List<T>? convertListNotNull<T>(dynamic value, |
| 91 | + {EnumConvertFunction? enumConvert}) { | ||
| 66 | if (value == null) { | 92 | if (value == null) { |
| 67 | return null; | 93 | return null; |
| 68 | } | 94 | } |
| 69 | try { | 95 | try { |
| 70 | - return (value as List<dynamic>).map((dynamic e) => _asT<T>(e,enumConvert: enumConvert)!).toList(); | 96 | + return (value as List<dynamic>).map((dynamic e) => |
| 97 | + _asT<T>(e, enumConvert: enumConvert)!).toList(); | ||
| 71 | } catch (e, stackTrace) { | 98 | } catch (e, stackTrace) { |
| 72 | debugPrint('asT<$T> $e $stackTrace'); | 99 | debugPrint('asT<$T> $e $stackTrace'); |
| 100 | + if (onError != null) { | ||
| 101 | + onError!(e, stackTrace); | ||
| 102 | + } | ||
| 73 | return <T>[]; | 103 | return <T>[]; |
| 74 | } | 104 | } |
| 75 | } | 105 | } |
| @@ -102,68 +132,126 @@ List<T>? convertListNotNull<T>(dynamic value, {EnumConvertFunction? enumConvert} | @@ -102,68 +132,126 @@ List<T>? convertListNotNull<T>(dynamic value, {EnumConvertFunction? enumConvert} | ||
| 102 | return value as T; | 132 | return value as T; |
| 103 | } else { | 133 | } else { |
| 104 | if (convertFuncMap.containsKey(type)) { | 134 | if (convertFuncMap.containsKey(type)) { |
| 105 | - return convertFuncMap[type]!(Map<String, dynamic>.from(value)) as T; | 135 | + if (value == null) { |
| 136 | + return null; | ||
| 137 | + } | ||
| 138 | + return convertFuncMap[type]!(value as Map<String, dynamic>) as T; | ||
| 106 | } else { | 139 | } else { |
| 107 | - throw UnimplementedError('$type unimplemented'); | 140 | + throw UnimplementedError( |
| 141 | + '$type unimplemented,you can try running the app again'); | ||
| 108 | } | 142 | } |
| 109 | } | 143 | } |
| 110 | } | 144 | } |
| 111 | 145 | ||
| 112 | - //list is returned by type | ||
| 113 | - static M? _getListChildType<M>(List<Map<String, dynamic>> data) { | ||
| 114 | - if(<AliyunOssUploadStsEntity>[] is M){ | ||
| 115 | - return data.map<AliyunOssUploadStsEntity>((Map<String, dynamic> e) => AliyunOssUploadStsEntity.fromJson(e)).toList() as M; | ||
| 116 | - } | ||
| 117 | - if(<AliyunOssUploadStsCallbackParam>[] is M){ | ||
| 118 | - return data.map<AliyunOssUploadStsCallbackParam>((Map<String, dynamic> e) => AliyunOssUploadStsCallbackParam.fromJson(e)).toList() as M; | ||
| 119 | - } | ||
| 120 | - if(<CourseEntity>[] is M){ | ||
| 121 | - return data.map<CourseEntity>((Map<String, dynamic> e) => CourseEntity.fromJson(e)).toList() as M; | ||
| 122 | - } | ||
| 123 | - if(<CourseCourseLessons>[] is M){ | ||
| 124 | - return data.map<CourseCourseLessons>((Map<String, dynamic> e) => CourseCourseLessons.fromJson(e)).toList() as M; | ||
| 125 | - } | ||
| 126 | - if(<CourseModuleEntity>[] is M){ | ||
| 127 | - return data.map<CourseModuleEntity>((Map<String, dynamic> e) => CourseModuleEntity.fromJson(e)).toList() as M; | ||
| 128 | - } | ||
| 129 | - if(<CourseProcessEntity>[] is M){ | ||
| 130 | - return data.map<CourseProcessEntity>((Map<String, dynamic> e) => CourseProcessEntity.fromJson(e)).toList() as M; | ||
| 131 | - } | ||
| 132 | - if(<CourseProcessReadings>[] is M){ | ||
| 133 | - return data.map<CourseProcessReadings>((Map<String, dynamic> e) => CourseProcessReadings.fromJson(e)).toList() as M; | ||
| 134 | - } | ||
| 135 | - if(<CourseProcessTopics>[] is M){ | ||
| 136 | - return data.map<CourseProcessTopics>((Map<String, dynamic> e) => CourseProcessTopics.fromJson(e)).toList() as M; | ||
| 137 | - } | ||
| 138 | - if(<CourseProcessTopicsTopicAnswerList>[] is M){ | ||
| 139 | - return data.map<CourseProcessTopicsTopicAnswerList>((Map<String, dynamic> e) => CourseProcessTopicsTopicAnswerList.fromJson(e)).toList() as M; | ||
| 140 | - } | ||
| 141 | - if(<CourseProcessVideos>[] is M){ | ||
| 142 | - return data.map<CourseProcessVideos>((Map<String, dynamic> e) => CourseProcessVideos.fromJson(e)).toList() as M; | ||
| 143 | - } | ||
| 144 | - if(<FollowReadEntity>[] is M){ | ||
| 145 | - return data.map<FollowReadEntity>((Map<String, dynamic> e) => FollowReadEntity.fromJson(e)).toList() as M; | ||
| 146 | - } | ||
| 147 | - if(<ListenEntity>[] is M){ | ||
| 148 | - return data.map<ListenEntity>((Map<String, dynamic> e) => ListenEntity.fromJson(e)).toList() as M; | ||
| 149 | - } | ||
| 150 | - if(<ReadContentEntity>[] is M){ | ||
| 151 | - return data.map<ReadContentEntity>((Map<String, dynamic> e) => ReadContentEntity.fromJson(e)).toList() as M; | ||
| 152 | - } | ||
| 153 | - if(<UserEntity>[] is M){ | ||
| 154 | - return data.map<UserEntity>((Map<String, dynamic> e) => UserEntity.fromJson(e)).toList() as M; | ||
| 155 | - } | ||
| 156 | - | ||
| 157 | - debugPrint("${M.toString()} not found"); | ||
| 158 | - | ||
| 159 | - return null; | ||
| 160 | -} | 146 | + //list is returned by type |
| 147 | + static M? _getListChildType<M>(List<Map<String, dynamic>> data) { | ||
| 148 | + if (<AliyunOssUploadStsEntity>[] is M) { | ||
| 149 | + return data.map<AliyunOssUploadStsEntity>((Map<String, dynamic> e) => | ||
| 150 | + AliyunOssUploadStsEntity.fromJson(e)).toList() as M; | ||
| 151 | + } | ||
| 152 | + if (<AliyunOssUploadStsCallbackParam>[] is M) { | ||
| 153 | + return data.map<AliyunOssUploadStsCallbackParam>(( | ||
| 154 | + Map<String, dynamic> e) => | ||
| 155 | + AliyunOssUploadStsCallbackParam.fromJson(e)).toList() as M; | ||
| 156 | + } | ||
| 157 | + if (<CourseEntity>[] is M) { | ||
| 158 | + return data.map<CourseEntity>((Map<String, dynamic> e) => | ||
| 159 | + CourseEntity.fromJson(e)).toList() as M; | ||
| 160 | + } | ||
| 161 | + if (<CourseCourseLessons>[] is M) { | ||
| 162 | + return data.map<CourseCourseLessons>((Map<String, dynamic> e) => | ||
| 163 | + CourseCourseLessons.fromJson(e)).toList() as M; | ||
| 164 | + } | ||
| 165 | + if (<CourseModuleEntity>[] is M) { | ||
| 166 | + return data.map<CourseModuleEntity>((Map<String, dynamic> e) => | ||
| 167 | + CourseModuleEntity.fromJson(e)).toList() as M; | ||
| 168 | + } | ||
| 169 | + if (<CourseProcessEntity>[] is M) { | ||
| 170 | + return data.map<CourseProcessEntity>((Map<String, dynamic> e) => | ||
| 171 | + CourseProcessEntity.fromJson(e)).toList() as M; | ||
| 172 | + } | ||
| 173 | + if (<CourseProcessReadings>[] is M) { | ||
| 174 | + return data.map<CourseProcessReadings>((Map<String, dynamic> e) => | ||
| 175 | + CourseProcessReadings.fromJson(e)).toList() as M; | ||
| 176 | + } | ||
| 177 | + if (<CourseProcessTopics>[] is M) { | ||
| 178 | + return data.map<CourseProcessTopics>((Map<String, dynamic> e) => | ||
| 179 | + CourseProcessTopics.fromJson(e)).toList() as M; | ||
| 180 | + } | ||
| 181 | + if (<CourseProcessTopicsTopicAnswerList>[] is M) { | ||
| 182 | + return data.map<CourseProcessTopicsTopicAnswerList>(( | ||
| 183 | + Map<String, dynamic> e) => | ||
| 184 | + CourseProcessTopicsTopicAnswerList.fromJson(e)).toList() as M; | ||
| 185 | + } | ||
| 186 | + if (<CourseProcessVideos>[] is M) { | ||
| 187 | + return data.map<CourseProcessVideos>((Map<String, dynamic> e) => | ||
| 188 | + CourseProcessVideos.fromJson(e)).toList() as M; | ||
| 189 | + } | ||
| 190 | + if (<FollowReadEntity>[] is M) { | ||
| 191 | + return data.map<FollowReadEntity>((Map<String, dynamic> e) => | ||
| 192 | + FollowReadEntity.fromJson(e)).toList() as M; | ||
| 193 | + } | ||
| 194 | + if (<ListenEntity>[] is M) { | ||
| 195 | + return data.map<ListenEntity>((Map<String, dynamic> e) => | ||
| 196 | + ListenEntity.fromJson(e)).toList() as M; | ||
| 197 | + } | ||
| 198 | + if (<ProductEntity>[] is M) { | ||
| 199 | + return data.map<ProductEntity>((Map<String, dynamic> e) => | ||
| 200 | + ProductEntity.fromJson(e)).toList() as M; | ||
| 201 | + } | ||
| 202 | + if (<ReadContentEntity>[] is M) { | ||
| 203 | + return data.map<ReadContentEntity>((Map<String, dynamic> e) => | ||
| 204 | + ReadContentEntity.fromJson(e)).toList() as M; | ||
| 205 | + } | ||
| 206 | + if (<UserEntity>[] is M) { | ||
| 207 | + return data.map<UserEntity>((Map<String, dynamic> e) => | ||
| 208 | + UserEntity.fromJson(e)).toList() as M; | ||
| 209 | + } | ||
| 161 | 210 | ||
| 162 | - static M? fromJsonAsT<M>(dynamic json) { | ||
| 163 | - if (json is List) { | ||
| 164 | - return _getListChildType<M>(json.map((e) => e as Map<String, dynamic>).toList()); | ||
| 165 | - } else { | ||
| 166 | - return jsonConvert.convert<M>(json); | ||
| 167 | - } | ||
| 168 | - } | 211 | + debugPrint("$M not found"); |
| 212 | + | ||
| 213 | + return null; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + static M? fromJsonAsT<M>(dynamic json) { | ||
| 217 | + if (json is M) { | ||
| 218 | + return json; | ||
| 219 | + } | ||
| 220 | + if (json is List) { | ||
| 221 | + return _getListChildType<M>( | ||
| 222 | + json.map((dynamic e) => e as Map<String, dynamic>).toList()); | ||
| 223 | + } else { | ||
| 224 | + return jsonConvert.convert<M>(json); | ||
| 225 | + } | ||
| 226 | + } | ||
| 169 | } | 227 | } |
| 228 | + | ||
| 229 | +class JsonConvertClassCollection { | ||
| 230 | + Map<String, JsonConvertFunction> convertFuncMap = { | ||
| 231 | + (AliyunOssUploadStsEntity).toString(): AliyunOssUploadStsEntity.fromJson, | ||
| 232 | + (AliyunOssUploadStsCallbackParam) | ||
| 233 | + .toString(): AliyunOssUploadStsCallbackParam.fromJson, | ||
| 234 | + (CourseEntity).toString(): CourseEntity.fromJson, | ||
| 235 | + (CourseCourseLessons).toString(): CourseCourseLessons.fromJson, | ||
| 236 | + (CourseModuleEntity).toString(): CourseModuleEntity.fromJson, | ||
| 237 | + (CourseProcessEntity).toString(): CourseProcessEntity.fromJson, | ||
| 238 | + (CourseProcessReadings).toString(): CourseProcessReadings.fromJson, | ||
| 239 | + (CourseProcessTopics).toString(): CourseProcessTopics.fromJson, | ||
| 240 | + (CourseProcessTopicsTopicAnswerList) | ||
| 241 | + .toString(): CourseProcessTopicsTopicAnswerList.fromJson, | ||
| 242 | + (CourseProcessVideos).toString(): CourseProcessVideos.fromJson, | ||
| 243 | + (FollowReadEntity).toString(): FollowReadEntity.fromJson, | ||
| 244 | + (ListenEntity).toString(): ListenEntity.fromJson, | ||
| 245 | + (ProductEntity).toString(): ProductEntity.fromJson, | ||
| 246 | + (ReadContentEntity).toString(): ReadContentEntity.fromJson, | ||
| 247 | + (UserEntity).toString(): UserEntity.fromJson, | ||
| 248 | + }; | ||
| 249 | + | ||
| 250 | + bool containsKey(String type) { | ||
| 251 | + return convertFuncMap.containsKey(type); | ||
| 252 | + } | ||
| 253 | + | ||
| 254 | + JsonConvertFunction? operator [](String key) { | ||
| 255 | + return convertFuncMap[key]; | ||
| 256 | + } | ||
| 257 | +} | ||
| 170 | \ No newline at end of file | 258 | \ No newline at end of file |
lib/generated/json/base/json_field.dart
| @@ -4,10 +4,14 @@ | @@ -4,10 +4,14 @@ | ||
| 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 | 6 | ||
| 7 | -class JsonSerializable{ | ||
| 8 | - const JsonSerializable(); | 7 | +import 'package:meta/meta_meta.dart'; |
| 8 | + | ||
| 9 | +@Target({TargetKind.classType}) | ||
| 10 | +class JsonSerializable { | ||
| 11 | + const JsonSerializable(); | ||
| 9 | } | 12 | } |
| 10 | 13 | ||
| 14 | +@Target({TargetKind.field}) | ||
| 11 | class JSONField { | 15 | class JSONField { |
| 12 | //Specify the parse field name | 16 | //Specify the parse field name |
| 13 | final String? name; | 17 | final String? name; |
| @@ -18,8 +22,11 @@ class JSONField { | @@ -18,8 +22,11 @@ class JSONField { | ||
| 18 | //Whether to participate in fromMap | 22 | //Whether to participate in fromMap |
| 19 | final bool? deserialize; | 23 | final bool? deserialize; |
| 20 | 24 | ||
| 25 | + //Whether to participate in copyWith | ||
| 26 | + final bool? copyWith; | ||
| 27 | + | ||
| 21 | //Enumeration or not | 28 | //Enumeration or not |
| 22 | final bool? isEnum; | 29 | final bool? isEnum; |
| 23 | 30 | ||
| 24 | - const JSONField({this.name, this.serialize, this.deserialize, this.isEnum}); | 31 | + const JSONField({this.name, this.serialize, this.deserialize, this.isEnum, this.copyWith}); |
| 25 | } | 32 | } |
lib/generated/json/course_entity.g.dart
| @@ -2,116 +2,181 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | @@ -2,116 +2,181 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | ||
| 2 | import 'package:wow_english/models/course_entity.dart'; | 2 | import 'package:wow_english/models/course_entity.dart'; |
| 3 | 3 | ||
| 4 | CourseEntity $CourseEntityFromJson(Map<String, dynamic> json) { | 4 | CourseEntity $CourseEntityFromJson(Map<String, dynamic> json) { |
| 5 | - final CourseEntity courseEntity = CourseEntity(); | ||
| 6 | - final List<CourseCourseLessons>? courseLessons = jsonConvert.convertListNotNull<CourseCourseLessons>(json['courseLessons']); | ||
| 7 | - if (courseLessons != null) { | ||
| 8 | - courseEntity.courseLessons = courseLessons; | ||
| 9 | - } | ||
| 10 | - final int? nowCourseLesson = jsonConvert.convert<int>(json['nowCourseLesson']); | ||
| 11 | - if (nowCourseLesson != null) { | ||
| 12 | - courseEntity.nowCourseLesson = nowCourseLesson; | ||
| 13 | - } | ||
| 14 | - final int? nowCourseModuleId = jsonConvert.convert<int>(json['nowCourseModuleId']); | ||
| 15 | - if (nowCourseModuleId != null) { | ||
| 16 | - courseEntity.nowCourseModuleId = nowCourseModuleId; | ||
| 17 | - } | ||
| 18 | - final String? nowCourseModuleName = jsonConvert.convert<String>(json['nowCourseModuleName']); | ||
| 19 | - if (nowCourseModuleName != null) { | ||
| 20 | - courseEntity.nowCourseModuleName = nowCourseModuleName; | ||
| 21 | - } | ||
| 22 | - final int? totalCourseLesson = jsonConvert.convert<int>(json['totalCourseLesson']); | ||
| 23 | - if (totalCourseLesson != null) { | ||
| 24 | - courseEntity.totalCourseLesson = totalCourseLesson; | ||
| 25 | - } | ||
| 26 | - final String? courseModuleThemeColor = jsonConvert.convert<String>(json['courseModuleThemeColor']); | ||
| 27 | - if (courseModuleThemeColor != null) { | ||
| 28 | - courseEntity.courseModuleThemeColor = courseModuleThemeColor; | ||
| 29 | - } | ||
| 30 | - final String? courseModuleCode = jsonConvert.convert<String>(json['courseModuleCode']); | ||
| 31 | - if (courseModuleCode != null) { | ||
| 32 | - courseEntity.courseModuleCode = courseModuleCode; | ||
| 33 | - } | ||
| 34 | - return courseEntity; | 5 | + final CourseEntity courseEntity = CourseEntity(); |
| 6 | + final List< | ||
| 7 | + CourseCourseLessons>? courseLessons = (json['courseLessons'] as List< | ||
| 8 | + dynamic>?) | ||
| 9 | + ?.map( | ||
| 10 | + (e) => | ||
| 11 | + jsonConvert.convert<CourseCourseLessons>(e) as CourseCourseLessons) | ||
| 12 | + .toList(); | ||
| 13 | + if (courseLessons != null) { | ||
| 14 | + courseEntity.courseLessons = courseLessons; | ||
| 15 | + } | ||
| 16 | + final int? nowCourseLesson = jsonConvert.convert<int>( | ||
| 17 | + json['nowCourseLesson']); | ||
| 18 | + if (nowCourseLesson != null) { | ||
| 19 | + courseEntity.nowCourseLesson = nowCourseLesson; | ||
| 20 | + } | ||
| 21 | + final int? nowCourseModuleId = jsonConvert.convert<int>( | ||
| 22 | + json['nowCourseModuleId']); | ||
| 23 | + if (nowCourseModuleId != null) { | ||
| 24 | + courseEntity.nowCourseModuleId = nowCourseModuleId; | ||
| 25 | + } | ||
| 26 | + final String? nowCourseModuleName = jsonConvert.convert<String>( | ||
| 27 | + json['nowCourseModuleName']); | ||
| 28 | + if (nowCourseModuleName != null) { | ||
| 29 | + courseEntity.nowCourseModuleName = nowCourseModuleName; | ||
| 30 | + } | ||
| 31 | + final int? totalCourseLesson = jsonConvert.convert<int>( | ||
| 32 | + json['totalCourseLesson']); | ||
| 33 | + if (totalCourseLesson != null) { | ||
| 34 | + courseEntity.totalCourseLesson = totalCourseLesson; | ||
| 35 | + } | ||
| 36 | + final String? courseModuleThemeColor = jsonConvert.convert<String>( | ||
| 37 | + json['courseModuleThemeColor']); | ||
| 38 | + if (courseModuleThemeColor != null) { | ||
| 39 | + courseEntity.courseModuleThemeColor = courseModuleThemeColor; | ||
| 40 | + } | ||
| 41 | + final String? courseModuleCode = jsonConvert.convert<String>( | ||
| 42 | + json['courseModuleCode']); | ||
| 43 | + if (courseModuleCode != null) { | ||
| 44 | + courseEntity.courseModuleCode = courseModuleCode; | ||
| 45 | + } | ||
| 46 | + return courseEntity; | ||
| 35 | } | 47 | } |
| 36 | 48 | ||
| 37 | Map<String, dynamic> $CourseEntityToJson(CourseEntity entity) { | 49 | Map<String, dynamic> $CourseEntityToJson(CourseEntity entity) { |
| 38 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 39 | - data['courseLessons'] = entity.courseLessons?.map((v) => v.toJson()).toList(); | ||
| 40 | - data['nowCourseLesson'] = entity.nowCourseLesson; | ||
| 41 | - data['nowCourseModuleId'] = entity.nowCourseModuleId; | ||
| 42 | - data['nowCourseModuleName'] = entity.nowCourseModuleName; | ||
| 43 | - data['totalCourseLesson'] = entity.totalCourseLesson; | ||
| 44 | - data['courseModuleThemeColor'] = entity.courseModuleThemeColor; | ||
| 45 | - data['courseModuleCode'] = entity.courseModuleCode; | ||
| 46 | - return data; | 50 | + final Map<String, dynamic> data = <String, dynamic>{}; |
| 51 | + data['courseLessons'] = entity.courseLessons?.map((v) => v.toJson()).toList(); | ||
| 52 | + data['nowCourseLesson'] = entity.nowCourseLesson; | ||
| 53 | + data['nowCourseModuleId'] = entity.nowCourseModuleId; | ||
| 54 | + data['nowCourseModuleName'] = entity.nowCourseModuleName; | ||
| 55 | + data['totalCourseLesson'] = entity.totalCourseLesson; | ||
| 56 | + data['courseModuleThemeColor'] = entity.courseModuleThemeColor; | ||
| 57 | + data['courseModuleCode'] = entity.courseModuleCode; | ||
| 58 | + return data; | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +extension CourseEntityExtension on CourseEntity { | ||
| 62 | + CourseEntity copyWith({ | ||
| 63 | + List<CourseCourseLessons>? courseLessons, | ||
| 64 | + int? nowCourseLesson, | ||
| 65 | + int? nowCourseModuleId, | ||
| 66 | + String? nowCourseModuleName, | ||
| 67 | + int? totalCourseLesson, | ||
| 68 | + String? courseModuleThemeColor, | ||
| 69 | + String? courseModuleCode, | ||
| 70 | + }) { | ||
| 71 | + return CourseEntity() | ||
| 72 | + ..courseLessons = courseLessons ?? this.courseLessons | ||
| 73 | + ..nowCourseLesson = nowCourseLesson ?? this.nowCourseLesson | ||
| 74 | + ..nowCourseModuleId = nowCourseModuleId ?? this.nowCourseModuleId | ||
| 75 | + ..nowCourseModuleName = nowCourseModuleName ?? this.nowCourseModuleName | ||
| 76 | + ..totalCourseLesson = totalCourseLesson ?? this.totalCourseLesson | ||
| 77 | + ..courseModuleThemeColor = courseModuleThemeColor ?? | ||
| 78 | + this.courseModuleThemeColor | ||
| 79 | + ..courseModuleCode = courseModuleCode ?? this.courseModuleCode; | ||
| 80 | + } | ||
| 47 | } | 81 | } |
| 48 | 82 | ||
| 49 | CourseCourseLessons $CourseCourseLessonsFromJson(Map<String, dynamic> json) { | 83 | CourseCourseLessons $CourseCourseLessonsFromJson(Map<String, dynamic> json) { |
| 50 | - final CourseCourseLessons courseCourseLessons = CourseCourseLessons(); | ||
| 51 | - final int? courseModuleId = jsonConvert.convert<int>(json['courseModuleId']); | ||
| 52 | - if (courseModuleId != null) { | ||
| 53 | - courseCourseLessons.courseModuleId = courseModuleId; | ||
| 54 | - } | ||
| 55 | - final int? courseType = jsonConvert.convert<int>(json['courseType']); | ||
| 56 | - if (courseType != null) { | ||
| 57 | - courseCourseLessons.courseType = courseType; | ||
| 58 | - } | ||
| 59 | - final String? coverUrl = jsonConvert.convert<String>(json['coverUrl']); | ||
| 60 | - if (coverUrl != null) { | ||
| 61 | - courseCourseLessons.coverUrl = coverUrl; | ||
| 62 | - } | ||
| 63 | - final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 64 | - if (createTime != null) { | ||
| 65 | - courseCourseLessons.createTime = createTime; | ||
| 66 | - } | ||
| 67 | - final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 68 | - if (deleted != null) { | ||
| 69 | - courseCourseLessons.deleted = deleted; | ||
| 70 | - } | ||
| 71 | - final String? des = jsonConvert.convert<String>(json['des']); | ||
| 72 | - if (des != null) { | ||
| 73 | - courseCourseLessons.des = des; | ||
| 74 | - } | ||
| 75 | - final String? id = jsonConvert.convert<String>(json['id']); | ||
| 76 | - if (id != null) { | ||
| 77 | - courseCourseLessons.id = id; | ||
| 78 | - } | ||
| 79 | - final bool? lock = jsonConvert.convert<bool>(json['lock']); | ||
| 80 | - if (lock != null) { | ||
| 81 | - courseCourseLessons.lock = lock; | ||
| 82 | - } | ||
| 83 | - final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 84 | - if (modifyTime != null) { | ||
| 85 | - courseCourseLessons.modifyTime = modifyTime; | ||
| 86 | - } | ||
| 87 | - final String? name = jsonConvert.convert<String>(json['name']); | ||
| 88 | - if (name != null) { | ||
| 89 | - courseCourseLessons.name = name; | ||
| 90 | - } | ||
| 91 | - final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 92 | - if (sortOrder != null) { | ||
| 93 | - courseCourseLessons.sortOrder = sortOrder; | ||
| 94 | - } | ||
| 95 | - final int? status = jsonConvert.convert<int>(json['status']); | ||
| 96 | - if (status != null) { | ||
| 97 | - courseCourseLessons.status = status; | ||
| 98 | - } | ||
| 99 | - return courseCourseLessons; | 84 | + final CourseCourseLessons courseCourseLessons = CourseCourseLessons(); |
| 85 | + final int? courseModuleId = jsonConvert.convert<int>(json['courseModuleId']); | ||
| 86 | + if (courseModuleId != null) { | ||
| 87 | + courseCourseLessons.courseModuleId = courseModuleId; | ||
| 88 | + } | ||
| 89 | + final int? courseType = jsonConvert.convert<int>(json['courseType']); | ||
| 90 | + if (courseType != null) { | ||
| 91 | + courseCourseLessons.courseType = courseType; | ||
| 92 | + } | ||
| 93 | + final String? coverUrl = jsonConvert.convert<String>(json['coverUrl']); | ||
| 94 | + if (coverUrl != null) { | ||
| 95 | + courseCourseLessons.coverUrl = coverUrl; | ||
| 96 | + } | ||
| 97 | + final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 98 | + if (createTime != null) { | ||
| 99 | + courseCourseLessons.createTime = createTime; | ||
| 100 | + } | ||
| 101 | + final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 102 | + if (deleted != null) { | ||
| 103 | + courseCourseLessons.deleted = deleted; | ||
| 104 | + } | ||
| 105 | + final String? des = jsonConvert.convert<String>(json['des']); | ||
| 106 | + if (des != null) { | ||
| 107 | + courseCourseLessons.des = des; | ||
| 108 | + } | ||
| 109 | + final String? id = jsonConvert.convert<String>(json['id']); | ||
| 110 | + if (id != null) { | ||
| 111 | + courseCourseLessons.id = id; | ||
| 112 | + } | ||
| 113 | + final bool? lock = jsonConvert.convert<bool>(json['lock']); | ||
| 114 | + if (lock != null) { | ||
| 115 | + courseCourseLessons.lock = lock; | ||
| 116 | + } | ||
| 117 | + final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 118 | + if (modifyTime != null) { | ||
| 119 | + courseCourseLessons.modifyTime = modifyTime; | ||
| 120 | + } | ||
| 121 | + final String? name = jsonConvert.convert<String>(json['name']); | ||
| 122 | + if (name != null) { | ||
| 123 | + courseCourseLessons.name = name; | ||
| 124 | + } | ||
| 125 | + final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 126 | + if (sortOrder != null) { | ||
| 127 | + courseCourseLessons.sortOrder = sortOrder; | ||
| 128 | + } | ||
| 129 | + final int? status = jsonConvert.convert<int>(json['status']); | ||
| 130 | + if (status != null) { | ||
| 131 | + courseCourseLessons.status = status; | ||
| 132 | + } | ||
| 133 | + return courseCourseLessons; | ||
| 100 | } | 134 | } |
| 101 | 135 | ||
| 102 | Map<String, dynamic> $CourseCourseLessonsToJson(CourseCourseLessons entity) { | 136 | Map<String, dynamic> $CourseCourseLessonsToJson(CourseCourseLessons entity) { |
| 103 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 104 | - data['courseModuleId'] = entity.courseModuleId; | ||
| 105 | - data['courseType'] = entity.courseType; | ||
| 106 | - data['coverUrl'] = entity.coverUrl; | ||
| 107 | - data['createTime'] = entity.createTime; | ||
| 108 | - data['deleted'] = entity.deleted; | ||
| 109 | - data['des'] = entity.des; | ||
| 110 | - data['id'] = entity.id; | ||
| 111 | - data['lock'] = entity.lock; | ||
| 112 | - data['modifyTime'] = entity.modifyTime; | ||
| 113 | - data['name'] = entity.name; | ||
| 114 | - data['sortOrder'] = entity.sortOrder; | ||
| 115 | - data['status'] = entity.status; | ||
| 116 | - return data; | 137 | + final Map<String, dynamic> data = <String, dynamic>{}; |
| 138 | + data['courseModuleId'] = entity.courseModuleId; | ||
| 139 | + data['courseType'] = entity.courseType; | ||
| 140 | + data['coverUrl'] = entity.coverUrl; | ||
| 141 | + data['createTime'] = entity.createTime; | ||
| 142 | + data['deleted'] = entity.deleted; | ||
| 143 | + data['des'] = entity.des; | ||
| 144 | + data['id'] = entity.id; | ||
| 145 | + data['lock'] = entity.lock; | ||
| 146 | + data['modifyTime'] = entity.modifyTime; | ||
| 147 | + data['name'] = entity.name; | ||
| 148 | + data['sortOrder'] = entity.sortOrder; | ||
| 149 | + data['status'] = entity.status; | ||
| 150 | + return data; | ||
| 151 | +} | ||
| 152 | + | ||
| 153 | +extension CourseCourseLessonsExtension on CourseCourseLessons { | ||
| 154 | + CourseCourseLessons copyWith({ | ||
| 155 | + int? courseModuleId, | ||
| 156 | + int? courseType, | ||
| 157 | + String? coverUrl, | ||
| 158 | + String? createTime, | ||
| 159 | + String? deleted, | ||
| 160 | + String? des, | ||
| 161 | + String? id, | ||
| 162 | + bool? lock, | ||
| 163 | + String? modifyTime, | ||
| 164 | + String? name, | ||
| 165 | + int? sortOrder, | ||
| 166 | + int? status, | ||
| 167 | + }) { | ||
| 168 | + return CourseCourseLessons() | ||
| 169 | + ..courseModuleId = courseModuleId ?? this.courseModuleId | ||
| 170 | + ..courseType = courseType ?? this.courseType | ||
| 171 | + ..coverUrl = coverUrl ?? this.coverUrl | ||
| 172 | + ..createTime = createTime ?? this.createTime | ||
| 173 | + ..deleted = deleted ?? this.deleted | ||
| 174 | + ..des = des ?? this.des | ||
| 175 | + ..id = id ?? this.id | ||
| 176 | + ..lock = lock ?? this.lock | ||
| 177 | + ..modifyTime = modifyTime ?? this.modifyTime | ||
| 178 | + ..name = name ?? this.name | ||
| 179 | + ..sortOrder = sortOrder ?? this.sortOrder | ||
| 180 | + ..status = status ?? this.status; | ||
| 181 | + } | ||
| 117 | } | 182 | } |
| 118 | \ No newline at end of file | 183 | \ No newline at end of file |
lib/generated/json/course_module_entity.g.dart
| @@ -2,86 +2,126 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | @@ -2,86 +2,126 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | ||
| 2 | import 'package:wow_english/models/course_module_entity.dart'; | 2 | import 'package:wow_english/models/course_module_entity.dart'; |
| 3 | 3 | ||
| 4 | CourseModuleEntity $CourseModuleEntityFromJson(Map<String, dynamic> json) { | 4 | CourseModuleEntity $CourseModuleEntityFromJson(Map<String, dynamic> json) { |
| 5 | - final CourseModuleEntity courseModuleEntity = CourseModuleEntity(); | ||
| 6 | - final String? id = jsonConvert.convert<String>(json['id']); | ||
| 7 | - if (id != null) { | ||
| 8 | - courseModuleEntity.id = id; | ||
| 9 | - } | ||
| 10 | - final String? code = jsonConvert.convert<String>(json['code']); | ||
| 11 | - if (code != null) { | ||
| 12 | - courseModuleEntity.code = code; | ||
| 13 | - } | ||
| 14 | - final int? courseModuleThemeId = jsonConvert.convert<int>(json['courseModuleThemeId']); | ||
| 15 | - if (courseModuleThemeId != null) { | ||
| 16 | - courseModuleEntity.courseModuleThemeId = courseModuleThemeId; | ||
| 17 | - } | ||
| 18 | - final int? courseTotal = jsonConvert.convert<int>(json['courseTotal']); | ||
| 19 | - if (courseTotal != null) { | ||
| 20 | - courseModuleEntity.courseTotal = courseTotal; | ||
| 21 | - } | ||
| 22 | - final String? coverUrl = jsonConvert.convert<String>(json['coverUrl']); | ||
| 23 | - if (coverUrl != null) { | ||
| 24 | - courseModuleEntity.coverUrl = coverUrl; | ||
| 25 | - } | ||
| 26 | - final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 27 | - if (createTime != null) { | ||
| 28 | - courseModuleEntity.createTime = createTime; | ||
| 29 | - } | ||
| 30 | - final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 31 | - if (deleted != null) { | ||
| 32 | - courseModuleEntity.deleted = deleted; | ||
| 33 | - } | ||
| 34 | - final String? des = jsonConvert.convert<String>(json['des']); | ||
| 35 | - if (des != null) { | ||
| 36 | - courseModuleEntity.des = des; | ||
| 37 | - } | ||
| 38 | - final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 39 | - if (modifyTime != null) { | ||
| 40 | - courseModuleEntity.modifyTime = modifyTime; | ||
| 41 | - } | ||
| 42 | - final String? name = jsonConvert.convert<String>(json['name']); | ||
| 43 | - if (name != null) { | ||
| 44 | - courseModuleEntity.name = name; | ||
| 45 | - } | ||
| 46 | - final int? opening = jsonConvert.convert<int>(json['opening']); | ||
| 47 | - if (opening != null) { | ||
| 48 | - courseModuleEntity.opening = opening; | ||
| 49 | - } | ||
| 50 | - final String? picUrl = jsonConvert.convert<String>(json['picUrl']); | ||
| 51 | - if (picUrl != null) { | ||
| 52 | - courseModuleEntity.picUrl = picUrl; | ||
| 53 | - } | ||
| 54 | - final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 55 | - if (sortOrder != null) { | ||
| 56 | - courseModuleEntity.sortOrder = sortOrder; | ||
| 57 | - } | ||
| 58 | - final int? status = jsonConvert.convert<int>(json['status']); | ||
| 59 | - if (status != null) { | ||
| 60 | - courseModuleEntity.status = status; | ||
| 61 | - } | ||
| 62 | - final String? courseModuleThemeColor = jsonConvert.convert<String>(json['courseModuleThemeColor']); | ||
| 63 | - if (courseModuleThemeColor != null) { | ||
| 64 | - courseModuleEntity.courseModuleThemeColor = courseModuleThemeColor; | ||
| 65 | - } | ||
| 66 | - return courseModuleEntity; | 5 | + final CourseModuleEntity courseModuleEntity = CourseModuleEntity(); |
| 6 | + final String? id = jsonConvert.convert<String>(json['id']); | ||
| 7 | + if (id != null) { | ||
| 8 | + courseModuleEntity.id = id; | ||
| 9 | + } | ||
| 10 | + final String? code = jsonConvert.convert<String>(json['code']); | ||
| 11 | + if (code != null) { | ||
| 12 | + courseModuleEntity.code = code; | ||
| 13 | + } | ||
| 14 | + final int? courseModuleThemeId = jsonConvert.convert<int>( | ||
| 15 | + json['courseModuleThemeId']); | ||
| 16 | + if (courseModuleThemeId != null) { | ||
| 17 | + courseModuleEntity.courseModuleThemeId = courseModuleThemeId; | ||
| 18 | + } | ||
| 19 | + final int? courseTotal = jsonConvert.convert<int>(json['courseTotal']); | ||
| 20 | + if (courseTotal != null) { | ||
| 21 | + courseModuleEntity.courseTotal = courseTotal; | ||
| 22 | + } | ||
| 23 | + final String? coverUrl = jsonConvert.convert<String>(json['coverUrl']); | ||
| 24 | + if (coverUrl != null) { | ||
| 25 | + courseModuleEntity.coverUrl = coverUrl; | ||
| 26 | + } | ||
| 27 | + final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 28 | + if (createTime != null) { | ||
| 29 | + courseModuleEntity.createTime = createTime; | ||
| 30 | + } | ||
| 31 | + final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 32 | + if (deleted != null) { | ||
| 33 | + courseModuleEntity.deleted = deleted; | ||
| 34 | + } | ||
| 35 | + final String? des = jsonConvert.convert<String>(json['des']); | ||
| 36 | + if (des != null) { | ||
| 37 | + courseModuleEntity.des = des; | ||
| 38 | + } | ||
| 39 | + final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 40 | + if (modifyTime != null) { | ||
| 41 | + courseModuleEntity.modifyTime = modifyTime; | ||
| 42 | + } | ||
| 43 | + final String? name = jsonConvert.convert<String>(json['name']); | ||
| 44 | + if (name != null) { | ||
| 45 | + courseModuleEntity.name = name; | ||
| 46 | + } | ||
| 47 | + final int? opening = jsonConvert.convert<int>(json['opening']); | ||
| 48 | + if (opening != null) { | ||
| 49 | + courseModuleEntity.opening = opening; | ||
| 50 | + } | ||
| 51 | + final String? picUrl = jsonConvert.convert<String>(json['picUrl']); | ||
| 52 | + if (picUrl != null) { | ||
| 53 | + courseModuleEntity.picUrl = picUrl; | ||
| 54 | + } | ||
| 55 | + final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 56 | + if (sortOrder != null) { | ||
| 57 | + courseModuleEntity.sortOrder = sortOrder; | ||
| 58 | + } | ||
| 59 | + final int? status = jsonConvert.convert<int>(json['status']); | ||
| 60 | + if (status != null) { | ||
| 61 | + courseModuleEntity.status = status; | ||
| 62 | + } | ||
| 63 | + final String? courseModuleThemeColor = jsonConvert.convert<String>( | ||
| 64 | + json['courseModuleThemeColor']); | ||
| 65 | + if (courseModuleThemeColor != null) { | ||
| 66 | + courseModuleEntity.courseModuleThemeColor = courseModuleThemeColor; | ||
| 67 | + } | ||
| 68 | + return courseModuleEntity; | ||
| 67 | } | 69 | } |
| 68 | 70 | ||
| 69 | Map<String, dynamic> $CourseModuleEntityToJson(CourseModuleEntity entity) { | 71 | Map<String, dynamic> $CourseModuleEntityToJson(CourseModuleEntity entity) { |
| 70 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 71 | - data['id'] = entity.id; | ||
| 72 | - data['code'] = entity.code; | ||
| 73 | - data['courseModuleThemeId'] = entity.courseModuleThemeId; | ||
| 74 | - data['courseTotal'] = entity.courseTotal; | ||
| 75 | - data['coverUrl'] = entity.coverUrl; | ||
| 76 | - data['createTime'] = entity.createTime; | ||
| 77 | - data['deleted'] = entity.deleted; | ||
| 78 | - data['des'] = entity.des; | ||
| 79 | - data['modifyTime'] = entity.modifyTime; | ||
| 80 | - data['name'] = entity.name; | ||
| 81 | - data['opening'] = entity.opening; | ||
| 82 | - data['picUrl'] = entity.picUrl; | ||
| 83 | - data['sortOrder'] = entity.sortOrder; | ||
| 84 | - data['status'] = entity.status; | ||
| 85 | - data['courseModuleThemeColor'] = entity.courseModuleThemeColor; | ||
| 86 | - return data; | 72 | + final Map<String, dynamic> data = <String, dynamic>{}; |
| 73 | + data['id'] = entity.id; | ||
| 74 | + data['code'] = entity.code; | ||
| 75 | + data['courseModuleThemeId'] = entity.courseModuleThemeId; | ||
| 76 | + data['courseTotal'] = entity.courseTotal; | ||
| 77 | + data['coverUrl'] = entity.coverUrl; | ||
| 78 | + data['createTime'] = entity.createTime; | ||
| 79 | + data['deleted'] = entity.deleted; | ||
| 80 | + data['des'] = entity.des; | ||
| 81 | + data['modifyTime'] = entity.modifyTime; | ||
| 82 | + data['name'] = entity.name; | ||
| 83 | + data['opening'] = entity.opening; | ||
| 84 | + data['picUrl'] = entity.picUrl; | ||
| 85 | + data['sortOrder'] = entity.sortOrder; | ||
| 86 | + data['status'] = entity.status; | ||
| 87 | + data['courseModuleThemeColor'] = entity.courseModuleThemeColor; | ||
| 88 | + return data; | ||
| 87 | } | 89 | } |
| 90 | + | ||
| 91 | +extension CourseModuleEntityExtension on CourseModuleEntity { | ||
| 92 | + CourseModuleEntity copyWith({ | ||
| 93 | + String? id, | ||
| 94 | + String? code, | ||
| 95 | + int? courseModuleThemeId, | ||
| 96 | + int? courseTotal, | ||
| 97 | + String? coverUrl, | ||
| 98 | + String? createTime, | ||
| 99 | + String? deleted, | ||
| 100 | + String? des, | ||
| 101 | + String? modifyTime, | ||
| 102 | + String? name, | ||
| 103 | + int? opening, | ||
| 104 | + String? picUrl, | ||
| 105 | + int? sortOrder, | ||
| 106 | + int? status, | ||
| 107 | + String? courseModuleThemeColor, | ||
| 108 | + }) { | ||
| 109 | + return CourseModuleEntity() | ||
| 110 | + ..id = id ?? this.id | ||
| 111 | + ..code = code ?? this.code | ||
| 112 | + ..courseModuleThemeId = courseModuleThemeId ?? this.courseModuleThemeId | ||
| 113 | + ..courseTotal = courseTotal ?? this.courseTotal | ||
| 114 | + ..coverUrl = coverUrl ?? this.coverUrl | ||
| 115 | + ..createTime = createTime ?? this.createTime | ||
| 116 | + ..deleted = deleted ?? this.deleted | ||
| 117 | + ..des = des ?? this.des | ||
| 118 | + ..modifyTime = modifyTime ?? this.modifyTime | ||
| 119 | + ..name = name ?? this.name | ||
| 120 | + ..opening = opening ?? this.opening | ||
| 121 | + ..picUrl = picUrl ?? this.picUrl | ||
| 122 | + ..sortOrder = sortOrder ?? this.sortOrder | ||
| 123 | + ..status = status ?? this.status | ||
| 124 | + ..courseModuleThemeColor = courseModuleThemeColor ?? | ||
| 125 | + this.courseModuleThemeColor; | ||
| 126 | + } | ||
| 127 | +} | ||
| 88 | \ No newline at end of file | 128 | \ No newline at end of file |
lib/generated/json/course_process_entity.g.dart
| @@ -2,286 +2,435 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | @@ -2,286 +2,435 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | ||
| 2 | import 'package:wow_english/models/course_process_entity.dart'; | 2 | import 'package:wow_english/models/course_process_entity.dart'; |
| 3 | 3 | ||
| 4 | CourseProcessEntity $CourseProcessEntityFromJson(Map<String, dynamic> json) { | 4 | CourseProcessEntity $CourseProcessEntityFromJson(Map<String, dynamic> json) { |
| 5 | - final CourseProcessEntity courseProcessEntity = CourseProcessEntity(); | ||
| 6 | - final int? currentStep = jsonConvert.convert<int>(json['currentStep']); | ||
| 7 | - if (currentStep != null) { | ||
| 8 | - courseProcessEntity.currentStep = currentStep; | ||
| 9 | - } | ||
| 10 | - final int? currentTime = jsonConvert.convert<int>(json['currentTime']); | ||
| 11 | - if (currentTime != null) { | ||
| 12 | - courseProcessEntity.currentTime = currentTime; | ||
| 13 | - } | ||
| 14 | - final List<CourseProcessReadings>? readings = jsonConvert.convertListNotNull<CourseProcessReadings>(json['readings']); | ||
| 15 | - if (readings != null) { | ||
| 16 | - courseProcessEntity.readings = readings; | ||
| 17 | - } | ||
| 18 | - final List<CourseProcessTopics>? topics = jsonConvert.convertListNotNull<CourseProcessTopics>(json['topics']); | ||
| 19 | - if (topics != null) { | ||
| 20 | - courseProcessEntity.topics = topics; | ||
| 21 | - } | ||
| 22 | - final CourseProcessVideos? videos = jsonConvert.convert<CourseProcessVideos>(json['videos']); | ||
| 23 | - if (videos != null) { | ||
| 24 | - courseProcessEntity.videos = videos; | ||
| 25 | - } | ||
| 26 | - return courseProcessEntity; | 5 | + final CourseProcessEntity courseProcessEntity = CourseProcessEntity(); |
| 6 | + final int? currentStep = jsonConvert.convert<int>(json['currentStep']); | ||
| 7 | + if (currentStep != null) { | ||
| 8 | + courseProcessEntity.currentStep = currentStep; | ||
| 9 | + } | ||
| 10 | + final int? currentTime = jsonConvert.convert<int>(json['currentTime']); | ||
| 11 | + if (currentTime != null) { | ||
| 12 | + courseProcessEntity.currentTime = currentTime; | ||
| 13 | + } | ||
| 14 | + final List<CourseProcessReadings>? readings = (json['readings'] as List< | ||
| 15 | + dynamic>?) | ||
| 16 | + ?.map( | ||
| 17 | + (e) => | ||
| 18 | + jsonConvert.convert<CourseProcessReadings>(e) as CourseProcessReadings) | ||
| 19 | + .toList(); | ||
| 20 | + if (readings != null) { | ||
| 21 | + courseProcessEntity.readings = readings; | ||
| 22 | + } | ||
| 23 | + final List<CourseProcessTopics>? topics = (json['topics'] as List<dynamic>?) | ||
| 24 | + ?.map( | ||
| 25 | + (e) => | ||
| 26 | + jsonConvert.convert<CourseProcessTopics>(e) as CourseProcessTopics) | ||
| 27 | + .toList(); | ||
| 28 | + if (topics != null) { | ||
| 29 | + courseProcessEntity.topics = topics; | ||
| 30 | + } | ||
| 31 | + final CourseProcessVideos? videos = jsonConvert.convert<CourseProcessVideos>( | ||
| 32 | + json['videos']); | ||
| 33 | + if (videos != null) { | ||
| 34 | + courseProcessEntity.videos = videos; | ||
| 35 | + } | ||
| 36 | + return courseProcessEntity; | ||
| 27 | } | 37 | } |
| 28 | 38 | ||
| 29 | Map<String, dynamic> $CourseProcessEntityToJson(CourseProcessEntity entity) { | 39 | Map<String, dynamic> $CourseProcessEntityToJson(CourseProcessEntity entity) { |
| 30 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 31 | - data['currentStep'] = entity.currentStep; | ||
| 32 | - data['currentTime'] = entity.currentTime; | ||
| 33 | - data['readings'] = entity.readings?.map((v) => v.toJson()).toList(); | ||
| 34 | - data['topics'] = entity.topics?.map((v) => v.toJson()).toList(); | ||
| 35 | - data['videos'] = entity.videos?.toJson(); | ||
| 36 | - return data; | 40 | + final Map<String, dynamic> data = <String, dynamic>{}; |
| 41 | + data['currentStep'] = entity.currentStep; | ||
| 42 | + data['currentTime'] = entity.currentTime; | ||
| 43 | + data['readings'] = entity.readings?.map((v) => v.toJson()).toList(); | ||
| 44 | + data['topics'] = entity.topics?.map((v) => v.toJson()).toList(); | ||
| 45 | + data['videos'] = entity.videos?.toJson(); | ||
| 46 | + return data; | ||
| 37 | } | 47 | } |
| 38 | 48 | ||
| 39 | -CourseProcessReadings $CourseProcessReadingsFromJson(Map<String, dynamic> json) { | ||
| 40 | - final CourseProcessReadings courseProcessReadings = CourseProcessReadings(); | ||
| 41 | - final String? audioUrl = jsonConvert.convert<String>(json['audioUrl']); | ||
| 42 | - if (audioUrl != null) { | ||
| 43 | - courseProcessReadings.audioUrl = audioUrl; | ||
| 44 | - } | ||
| 45 | - final int? courseLessonId = jsonConvert.convert<int>(json['courseLessonId']); | ||
| 46 | - if (courseLessonId != null) { | ||
| 47 | - courseProcessReadings.courseLessonId = courseLessonId; | ||
| 48 | - } | ||
| 49 | - final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 50 | - if (createTime != null) { | ||
| 51 | - courseProcessReadings.createTime = createTime; | ||
| 52 | - } | ||
| 53 | - final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 54 | - if (deleted != null) { | ||
| 55 | - courseProcessReadings.deleted = deleted; | ||
| 56 | - } | ||
| 57 | - final String? id = jsonConvert.convert<String>(json['id']); | ||
| 58 | - if (id != null) { | ||
| 59 | - courseProcessReadings.id = id; | ||
| 60 | - } | ||
| 61 | - final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 62 | - if (modifyTime != null) { | ||
| 63 | - courseProcessReadings.modifyTime = modifyTime; | ||
| 64 | - } | ||
| 65 | - final String? padPicUrl = jsonConvert.convert<String>(json['padPicUrl']); | ||
| 66 | - if (padPicUrl != null) { | ||
| 67 | - courseProcessReadings.padPicUrl = padPicUrl; | ||
| 68 | - } | ||
| 69 | - final String? picUrl = jsonConvert.convert<String>(json['picUrl']); | ||
| 70 | - if (picUrl != null) { | ||
| 71 | - courseProcessReadings.picUrl = picUrl; | ||
| 72 | - } | ||
| 73 | - final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 74 | - if (sortOrder != null) { | ||
| 75 | - courseProcessReadings.sortOrder = sortOrder; | ||
| 76 | - } | ||
| 77 | - final String? word = jsonConvert.convert<String>(json['word']); | ||
| 78 | - if (word != null) { | ||
| 79 | - courseProcessReadings.word = word; | ||
| 80 | - } | ||
| 81 | - final String? recordUrl = jsonConvert.convert<String>(json['recordUrl']); | ||
| 82 | - if (recordUrl != null) { | ||
| 83 | - courseProcessReadings.recordUrl = recordUrl; | ||
| 84 | - } | ||
| 85 | - final String? recordScore = jsonConvert.convert<String>(json['recordScore']); | ||
| 86 | - if (recordScore != null) { | ||
| 87 | - courseProcessReadings.recordScore = recordScore; | ||
| 88 | - } | ||
| 89 | - return courseProcessReadings; | 49 | +extension CourseProcessEntityExtension on CourseProcessEntity { |
| 50 | + CourseProcessEntity copyWith({ | ||
| 51 | + int? currentStep, | ||
| 52 | + int? currentTime, | ||
| 53 | + List<CourseProcessReadings>? readings, | ||
| 54 | + List<CourseProcessTopics>? topics, | ||
| 55 | + CourseProcessVideos? videos, | ||
| 56 | + }) { | ||
| 57 | + return CourseProcessEntity() | ||
| 58 | + ..currentStep = currentStep ?? this.currentStep | ||
| 59 | + ..currentTime = currentTime ?? this.currentTime | ||
| 60 | + ..readings = readings ?? this.readings | ||
| 61 | + ..topics = topics ?? this.topics | ||
| 62 | + ..videos = videos ?? this.videos; | ||
| 63 | + } | ||
| 90 | } | 64 | } |
| 91 | 65 | ||
| 92 | -Map<String, dynamic> $CourseProcessReadingsToJson(CourseProcessReadings entity) { | ||
| 93 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 94 | - data['audioUrl'] = entity.audioUrl; | ||
| 95 | - data['courseLessonId'] = entity.courseLessonId; | ||
| 96 | - data['createTime'] = entity.createTime; | ||
| 97 | - data['deleted'] = entity.deleted; | ||
| 98 | - data['id'] = entity.id; | ||
| 99 | - data['modifyTime'] = entity.modifyTime; | ||
| 100 | - data['padPicUrl'] = entity.padPicUrl; | ||
| 101 | - data['picUrl'] = entity.picUrl; | ||
| 102 | - data['sortOrder'] = entity.sortOrder; | ||
| 103 | - data['word'] = entity.word; | ||
| 104 | - data['recordUrl'] = entity.recordUrl; | ||
| 105 | - data['recordScore'] = entity.recordScore; | ||
| 106 | - return data; | 66 | +CourseProcessReadings $CourseProcessReadingsFromJson( |
| 67 | + Map<String, dynamic> json) { | ||
| 68 | + final CourseProcessReadings courseProcessReadings = CourseProcessReadings(); | ||
| 69 | + final String? audioUrl = jsonConvert.convert<String>(json['audioUrl']); | ||
| 70 | + if (audioUrl != null) { | ||
| 71 | + courseProcessReadings.audioUrl = audioUrl; | ||
| 72 | + } | ||
| 73 | + final int? courseLessonId = jsonConvert.convert<int>(json['courseLessonId']); | ||
| 74 | + if (courseLessonId != null) { | ||
| 75 | + courseProcessReadings.courseLessonId = courseLessonId; | ||
| 76 | + } | ||
| 77 | + final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 78 | + if (createTime != null) { | ||
| 79 | + courseProcessReadings.createTime = createTime; | ||
| 80 | + } | ||
| 81 | + final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 82 | + if (deleted != null) { | ||
| 83 | + courseProcessReadings.deleted = deleted; | ||
| 84 | + } | ||
| 85 | + final String? id = jsonConvert.convert<String>(json['id']); | ||
| 86 | + if (id != null) { | ||
| 87 | + courseProcessReadings.id = id; | ||
| 88 | + } | ||
| 89 | + final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 90 | + if (modifyTime != null) { | ||
| 91 | + courseProcessReadings.modifyTime = modifyTime; | ||
| 92 | + } | ||
| 93 | + final String? padPicUrl = jsonConvert.convert<String>(json['padPicUrl']); | ||
| 94 | + if (padPicUrl != null) { | ||
| 95 | + courseProcessReadings.padPicUrl = padPicUrl; | ||
| 96 | + } | ||
| 97 | + final String? picUrl = jsonConvert.convert<String>(json['picUrl']); | ||
| 98 | + if (picUrl != null) { | ||
| 99 | + courseProcessReadings.picUrl = picUrl; | ||
| 100 | + } | ||
| 101 | + final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 102 | + if (sortOrder != null) { | ||
| 103 | + courseProcessReadings.sortOrder = sortOrder; | ||
| 104 | + } | ||
| 105 | + final String? word = jsonConvert.convert<String>(json['word']); | ||
| 106 | + if (word != null) { | ||
| 107 | + courseProcessReadings.word = word; | ||
| 108 | + } | ||
| 109 | + final String? recordUrl = jsonConvert.convert<String>(json['recordUrl']); | ||
| 110 | + if (recordUrl != null) { | ||
| 111 | + courseProcessReadings.recordUrl = recordUrl; | ||
| 112 | + } | ||
| 113 | + final String? recordScore = jsonConvert.convert<String>(json['recordScore']); | ||
| 114 | + if (recordScore != null) { | ||
| 115 | + courseProcessReadings.recordScore = recordScore; | ||
| 116 | + } | ||
| 117 | + return courseProcessReadings; | ||
| 118 | +} | ||
| 119 | + | ||
| 120 | +Map<String, dynamic> $CourseProcessReadingsToJson( | ||
| 121 | + CourseProcessReadings entity) { | ||
| 122 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 123 | + data['audioUrl'] = entity.audioUrl; | ||
| 124 | + data['courseLessonId'] = entity.courseLessonId; | ||
| 125 | + data['createTime'] = entity.createTime; | ||
| 126 | + data['deleted'] = entity.deleted; | ||
| 127 | + data['id'] = entity.id; | ||
| 128 | + data['modifyTime'] = entity.modifyTime; | ||
| 129 | + data['padPicUrl'] = entity.padPicUrl; | ||
| 130 | + data['picUrl'] = entity.picUrl; | ||
| 131 | + data['sortOrder'] = entity.sortOrder; | ||
| 132 | + data['word'] = entity.word; | ||
| 133 | + data['recordUrl'] = entity.recordUrl; | ||
| 134 | + data['recordScore'] = entity.recordScore; | ||
| 135 | + return data; | ||
| 136 | +} | ||
| 137 | + | ||
| 138 | +extension CourseProcessReadingsExtension on CourseProcessReadings { | ||
| 139 | + CourseProcessReadings copyWith({ | ||
| 140 | + String? audioUrl, | ||
| 141 | + int? courseLessonId, | ||
| 142 | + String? createTime, | ||
| 143 | + String? deleted, | ||
| 144 | + String? id, | ||
| 145 | + String? modifyTime, | ||
| 146 | + String? padPicUrl, | ||
| 147 | + String? picUrl, | ||
| 148 | + int? sortOrder, | ||
| 149 | + String? word, | ||
| 150 | + String? recordUrl, | ||
| 151 | + String? recordScore, | ||
| 152 | + }) { | ||
| 153 | + return CourseProcessReadings() | ||
| 154 | + ..audioUrl = audioUrl ?? this.audioUrl | ||
| 155 | + ..courseLessonId = courseLessonId ?? this.courseLessonId | ||
| 156 | + ..createTime = createTime ?? this.createTime | ||
| 157 | + ..deleted = deleted ?? this.deleted | ||
| 158 | + ..id = id ?? this.id | ||
| 159 | + ..modifyTime = modifyTime ?? this.modifyTime | ||
| 160 | + ..padPicUrl = padPicUrl ?? this.padPicUrl | ||
| 161 | + ..picUrl = picUrl ?? this.picUrl | ||
| 162 | + ..sortOrder = sortOrder ?? this.sortOrder | ||
| 163 | + ..word = word ?? this.word | ||
| 164 | + ..recordUrl = recordUrl ?? this.recordUrl | ||
| 165 | + ..recordScore = recordScore ?? this.recordScore; | ||
| 166 | + } | ||
| 107 | } | 167 | } |
| 108 | 168 | ||
| 109 | CourseProcessTopics $CourseProcessTopicsFromJson(Map<String, dynamic> json) { | 169 | CourseProcessTopics $CourseProcessTopicsFromJson(Map<String, dynamic> json) { |
| 110 | - final CourseProcessTopics courseProcessTopics = CourseProcessTopics(); | ||
| 111 | - final String? audioUrl = jsonConvert.convert<String>(json['audioUrl']); | ||
| 112 | - if (audioUrl != null) { | ||
| 113 | - courseProcessTopics.audioUrl = audioUrl; | ||
| 114 | - } | ||
| 115 | - final int? courseLessonId = jsonConvert.convert<int>(json['courseLessonId']); | ||
| 116 | - if (courseLessonId != null) { | ||
| 117 | - courseProcessTopics.courseLessonId = courseLessonId; | ||
| 118 | - } | ||
| 119 | - final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 120 | - if (createTime != null) { | ||
| 121 | - courseProcessTopics.createTime = createTime; | ||
| 122 | - } | ||
| 123 | - final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 124 | - if (deleted != null) { | ||
| 125 | - courseProcessTopics.deleted = deleted; | ||
| 126 | - } | ||
| 127 | - final String? id = jsonConvert.convert<String>(json['id']); | ||
| 128 | - if (id != null) { | ||
| 129 | - courseProcessTopics.id = id; | ||
| 130 | - } | ||
| 131 | - final String? keyWord = jsonConvert.convert<String>(json['keyWord']); | ||
| 132 | - if (keyWord != null) { | ||
| 133 | - courseProcessTopics.keyWord = keyWord; | ||
| 134 | - } | ||
| 135 | - final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 136 | - if (modifyTime != null) { | ||
| 137 | - courseProcessTopics.modifyTime = modifyTime; | ||
| 138 | - } | ||
| 139 | - final String? picUrl = jsonConvert.convert<String>(json['picUrl']); | ||
| 140 | - if (picUrl != null) { | ||
| 141 | - courseProcessTopics.picUrl = picUrl; | ||
| 142 | - } | ||
| 143 | - final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 144 | - if (sortOrder != null) { | ||
| 145 | - courseProcessTopics.sortOrder = sortOrder; | ||
| 146 | - } | ||
| 147 | - final int? status = jsonConvert.convert<int>(json['status']); | ||
| 148 | - if (status != null) { | ||
| 149 | - courseProcessTopics.status = status; | ||
| 150 | - } | ||
| 151 | - final List<CourseProcessTopicsTopicAnswerList>? topicAnswerList = jsonConvert.convertListNotNull<CourseProcessTopicsTopicAnswerList>(json['topicAnswerList']); | ||
| 152 | - if (topicAnswerList != null) { | ||
| 153 | - courseProcessTopics.topicAnswerList = topicAnswerList; | ||
| 154 | - } | ||
| 155 | - final int? type = jsonConvert.convert<int>(json['type']); | ||
| 156 | - if (type != null) { | ||
| 157 | - courseProcessTopics.type = type; | ||
| 158 | - } | ||
| 159 | - final String? word = jsonConvert.convert<String>(json['word']); | ||
| 160 | - if (word != null) { | ||
| 161 | - courseProcessTopics.word = word; | ||
| 162 | - } | ||
| 163 | - return courseProcessTopics; | 170 | + final CourseProcessTopics courseProcessTopics = CourseProcessTopics(); |
| 171 | + final String? audioUrl = jsonConvert.convert<String>(json['audioUrl']); | ||
| 172 | + if (audioUrl != null) { | ||
| 173 | + courseProcessTopics.audioUrl = audioUrl; | ||
| 174 | + } | ||
| 175 | + final int? courseLessonId = jsonConvert.convert<int>(json['courseLessonId']); | ||
| 176 | + if (courseLessonId != null) { | ||
| 177 | + courseProcessTopics.courseLessonId = courseLessonId; | ||
| 178 | + } | ||
| 179 | + final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 180 | + if (createTime != null) { | ||
| 181 | + courseProcessTopics.createTime = createTime; | ||
| 182 | + } | ||
| 183 | + final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 184 | + if (deleted != null) { | ||
| 185 | + courseProcessTopics.deleted = deleted; | ||
| 186 | + } | ||
| 187 | + final String? id = jsonConvert.convert<String>(json['id']); | ||
| 188 | + if (id != null) { | ||
| 189 | + courseProcessTopics.id = id; | ||
| 190 | + } | ||
| 191 | + final String? keyWord = jsonConvert.convert<String>(json['keyWord']); | ||
| 192 | + if (keyWord != null) { | ||
| 193 | + courseProcessTopics.keyWord = keyWord; | ||
| 194 | + } | ||
| 195 | + final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 196 | + if (modifyTime != null) { | ||
| 197 | + courseProcessTopics.modifyTime = modifyTime; | ||
| 198 | + } | ||
| 199 | + final String? picUrl = jsonConvert.convert<String>(json['picUrl']); | ||
| 200 | + if (picUrl != null) { | ||
| 201 | + courseProcessTopics.picUrl = picUrl; | ||
| 202 | + } | ||
| 203 | + final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 204 | + if (sortOrder != null) { | ||
| 205 | + courseProcessTopics.sortOrder = sortOrder; | ||
| 206 | + } | ||
| 207 | + final int? status = jsonConvert.convert<int>(json['status']); | ||
| 208 | + if (status != null) { | ||
| 209 | + courseProcessTopics.status = status; | ||
| 210 | + } | ||
| 211 | + final List< | ||
| 212 | + CourseProcessTopicsTopicAnswerList>? topicAnswerList = (json['topicAnswerList'] as List< | ||
| 213 | + dynamic>?)?.map( | ||
| 214 | + (e) => | ||
| 215 | + jsonConvert.convert<CourseProcessTopicsTopicAnswerList>( | ||
| 216 | + e) as CourseProcessTopicsTopicAnswerList).toList(); | ||
| 217 | + if (topicAnswerList != null) { | ||
| 218 | + courseProcessTopics.topicAnswerList = topicAnswerList; | ||
| 219 | + } | ||
| 220 | + final int? type = jsonConvert.convert<int>(json['type']); | ||
| 221 | + if (type != null) { | ||
| 222 | + courseProcessTopics.type = type; | ||
| 223 | + } | ||
| 224 | + final String? word = jsonConvert.convert<String>(json['word']); | ||
| 225 | + if (word != null) { | ||
| 226 | + courseProcessTopics.word = word; | ||
| 227 | + } | ||
| 228 | + return courseProcessTopics; | ||
| 164 | } | 229 | } |
| 165 | 230 | ||
| 166 | Map<String, dynamic> $CourseProcessTopicsToJson(CourseProcessTopics entity) { | 231 | Map<String, dynamic> $CourseProcessTopicsToJson(CourseProcessTopics entity) { |
| 167 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 168 | - data['audioUrl'] = entity.audioUrl; | ||
| 169 | - data['courseLessonId'] = entity.courseLessonId; | ||
| 170 | - data['createTime'] = entity.createTime; | ||
| 171 | - data['deleted'] = entity.deleted; | ||
| 172 | - data['id'] = entity.id; | ||
| 173 | - data['keyWord'] = entity.keyWord; | ||
| 174 | - data['modifyTime'] = entity.modifyTime; | ||
| 175 | - data['picUrl'] = entity.picUrl; | ||
| 176 | - data['sortOrder'] = entity.sortOrder; | ||
| 177 | - data['status'] = entity.status; | ||
| 178 | - data['topicAnswerList'] = entity.topicAnswerList?.map((v) => v.toJson()).toList(); | ||
| 179 | - data['type'] = entity.type; | ||
| 180 | - data['word'] = entity.word; | ||
| 181 | - return data; | 232 | + final Map<String, dynamic> data = <String, dynamic>{}; |
| 233 | + data['audioUrl'] = entity.audioUrl; | ||
| 234 | + data['courseLessonId'] = entity.courseLessonId; | ||
| 235 | + data['createTime'] = entity.createTime; | ||
| 236 | + data['deleted'] = entity.deleted; | ||
| 237 | + data['id'] = entity.id; | ||
| 238 | + data['keyWord'] = entity.keyWord; | ||
| 239 | + data['modifyTime'] = entity.modifyTime; | ||
| 240 | + data['picUrl'] = entity.picUrl; | ||
| 241 | + data['sortOrder'] = entity.sortOrder; | ||
| 242 | + data['status'] = entity.status; | ||
| 243 | + data['topicAnswerList'] = | ||
| 244 | + entity.topicAnswerList?.map((v) => v.toJson()).toList(); | ||
| 245 | + data['type'] = entity.type; | ||
| 246 | + data['word'] = entity.word; | ||
| 247 | + return data; | ||
| 248 | +} | ||
| 249 | + | ||
| 250 | +extension CourseProcessTopicsExtension on CourseProcessTopics { | ||
| 251 | + CourseProcessTopics copyWith({ | ||
| 252 | + String? audioUrl, | ||
| 253 | + int? courseLessonId, | ||
| 254 | + String? createTime, | ||
| 255 | + String? deleted, | ||
| 256 | + String? id, | ||
| 257 | + String? keyWord, | ||
| 258 | + String? modifyTime, | ||
| 259 | + String? picUrl, | ||
| 260 | + int? sortOrder, | ||
| 261 | + int? status, | ||
| 262 | + List<CourseProcessTopicsTopicAnswerList>? topicAnswerList, | ||
| 263 | + int? type, | ||
| 264 | + String? word, | ||
| 265 | + }) { | ||
| 266 | + return CourseProcessTopics() | ||
| 267 | + ..audioUrl = audioUrl ?? this.audioUrl | ||
| 268 | + ..courseLessonId = courseLessonId ?? this.courseLessonId | ||
| 269 | + ..createTime = createTime ?? this.createTime | ||
| 270 | + ..deleted = deleted ?? this.deleted | ||
| 271 | + ..id = id ?? this.id | ||
| 272 | + ..keyWord = keyWord ?? this.keyWord | ||
| 273 | + ..modifyTime = modifyTime ?? this.modifyTime | ||
| 274 | + ..picUrl = picUrl ?? this.picUrl | ||
| 275 | + ..sortOrder = sortOrder ?? this.sortOrder | ||
| 276 | + ..status = status ?? this.status | ||
| 277 | + ..topicAnswerList = topicAnswerList ?? this.topicAnswerList | ||
| 278 | + ..type = type ?? this.type | ||
| 279 | + ..word = word ?? this.word; | ||
| 280 | + } | ||
| 281 | +} | ||
| 282 | + | ||
| 283 | +CourseProcessTopicsTopicAnswerList $CourseProcessTopicsTopicAnswerListFromJson( | ||
| 284 | + Map<String, dynamic> json) { | ||
| 285 | + final CourseProcessTopicsTopicAnswerList courseProcessTopicsTopicAnswerList = CourseProcessTopicsTopicAnswerList(); | ||
| 286 | + final int? correct = jsonConvert.convert<int>(json['correct']); | ||
| 287 | + if (correct != null) { | ||
| 288 | + courseProcessTopicsTopicAnswerList.correct = correct; | ||
| 289 | + } | ||
| 290 | + final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 291 | + if (createTime != null) { | ||
| 292 | + courseProcessTopicsTopicAnswerList.createTime = createTime; | ||
| 293 | + } | ||
| 294 | + final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 295 | + if (deleted != null) { | ||
| 296 | + courseProcessTopicsTopicAnswerList.deleted = deleted; | ||
| 297 | + } | ||
| 298 | + final String? id = jsonConvert.convert<String>(json['id']); | ||
| 299 | + if (id != null) { | ||
| 300 | + courseProcessTopicsTopicAnswerList.id = id; | ||
| 301 | + } | ||
| 302 | + final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 303 | + if (modifyTime != null) { | ||
| 304 | + courseProcessTopicsTopicAnswerList.modifyTime = modifyTime; | ||
| 305 | + } | ||
| 306 | + final String? picUrl = jsonConvert.convert<String>(json['picUrl']); | ||
| 307 | + if (picUrl != null) { | ||
| 308 | + courseProcessTopicsTopicAnswerList.picUrl = picUrl; | ||
| 309 | + } | ||
| 310 | + final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 311 | + if (sortOrder != null) { | ||
| 312 | + courseProcessTopicsTopicAnswerList.sortOrder = sortOrder; | ||
| 313 | + } | ||
| 314 | + final int? topicId = jsonConvert.convert<int>(json['topicId']); | ||
| 315 | + if (topicId != null) { | ||
| 316 | + courseProcessTopicsTopicAnswerList.topicId = topicId; | ||
| 317 | + } | ||
| 318 | + final String? word = jsonConvert.convert<String>(json['word']); | ||
| 319 | + if (word != null) { | ||
| 320 | + courseProcessTopicsTopicAnswerList.word = word; | ||
| 321 | + } | ||
| 322 | + return courseProcessTopicsTopicAnswerList; | ||
| 182 | } | 323 | } |
| 183 | 324 | ||
| 184 | -CourseProcessTopicsTopicAnswerList $CourseProcessTopicsTopicAnswerListFromJson(Map<String, dynamic> json) { | ||
| 185 | - final CourseProcessTopicsTopicAnswerList courseProcessTopicsTopicAnswerList = CourseProcessTopicsTopicAnswerList(); | ||
| 186 | - final int? correct = jsonConvert.convert<int>(json['correct']); | ||
| 187 | - if (correct != null) { | ||
| 188 | - courseProcessTopicsTopicAnswerList.correct = correct; | ||
| 189 | - } | ||
| 190 | - final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 191 | - if (createTime != null) { | ||
| 192 | - courseProcessTopicsTopicAnswerList.createTime = createTime; | ||
| 193 | - } | ||
| 194 | - final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 195 | - if (deleted != null) { | ||
| 196 | - courseProcessTopicsTopicAnswerList.deleted = deleted; | ||
| 197 | - } | ||
| 198 | - final String? id = jsonConvert.convert<String>(json['id']); | ||
| 199 | - if (id != null) { | ||
| 200 | - courseProcessTopicsTopicAnswerList.id = id; | ||
| 201 | - } | ||
| 202 | - final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 203 | - if (modifyTime != null) { | ||
| 204 | - courseProcessTopicsTopicAnswerList.modifyTime = modifyTime; | ||
| 205 | - } | ||
| 206 | - final String? picUrl = jsonConvert.convert<String>(json['picUrl']); | ||
| 207 | - if (picUrl != null) { | ||
| 208 | - courseProcessTopicsTopicAnswerList.picUrl = picUrl; | ||
| 209 | - } | ||
| 210 | - final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 211 | - if (sortOrder != null) { | ||
| 212 | - courseProcessTopicsTopicAnswerList.sortOrder = sortOrder; | ||
| 213 | - } | ||
| 214 | - final int? topicId = jsonConvert.convert<int>(json['topicId']); | ||
| 215 | - if (topicId != null) { | ||
| 216 | - courseProcessTopicsTopicAnswerList.topicId = topicId; | ||
| 217 | - } | ||
| 218 | - final String? word = jsonConvert.convert<String>(json['word']); | ||
| 219 | - if (word != null) { | ||
| 220 | - courseProcessTopicsTopicAnswerList.word = word; | ||
| 221 | - } | ||
| 222 | - return courseProcessTopicsTopicAnswerList; | 325 | +Map<String, dynamic> $CourseProcessTopicsTopicAnswerListToJson( |
| 326 | + CourseProcessTopicsTopicAnswerList entity) { | ||
| 327 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 328 | + data['correct'] = entity.correct; | ||
| 329 | + data['createTime'] = entity.createTime; | ||
| 330 | + data['deleted'] = entity.deleted; | ||
| 331 | + data['id'] = entity.id; | ||
| 332 | + data['modifyTime'] = entity.modifyTime; | ||
| 333 | + data['picUrl'] = entity.picUrl; | ||
| 334 | + data['sortOrder'] = entity.sortOrder; | ||
| 335 | + data['topicId'] = entity.topicId; | ||
| 336 | + data['word'] = entity.word; | ||
| 337 | + return data; | ||
| 223 | } | 338 | } |
| 224 | 339 | ||
| 225 | -Map<String, dynamic> $CourseProcessTopicsTopicAnswerListToJson(CourseProcessTopicsTopicAnswerList entity) { | ||
| 226 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 227 | - data['correct'] = entity.correct; | ||
| 228 | - data['createTime'] = entity.createTime; | ||
| 229 | - data['deleted'] = entity.deleted; | ||
| 230 | - data['id'] = entity.id; | ||
| 231 | - data['modifyTime'] = entity.modifyTime; | ||
| 232 | - data['picUrl'] = entity.picUrl; | ||
| 233 | - data['sortOrder'] = entity.sortOrder; | ||
| 234 | - data['topicId'] = entity.topicId; | ||
| 235 | - data['word'] = entity.word; | ||
| 236 | - return data; | 340 | +extension CourseProcessTopicsTopicAnswerListExtension on CourseProcessTopicsTopicAnswerList { |
| 341 | + CourseProcessTopicsTopicAnswerList copyWith({ | ||
| 342 | + int? correct, | ||
| 343 | + String? createTime, | ||
| 344 | + String? deleted, | ||
| 345 | + String? id, | ||
| 346 | + String? modifyTime, | ||
| 347 | + String? picUrl, | ||
| 348 | + int? sortOrder, | ||
| 349 | + int? topicId, | ||
| 350 | + String? word, | ||
| 351 | + }) { | ||
| 352 | + return CourseProcessTopicsTopicAnswerList() | ||
| 353 | + ..correct = correct ?? this.correct | ||
| 354 | + ..createTime = createTime ?? this.createTime | ||
| 355 | + ..deleted = deleted ?? this.deleted | ||
| 356 | + ..id = id ?? this.id | ||
| 357 | + ..modifyTime = modifyTime ?? this.modifyTime | ||
| 358 | + ..picUrl = picUrl ?? this.picUrl | ||
| 359 | + ..sortOrder = sortOrder ?? this.sortOrder | ||
| 360 | + ..topicId = topicId ?? this.topicId | ||
| 361 | + ..word = word ?? this.word; | ||
| 362 | + } | ||
| 237 | } | 363 | } |
| 238 | 364 | ||
| 239 | CourseProcessVideos $CourseProcessVideosFromJson(Map<String, dynamic> json) { | 365 | CourseProcessVideos $CourseProcessVideosFromJson(Map<String, dynamic> json) { |
| 240 | - final CourseProcessVideos courseProcessVideos = CourseProcessVideos(); | ||
| 241 | - final int? courseLessonId = jsonConvert.convert<int>(json['courseLessonId']); | ||
| 242 | - if (courseLessonId != null) { | ||
| 243 | - courseProcessVideos.courseLessonId = courseLessonId; | ||
| 244 | - } | ||
| 245 | - final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 246 | - if (createTime != null) { | ||
| 247 | - courseProcessVideos.createTime = createTime; | ||
| 248 | - } | ||
| 249 | - final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 250 | - if (deleted != null) { | ||
| 251 | - courseProcessVideos.deleted = deleted; | ||
| 252 | - } | ||
| 253 | - final String? id = jsonConvert.convert<String>(json['id']); | ||
| 254 | - if (id != null) { | ||
| 255 | - courseProcessVideos.id = id; | ||
| 256 | - } | ||
| 257 | - final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 258 | - if (modifyTime != null) { | ||
| 259 | - courseProcessVideos.modifyTime = modifyTime; | ||
| 260 | - } | ||
| 261 | - final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 262 | - if (sortOrder != null) { | ||
| 263 | - courseProcessVideos.sortOrder = sortOrder; | ||
| 264 | - } | ||
| 265 | - final String? subtitleUrl = jsonConvert.convert<String>(json['subtitleUrl']); | ||
| 266 | - if (subtitleUrl != null) { | ||
| 267 | - courseProcessVideos.subtitleUrl = subtitleUrl; | ||
| 268 | - } | ||
| 269 | - final String? videoUrl = jsonConvert.convert<String>(json['videoUrl']); | ||
| 270 | - if (videoUrl != null) { | ||
| 271 | - courseProcessVideos.videoUrl = videoUrl; | ||
| 272 | - } | ||
| 273 | - return courseProcessVideos; | 366 | + final CourseProcessVideos courseProcessVideos = CourseProcessVideos(); |
| 367 | + final int? courseLessonId = jsonConvert.convert<int>(json['courseLessonId']); | ||
| 368 | + if (courseLessonId != null) { | ||
| 369 | + courseProcessVideos.courseLessonId = courseLessonId; | ||
| 370 | + } | ||
| 371 | + final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 372 | + if (createTime != null) { | ||
| 373 | + courseProcessVideos.createTime = createTime; | ||
| 374 | + } | ||
| 375 | + final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 376 | + if (deleted != null) { | ||
| 377 | + courseProcessVideos.deleted = deleted; | ||
| 378 | + } | ||
| 379 | + final String? id = jsonConvert.convert<String>(json['id']); | ||
| 380 | + if (id != null) { | ||
| 381 | + courseProcessVideos.id = id; | ||
| 382 | + } | ||
| 383 | + final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 384 | + if (modifyTime != null) { | ||
| 385 | + courseProcessVideos.modifyTime = modifyTime; | ||
| 386 | + } | ||
| 387 | + final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 388 | + if (sortOrder != null) { | ||
| 389 | + courseProcessVideos.sortOrder = sortOrder; | ||
| 390 | + } | ||
| 391 | + final String? subtitleUrl = jsonConvert.convert<String>(json['subtitleUrl']); | ||
| 392 | + if (subtitleUrl != null) { | ||
| 393 | + courseProcessVideos.subtitleUrl = subtitleUrl; | ||
| 394 | + } | ||
| 395 | + final String? videoUrl = jsonConvert.convert<String>(json['videoUrl']); | ||
| 396 | + if (videoUrl != null) { | ||
| 397 | + courseProcessVideos.videoUrl = videoUrl; | ||
| 398 | + } | ||
| 399 | + return courseProcessVideos; | ||
| 274 | } | 400 | } |
| 275 | 401 | ||
| 276 | Map<String, dynamic> $CourseProcessVideosToJson(CourseProcessVideos entity) { | 402 | Map<String, dynamic> $CourseProcessVideosToJson(CourseProcessVideos entity) { |
| 277 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 278 | - data['courseLessonId'] = entity.courseLessonId; | ||
| 279 | - data['createTime'] = entity.createTime; | ||
| 280 | - data['deleted'] = entity.deleted; | ||
| 281 | - data['id'] = entity.id; | ||
| 282 | - data['modifyTime'] = entity.modifyTime; | ||
| 283 | - data['sortOrder'] = entity.sortOrder; | ||
| 284 | - data['subtitleUrl'] = entity.subtitleUrl; | ||
| 285 | - data['videoUrl'] = entity.videoUrl; | ||
| 286 | - return data; | 403 | + final Map<String, dynamic> data = <String, dynamic>{}; |
| 404 | + data['courseLessonId'] = entity.courseLessonId; | ||
| 405 | + data['createTime'] = entity.createTime; | ||
| 406 | + data['deleted'] = entity.deleted; | ||
| 407 | + data['id'] = entity.id; | ||
| 408 | + data['modifyTime'] = entity.modifyTime; | ||
| 409 | + data['sortOrder'] = entity.sortOrder; | ||
| 410 | + data['subtitleUrl'] = entity.subtitleUrl; | ||
| 411 | + data['videoUrl'] = entity.videoUrl; | ||
| 412 | + return data; | ||
| 413 | +} | ||
| 414 | + | ||
| 415 | +extension CourseProcessVideosExtension on CourseProcessVideos { | ||
| 416 | + CourseProcessVideos copyWith({ | ||
| 417 | + int? courseLessonId, | ||
| 418 | + String? createTime, | ||
| 419 | + String? deleted, | ||
| 420 | + String? id, | ||
| 421 | + String? modifyTime, | ||
| 422 | + int? sortOrder, | ||
| 423 | + String? subtitleUrl, | ||
| 424 | + String? videoUrl, | ||
| 425 | + }) { | ||
| 426 | + return CourseProcessVideos() | ||
| 427 | + ..courseLessonId = courseLessonId ?? this.courseLessonId | ||
| 428 | + ..createTime = createTime ?? this.createTime | ||
| 429 | + ..deleted = deleted ?? this.deleted | ||
| 430 | + ..id = id ?? this.id | ||
| 431 | + ..modifyTime = modifyTime ?? this.modifyTime | ||
| 432 | + ..sortOrder = sortOrder ?? this.sortOrder | ||
| 433 | + ..subtitleUrl = subtitleUrl ?? this.subtitleUrl | ||
| 434 | + ..videoUrl = videoUrl ?? this.videoUrl; | ||
| 435 | + } | ||
| 287 | } | 436 | } |
| 288 | \ No newline at end of file | 437 | \ No newline at end of file |
lib/generated/json/follow_read_entity.g.dart
| @@ -2,66 +2,95 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | @@ -2,66 +2,95 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | ||
| 2 | import 'package:wow_english/models/follow_read_entity.dart'; | 2 | import 'package:wow_english/models/follow_read_entity.dart'; |
| 3 | 3 | ||
| 4 | FollowReadEntity $FollowReadEntityFromJson(Map<String, dynamic> json) { | 4 | FollowReadEntity $FollowReadEntityFromJson(Map<String, dynamic> json) { |
| 5 | - final FollowReadEntity followReadEntity = FollowReadEntity(); | ||
| 6 | - final String? coverUrl = jsonConvert.convert<String>(json['coverUrl']); | ||
| 7 | - if (coverUrl != null) { | ||
| 8 | - followReadEntity.coverUrl = coverUrl; | ||
| 9 | - } | ||
| 10 | - final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 11 | - if (createTime != null) { | ||
| 12 | - followReadEntity.createTime = createTime; | ||
| 13 | - } | ||
| 14 | - final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 15 | - if (deleted != null) { | ||
| 16 | - followReadEntity.deleted = deleted; | ||
| 17 | - } | ||
| 18 | - final String? id = jsonConvert.convert<String>(json['id']); | ||
| 19 | - if (id != null) { | ||
| 20 | - followReadEntity.id = id; | ||
| 21 | - } | ||
| 22 | - final bool? lock = jsonConvert.convert<bool>(json['lock']); | ||
| 23 | - if (lock != null) { | ||
| 24 | - followReadEntity.lock = lock; | ||
| 25 | - } | ||
| 26 | - final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 27 | - if (modifyTime != null) { | ||
| 28 | - followReadEntity.modifyTime = modifyTime; | ||
| 29 | - } | ||
| 30 | - final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 31 | - if (sortOrder != null) { | ||
| 32 | - followReadEntity.sortOrder = sortOrder; | ||
| 33 | - } | ||
| 34 | - final int? star = jsonConvert.convert<int>(json['star']); | ||
| 35 | - if (star != null) { | ||
| 36 | - followReadEntity.star = star; | ||
| 37 | - } | ||
| 38 | - final int? status = jsonConvert.convert<int>(json['status']); | ||
| 39 | - if (status != null) { | ||
| 40 | - followReadEntity.status = status; | ||
| 41 | - } | ||
| 42 | - final String? title = jsonConvert.convert<String>(json['title']); | ||
| 43 | - if (title != null) { | ||
| 44 | - followReadEntity.title = title; | ||
| 45 | - } | ||
| 46 | - final int? videoTotal = jsonConvert.convert<int>(json['videoTotal']); | ||
| 47 | - if (videoTotal != null) { | ||
| 48 | - followReadEntity.videoTotal = videoTotal; | ||
| 49 | - } | ||
| 50 | - return followReadEntity; | 5 | + final FollowReadEntity followReadEntity = FollowReadEntity(); |
| 6 | + final String? coverUrl = jsonConvert.convert<String>(json['coverUrl']); | ||
| 7 | + if (coverUrl != null) { | ||
| 8 | + followReadEntity.coverUrl = coverUrl; | ||
| 9 | + } | ||
| 10 | + final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 11 | + if (createTime != null) { | ||
| 12 | + followReadEntity.createTime = createTime; | ||
| 13 | + } | ||
| 14 | + final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 15 | + if (deleted != null) { | ||
| 16 | + followReadEntity.deleted = deleted; | ||
| 17 | + } | ||
| 18 | + final String? id = jsonConvert.convert<String>(json['id']); | ||
| 19 | + if (id != null) { | ||
| 20 | + followReadEntity.id = id; | ||
| 21 | + } | ||
| 22 | + final bool? lock = jsonConvert.convert<bool>(json['lock']); | ||
| 23 | + if (lock != null) { | ||
| 24 | + followReadEntity.lock = lock; | ||
| 25 | + } | ||
| 26 | + final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 27 | + if (modifyTime != null) { | ||
| 28 | + followReadEntity.modifyTime = modifyTime; | ||
| 29 | + } | ||
| 30 | + final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 31 | + if (sortOrder != null) { | ||
| 32 | + followReadEntity.sortOrder = sortOrder; | ||
| 33 | + } | ||
| 34 | + final int? star = jsonConvert.convert<int>(json['star']); | ||
| 35 | + if (star != null) { | ||
| 36 | + followReadEntity.star = star; | ||
| 37 | + } | ||
| 38 | + final int? status = jsonConvert.convert<int>(json['status']); | ||
| 39 | + if (status != null) { | ||
| 40 | + followReadEntity.status = status; | ||
| 41 | + } | ||
| 42 | + final String? title = jsonConvert.convert<String>(json['title']); | ||
| 43 | + if (title != null) { | ||
| 44 | + followReadEntity.title = title; | ||
| 45 | + } | ||
| 46 | + final int? videoTotal = jsonConvert.convert<int>(json['videoTotal']); | ||
| 47 | + if (videoTotal != null) { | ||
| 48 | + followReadEntity.videoTotal = videoTotal; | ||
| 49 | + } | ||
| 50 | + return followReadEntity; | ||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | Map<String, dynamic> $FollowReadEntityToJson(FollowReadEntity entity) { | 53 | Map<String, dynamic> $FollowReadEntityToJson(FollowReadEntity entity) { |
| 54 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 55 | - data['coverUrl'] = entity.coverUrl; | ||
| 56 | - data['createTime'] = entity.createTime; | ||
| 57 | - data['deleted'] = entity.deleted; | ||
| 58 | - data['id'] = entity.id; | ||
| 59 | - data['lock'] = entity.lock; | ||
| 60 | - data['modifyTime'] = entity.modifyTime; | ||
| 61 | - data['sortOrder'] = entity.sortOrder; | ||
| 62 | - data['star'] = entity.star; | ||
| 63 | - data['status'] = entity.status; | ||
| 64 | - data['title'] = entity.title; | ||
| 65 | - data['videoTotal'] = entity.videoTotal; | ||
| 66 | - return data; | 54 | + final Map<String, dynamic> data = <String, dynamic>{}; |
| 55 | + data['coverUrl'] = entity.coverUrl; | ||
| 56 | + data['createTime'] = entity.createTime; | ||
| 57 | + data['deleted'] = entity.deleted; | ||
| 58 | + data['id'] = entity.id; | ||
| 59 | + data['lock'] = entity.lock; | ||
| 60 | + data['modifyTime'] = entity.modifyTime; | ||
| 61 | + data['sortOrder'] = entity.sortOrder; | ||
| 62 | + data['star'] = entity.star; | ||
| 63 | + data['status'] = entity.status; | ||
| 64 | + data['title'] = entity.title; | ||
| 65 | + data['videoTotal'] = entity.videoTotal; | ||
| 66 | + return data; | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +extension FollowReadEntityExtension on FollowReadEntity { | ||
| 70 | + FollowReadEntity copyWith({ | ||
| 71 | + String? coverUrl, | ||
| 72 | + String? createTime, | ||
| 73 | + String? deleted, | ||
| 74 | + String? id, | ||
| 75 | + bool? lock, | ||
| 76 | + String? modifyTime, | ||
| 77 | + int? sortOrder, | ||
| 78 | + int? star, | ||
| 79 | + int? status, | ||
| 80 | + String? title, | ||
| 81 | + int? videoTotal, | ||
| 82 | + }) { | ||
| 83 | + return FollowReadEntity() | ||
| 84 | + ..coverUrl = coverUrl ?? this.coverUrl | ||
| 85 | + ..createTime = createTime ?? this.createTime | ||
| 86 | + ..deleted = deleted ?? this.deleted | ||
| 87 | + ..id = id ?? this.id | ||
| 88 | + ..lock = lock ?? this.lock | ||
| 89 | + ..modifyTime = modifyTime ?? this.modifyTime | ||
| 90 | + ..sortOrder = sortOrder ?? this.sortOrder | ||
| 91 | + ..star = star ?? this.star | ||
| 92 | + ..status = status ?? this.status | ||
| 93 | + ..title = title ?? this.title | ||
| 94 | + ..videoTotal = videoTotal ?? this.videoTotal; | ||
| 95 | + } | ||
| 67 | } | 96 | } |
| 68 | \ No newline at end of file | 97 | \ No newline at end of file |
lib/generated/json/listen_entity.g.dart
| @@ -2,66 +2,95 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | @@ -2,66 +2,95 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | ||
| 2 | import 'package:wow_english/models/listen_entity.dart'; | 2 | import 'package:wow_english/models/listen_entity.dart'; |
| 3 | 3 | ||
| 4 | ListenEntity $ListenEntityFromJson(Map<String, dynamic> json) { | 4 | ListenEntity $ListenEntityFromJson(Map<String, dynamic> json) { |
| 5 | - final ListenEntity listenEntity = ListenEntity(); | ||
| 6 | - final String? coverUrl = jsonConvert.convert<String>(json['coverUrl']); | ||
| 7 | - if (coverUrl != null) { | ||
| 8 | - listenEntity.coverUrl = coverUrl; | ||
| 9 | - } | ||
| 10 | - final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 11 | - if (createTime != null) { | ||
| 12 | - listenEntity.createTime = createTime; | ||
| 13 | - } | ||
| 14 | - final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 15 | - if (deleted != null) { | ||
| 16 | - listenEntity.deleted = deleted; | ||
| 17 | - } | ||
| 18 | - final String? id = jsonConvert.convert<String>(json['id']); | ||
| 19 | - if (id != null) { | ||
| 20 | - listenEntity.id = id; | ||
| 21 | - } | ||
| 22 | - final bool? lock = jsonConvert.convert<bool>(json['lock']); | ||
| 23 | - if (lock != null) { | ||
| 24 | - listenEntity.lock = lock; | ||
| 25 | - } | ||
| 26 | - final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 27 | - if (modifyTime != null) { | ||
| 28 | - listenEntity.modifyTime = modifyTime; | ||
| 29 | - } | ||
| 30 | - final double? sortOrder = jsonConvert.convert<double>(json['sortOrder']); | ||
| 31 | - if (sortOrder != null) { | ||
| 32 | - listenEntity.sortOrder = sortOrder; | ||
| 33 | - } | ||
| 34 | - final double? status = jsonConvert.convert<double>(json['status']); | ||
| 35 | - if (status != null) { | ||
| 36 | - listenEntity.status = status; | ||
| 37 | - } | ||
| 38 | - final String? subtitleUrl = jsonConvert.convert<String>(json['subtitleUrl']); | ||
| 39 | - if (subtitleUrl != null) { | ||
| 40 | - listenEntity.subtitleUrl = subtitleUrl; | ||
| 41 | - } | ||
| 42 | - final String? title = jsonConvert.convert<String>(json['title']); | ||
| 43 | - if (title != null) { | ||
| 44 | - listenEntity.title = title; | ||
| 45 | - } | ||
| 46 | - final String? videoUrl = jsonConvert.convert<String>(json['videoUrl']); | ||
| 47 | - if (videoUrl != null) { | ||
| 48 | - listenEntity.videoUrl = videoUrl; | ||
| 49 | - } | ||
| 50 | - return listenEntity; | 5 | + final ListenEntity listenEntity = ListenEntity(); |
| 6 | + final String? coverUrl = jsonConvert.convert<String>(json['coverUrl']); | ||
| 7 | + if (coverUrl != null) { | ||
| 8 | + listenEntity.coverUrl = coverUrl; | ||
| 9 | + } | ||
| 10 | + final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 11 | + if (createTime != null) { | ||
| 12 | + listenEntity.createTime = createTime; | ||
| 13 | + } | ||
| 14 | + final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 15 | + if (deleted != null) { | ||
| 16 | + listenEntity.deleted = deleted; | ||
| 17 | + } | ||
| 18 | + final String? id = jsonConvert.convert<String>(json['id']); | ||
| 19 | + if (id != null) { | ||
| 20 | + listenEntity.id = id; | ||
| 21 | + } | ||
| 22 | + final bool? lock = jsonConvert.convert<bool>(json['lock']); | ||
| 23 | + if (lock != null) { | ||
| 24 | + listenEntity.lock = lock; | ||
| 25 | + } | ||
| 26 | + final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 27 | + if (modifyTime != null) { | ||
| 28 | + listenEntity.modifyTime = modifyTime; | ||
| 29 | + } | ||
| 30 | + final double? sortOrder = jsonConvert.convert<double>(json['sortOrder']); | ||
| 31 | + if (sortOrder != null) { | ||
| 32 | + listenEntity.sortOrder = sortOrder; | ||
| 33 | + } | ||
| 34 | + final double? status = jsonConvert.convert<double>(json['status']); | ||
| 35 | + if (status != null) { | ||
| 36 | + listenEntity.status = status; | ||
| 37 | + } | ||
| 38 | + final String? subtitleUrl = jsonConvert.convert<String>(json['subtitleUrl']); | ||
| 39 | + if (subtitleUrl != null) { | ||
| 40 | + listenEntity.subtitleUrl = subtitleUrl; | ||
| 41 | + } | ||
| 42 | + final String? title = jsonConvert.convert<String>(json['title']); | ||
| 43 | + if (title != null) { | ||
| 44 | + listenEntity.title = title; | ||
| 45 | + } | ||
| 46 | + final String? videoUrl = jsonConvert.convert<String>(json['videoUrl']); | ||
| 47 | + if (videoUrl != null) { | ||
| 48 | + listenEntity.videoUrl = videoUrl; | ||
| 49 | + } | ||
| 50 | + return listenEntity; | ||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | Map<String, dynamic> $ListenEntityToJson(ListenEntity entity) { | 53 | Map<String, dynamic> $ListenEntityToJson(ListenEntity entity) { |
| 54 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 55 | - data['coverUrl'] = entity.coverUrl; | ||
| 56 | - data['createTime'] = entity.createTime; | ||
| 57 | - data['deleted'] = entity.deleted; | ||
| 58 | - data['id'] = entity.id; | ||
| 59 | - data['lock'] = entity.lock; | ||
| 60 | - data['modifyTime'] = entity.modifyTime; | ||
| 61 | - data['sortOrder'] = entity.sortOrder; | ||
| 62 | - data['status'] = entity.status; | ||
| 63 | - data['subtitleUrl'] = entity.subtitleUrl; | ||
| 64 | - data['title'] = entity.title; | ||
| 65 | - data['videoUrl'] = entity.videoUrl; | ||
| 66 | - return data; | 54 | + final Map<String, dynamic> data = <String, dynamic>{}; |
| 55 | + data['coverUrl'] = entity.coverUrl; | ||
| 56 | + data['createTime'] = entity.createTime; | ||
| 57 | + data['deleted'] = entity.deleted; | ||
| 58 | + data['id'] = entity.id; | ||
| 59 | + data['lock'] = entity.lock; | ||
| 60 | + data['modifyTime'] = entity.modifyTime; | ||
| 61 | + data['sortOrder'] = entity.sortOrder; | ||
| 62 | + data['status'] = entity.status; | ||
| 63 | + data['subtitleUrl'] = entity.subtitleUrl; | ||
| 64 | + data['title'] = entity.title; | ||
| 65 | + data['videoUrl'] = entity.videoUrl; | ||
| 66 | + return data; | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +extension ListenEntityExtension on ListenEntity { | ||
| 70 | + ListenEntity copyWith({ | ||
| 71 | + String? coverUrl, | ||
| 72 | + String? createTime, | ||
| 73 | + String? deleted, | ||
| 74 | + String? id, | ||
| 75 | + bool? lock, | ||
| 76 | + String? modifyTime, | ||
| 77 | + double? sortOrder, | ||
| 78 | + double? status, | ||
| 79 | + String? subtitleUrl, | ||
| 80 | + String? title, | ||
| 81 | + String? videoUrl, | ||
| 82 | + }) { | ||
| 83 | + return ListenEntity() | ||
| 84 | + ..coverUrl = coverUrl ?? this.coverUrl | ||
| 85 | + ..createTime = createTime ?? this.createTime | ||
| 86 | + ..deleted = deleted ?? this.deleted | ||
| 87 | + ..id = id ?? this.id | ||
| 88 | + ..lock = lock ?? this.lock | ||
| 89 | + ..modifyTime = modifyTime ?? this.modifyTime | ||
| 90 | + ..sortOrder = sortOrder ?? this.sortOrder | ||
| 91 | + ..status = status ?? this.status | ||
| 92 | + ..subtitleUrl = subtitleUrl ?? this.subtitleUrl | ||
| 93 | + ..title = title ?? this.title | ||
| 94 | + ..videoUrl = videoUrl ?? this.videoUrl; | ||
| 95 | + } | ||
| 67 | } | 96 | } |
| 68 | \ No newline at end of file | 97 | \ No newline at end of file |
lib/generated/json/product_entity.g.dart
0 → 100644
| 1 | +import 'package:wow_english/generated/json/base/json_convert_content.dart'; | ||
| 2 | +import 'package:wow_english/models/product_entity.dart'; | ||
| 3 | + | ||
| 4 | +ProductEntity $ProductEntityFromJson(Map<String, dynamic> json) { | ||
| 5 | + final ProductEntity productEntity = ProductEntity(); | ||
| 6 | + final String? name = jsonConvert.convert<String>(json['name']); | ||
| 7 | + if (name != null) { | ||
| 8 | + productEntity.name = name; | ||
| 9 | + } | ||
| 10 | + final double? price = jsonConvert.convert<double>(json['price']); | ||
| 11 | + if (price != null) { | ||
| 12 | + productEntity.price = price; | ||
| 13 | + } | ||
| 14 | + return productEntity; | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +Map<String, dynamic> $ProductEntityToJson(ProductEntity entity) { | ||
| 18 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 19 | + data['name'] = entity.name; | ||
| 20 | + data['price'] = entity.price; | ||
| 21 | + return data; | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +extension ProductEntityExtension on ProductEntity { | ||
| 25 | + ProductEntity copyWith({ | ||
| 26 | + String? name, | ||
| 27 | + double? price, | ||
| 28 | + }) { | ||
| 29 | + return ProductEntity() | ||
| 30 | + ..name = name ?? this.name | ||
| 31 | + ..price = price ?? this.price; | ||
| 32 | + } | ||
| 33 | +} | ||
| 0 | \ No newline at end of file | 34 | \ No newline at end of file |
lib/generated/json/read_content_entity.g.dart
| @@ -2,56 +2,82 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | @@ -2,56 +2,82 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | ||
| 2 | import 'package:wow_english/models/read_content_entity.dart'; | 2 | import 'package:wow_english/models/read_content_entity.dart'; |
| 3 | 3 | ||
| 4 | ReadContentEntity $ReadContentEntityFromJson(Map<String, dynamic> json) { | 4 | ReadContentEntity $ReadContentEntityFromJson(Map<String, dynamic> json) { |
| 5 | - final ReadContentEntity readContentEntity = ReadContentEntity(); | ||
| 6 | - final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 7 | - if (createTime != null) { | ||
| 8 | - readContentEntity.createTime = createTime; | ||
| 9 | - } | ||
| 10 | - final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 11 | - if (deleted != null) { | ||
| 12 | - readContentEntity.deleted = deleted; | ||
| 13 | - } | ||
| 14 | - final String? id = jsonConvert.convert<String>(json['id']); | ||
| 15 | - if (id != null) { | ||
| 16 | - readContentEntity.id = id; | ||
| 17 | - } | ||
| 18 | - final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 19 | - if (modifyTime != null) { | ||
| 20 | - readContentEntity.modifyTime = modifyTime; | ||
| 21 | - } | ||
| 22 | - final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 23 | - if (sortOrder != null) { | ||
| 24 | - readContentEntity.sortOrder = sortOrder; | ||
| 25 | - } | ||
| 26 | - final int? status = jsonConvert.convert<int>(json['status']); | ||
| 27 | - if (status != null) { | ||
| 28 | - readContentEntity.status = status; | ||
| 29 | - } | ||
| 30 | - final int? videoFollowReadId = jsonConvert.convert<int>(json['videoFollowReadId']); | ||
| 31 | - if (videoFollowReadId != null) { | ||
| 32 | - readContentEntity.videoFollowReadId = videoFollowReadId; | ||
| 33 | - } | ||
| 34 | - final String? videoUrl = jsonConvert.convert<String>(json['videoUrl']); | ||
| 35 | - if (videoUrl != null) { | ||
| 36 | - readContentEntity.videoUrl = videoUrl; | ||
| 37 | - } | ||
| 38 | - final String? word = jsonConvert.convert<String>(json['word']); | ||
| 39 | - if (word != null) { | ||
| 40 | - readContentEntity.word = word; | ||
| 41 | - } | ||
| 42 | - return readContentEntity; | 5 | + final ReadContentEntity readContentEntity = ReadContentEntity(); |
| 6 | + final String? createTime = jsonConvert.convert<String>(json['createTime']); | ||
| 7 | + if (createTime != null) { | ||
| 8 | + readContentEntity.createTime = createTime; | ||
| 9 | + } | ||
| 10 | + final String? deleted = jsonConvert.convert<String>(json['deleted']); | ||
| 11 | + if (deleted != null) { | ||
| 12 | + readContentEntity.deleted = deleted; | ||
| 13 | + } | ||
| 14 | + final String? id = jsonConvert.convert<String>(json['id']); | ||
| 15 | + if (id != null) { | ||
| 16 | + readContentEntity.id = id; | ||
| 17 | + } | ||
| 18 | + final String? modifyTime = jsonConvert.convert<String>(json['modifyTime']); | ||
| 19 | + if (modifyTime != null) { | ||
| 20 | + readContentEntity.modifyTime = modifyTime; | ||
| 21 | + } | ||
| 22 | + final int? sortOrder = jsonConvert.convert<int>(json['sortOrder']); | ||
| 23 | + if (sortOrder != null) { | ||
| 24 | + readContentEntity.sortOrder = sortOrder; | ||
| 25 | + } | ||
| 26 | + final int? status = jsonConvert.convert<int>(json['status']); | ||
| 27 | + if (status != null) { | ||
| 28 | + readContentEntity.status = status; | ||
| 29 | + } | ||
| 30 | + final int? videoFollowReadId = jsonConvert.convert<int>( | ||
| 31 | + json['videoFollowReadId']); | ||
| 32 | + if (videoFollowReadId != null) { | ||
| 33 | + readContentEntity.videoFollowReadId = videoFollowReadId; | ||
| 34 | + } | ||
| 35 | + final String? videoUrl = jsonConvert.convert<String>(json['videoUrl']); | ||
| 36 | + if (videoUrl != null) { | ||
| 37 | + readContentEntity.videoUrl = videoUrl; | ||
| 38 | + } | ||
| 39 | + final String? word = jsonConvert.convert<String>(json['word']); | ||
| 40 | + if (word != null) { | ||
| 41 | + readContentEntity.word = word; | ||
| 42 | + } | ||
| 43 | + return readContentEntity; | ||
| 43 | } | 44 | } |
| 44 | 45 | ||
| 45 | Map<String, dynamic> $ReadContentEntityToJson(ReadContentEntity entity) { | 46 | Map<String, dynamic> $ReadContentEntityToJson(ReadContentEntity entity) { |
| 46 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 47 | - data['createTime'] = entity.createTime; | ||
| 48 | - data['deleted'] = entity.deleted; | ||
| 49 | - data['id'] = entity.id; | ||
| 50 | - data['modifyTime'] = entity.modifyTime; | ||
| 51 | - data['sortOrder'] = entity.sortOrder; | ||
| 52 | - data['status'] = entity.status; | ||
| 53 | - data['videoFollowReadId'] = entity.videoFollowReadId; | ||
| 54 | - data['videoUrl'] = entity.videoUrl; | ||
| 55 | - data['word'] = entity.word; | ||
| 56 | - return data; | 47 | + final Map<String, dynamic> data = <String, dynamic>{}; |
| 48 | + data['createTime'] = entity.createTime; | ||
| 49 | + data['deleted'] = entity.deleted; | ||
| 50 | + data['id'] = entity.id; | ||
| 51 | + data['modifyTime'] = entity.modifyTime; | ||
| 52 | + data['sortOrder'] = entity.sortOrder; | ||
| 53 | + data['status'] = entity.status; | ||
| 54 | + data['videoFollowReadId'] = entity.videoFollowReadId; | ||
| 55 | + data['videoUrl'] = entity.videoUrl; | ||
| 56 | + data['word'] = entity.word; | ||
| 57 | + return data; | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +extension ReadContentEntityExtension on ReadContentEntity { | ||
| 61 | + ReadContentEntity copyWith({ | ||
| 62 | + String? createTime, | ||
| 63 | + String? deleted, | ||
| 64 | + String? id, | ||
| 65 | + String? modifyTime, | ||
| 66 | + int? sortOrder, | ||
| 67 | + int? status, | ||
| 68 | + int? videoFollowReadId, | ||
| 69 | + String? videoUrl, | ||
| 70 | + String? word, | ||
| 71 | + }) { | ||
| 72 | + return ReadContentEntity() | ||
| 73 | + ..createTime = createTime ?? this.createTime | ||
| 74 | + ..deleted = deleted ?? this.deleted | ||
| 75 | + ..id = id ?? this.id | ||
| 76 | + ..modifyTime = modifyTime ?? this.modifyTime | ||
| 77 | + ..sortOrder = sortOrder ?? this.sortOrder | ||
| 78 | + ..status = status ?? this.status | ||
| 79 | + ..videoFollowReadId = videoFollowReadId ?? this.videoFollowReadId | ||
| 80 | + ..videoUrl = videoUrl ?? this.videoUrl | ||
| 81 | + ..word = word ?? this.word; | ||
| 82 | + } | ||
| 57 | } | 83 | } |
| 58 | \ No newline at end of file | 84 | \ No newline at end of file |
lib/generated/json/user_entity.g.dart
| @@ -2,61 +2,90 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | @@ -2,61 +2,90 @@ import 'package:wow_english/generated/json/base/json_convert_content.dart'; | ||
| 2 | import 'package:wow_english/models/user_entity.dart'; | 2 | import 'package:wow_english/models/user_entity.dart'; |
| 3 | 3 | ||
| 4 | UserEntity $UserEntityFromJson(Map<String, dynamic> json) { | 4 | UserEntity $UserEntityFromJson(Map<String, dynamic> json) { |
| 5 | - final UserEntity userEntity = UserEntity(); | ||
| 6 | - final int? id = jsonConvert.convert<int>(json['id']); | ||
| 7 | - if (id != null) { | ||
| 8 | - userEntity.id = id; | ||
| 9 | - } | ||
| 10 | - final String? name = jsonConvert.convert<String>(json['name']); | ||
| 11 | - if (name != null) { | ||
| 12 | - userEntity.name = name; | ||
| 13 | - } | ||
| 14 | - final String? token = jsonConvert.convert<String>(json['token']); | ||
| 15 | - if (token != null) { | ||
| 16 | - userEntity.token = token; | ||
| 17 | - } | ||
| 18 | - final int? age = jsonConvert.convert<int>(json['age']); | ||
| 19 | - if (age != null) { | ||
| 20 | - userEntity.age = age; | ||
| 21 | - } | ||
| 22 | - final int? gender = jsonConvert.convert<int>(json['gender']); | ||
| 23 | - if (gender != null) { | ||
| 24 | - userEntity.gender = gender; | ||
| 25 | - } | ||
| 26 | - final String? avatarUrl = jsonConvert.convert<String>(json['avatarUrl']); | ||
| 27 | - if (avatarUrl != null) { | ||
| 28 | - userEntity.avatarUrl = avatarUrl; | ||
| 29 | - } | ||
| 30 | - final String? phoneNum = jsonConvert.convert<String>(json['phoneNum']); | ||
| 31 | - if (phoneNum != null) { | ||
| 32 | - userEntity.phoneNum = phoneNum; | ||
| 33 | - } | ||
| 34 | - final int? fillUserInfo = jsonConvert.convert<int>(json['fillUserInfo']); | ||
| 35 | - if (fillUserInfo != null) { | ||
| 36 | - userEntity.fillUserInfo = fillUserInfo; | ||
| 37 | - } | ||
| 38 | - final int? nowCourseModuleId = jsonConvert.convert<int>(json['nowCourseModuleId']); | ||
| 39 | - if (nowCourseModuleId != null) { | ||
| 40 | - userEntity.nowCourseModuleId = nowCourseModuleId; | ||
| 41 | - } | ||
| 42 | - final String? effectiveDate = jsonConvert.convert<String>(json['effectiveDate']); | ||
| 43 | - if (effectiveDate != null) { | ||
| 44 | - userEntity.effectiveDate = effectiveDate; | ||
| 45 | - } | ||
| 46 | - return userEntity; | 5 | + final UserEntity userEntity = UserEntity(); |
| 6 | + final int? id = jsonConvert.convert<int>(json['id']); | ||
| 7 | + if (id != null) { | ||
| 8 | + userEntity.id = id; | ||
| 9 | + } | ||
| 10 | + final String? name = jsonConvert.convert<String>(json['name']); | ||
| 11 | + if (name != null) { | ||
| 12 | + userEntity.name = name; | ||
| 13 | + } | ||
| 14 | + final String? token = jsonConvert.convert<String>(json['token']); | ||
| 15 | + if (token != null) { | ||
| 16 | + userEntity.token = token; | ||
| 17 | + } | ||
| 18 | + final int? age = jsonConvert.convert<int>(json['age']); | ||
| 19 | + if (age != null) { | ||
| 20 | + userEntity.age = age; | ||
| 21 | + } | ||
| 22 | + final int? gender = jsonConvert.convert<int>(json['gender']); | ||
| 23 | + if (gender != null) { | ||
| 24 | + userEntity.gender = gender; | ||
| 25 | + } | ||
| 26 | + final String? avatarUrl = jsonConvert.convert<String>(json['avatarUrl']); | ||
| 27 | + if (avatarUrl != null) { | ||
| 28 | + userEntity.avatarUrl = avatarUrl; | ||
| 29 | + } | ||
| 30 | + final String? phoneNum = jsonConvert.convert<String>(json['phoneNum']); | ||
| 31 | + if (phoneNum != null) { | ||
| 32 | + userEntity.phoneNum = phoneNum; | ||
| 33 | + } | ||
| 34 | + final int? fillUserInfo = jsonConvert.convert<int>(json['fillUserInfo']); | ||
| 35 | + if (fillUserInfo != null) { | ||
| 36 | + userEntity.fillUserInfo = fillUserInfo; | ||
| 37 | + } | ||
| 38 | + final int? nowCourseModuleId = jsonConvert.convert<int>( | ||
| 39 | + json['nowCourseModuleId']); | ||
| 40 | + if (nowCourseModuleId != null) { | ||
| 41 | + userEntity.nowCourseModuleId = nowCourseModuleId; | ||
| 42 | + } | ||
| 43 | + final String? effectiveDate = jsonConvert.convert<String>( | ||
| 44 | + json['effectiveDate']); | ||
| 45 | + if (effectiveDate != null) { | ||
| 46 | + userEntity.effectiveDate = effectiveDate; | ||
| 47 | + } | ||
| 48 | + return userEntity; | ||
| 47 | } | 49 | } |
| 48 | 50 | ||
| 49 | Map<String, dynamic> $UserEntityToJson(UserEntity entity) { | 51 | Map<String, dynamic> $UserEntityToJson(UserEntity entity) { |
| 50 | - final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 51 | - data['id'] = entity.id; | ||
| 52 | - data['name'] = entity.name; | ||
| 53 | - data['token'] = entity.token; | ||
| 54 | - data['age'] = entity.age; | ||
| 55 | - data['gender'] = entity.gender; | ||
| 56 | - data['avatarUrl'] = entity.avatarUrl; | ||
| 57 | - data['phoneNum'] = entity.phoneNum; | ||
| 58 | - data['fillUserInfo'] = entity.fillUserInfo; | ||
| 59 | - data['nowCourseModuleId'] = entity.nowCourseModuleId; | ||
| 60 | - data['effectiveDate'] = entity.effectiveDate; | ||
| 61 | - return data; | 52 | + final Map<String, dynamic> data = <String, dynamic>{}; |
| 53 | + data['id'] = entity.id; | ||
| 54 | + data['name'] = entity.name; | ||
| 55 | + data['token'] = entity.token; | ||
| 56 | + data['age'] = entity.age; | ||
| 57 | + data['gender'] = entity.gender; | ||
| 58 | + data['avatarUrl'] = entity.avatarUrl; | ||
| 59 | + data['phoneNum'] = entity.phoneNum; | ||
| 60 | + data['fillUserInfo'] = entity.fillUserInfo; | ||
| 61 | + data['nowCourseModuleId'] = entity.nowCourseModuleId; | ||
| 62 | + data['effectiveDate'] = entity.effectiveDate; | ||
| 63 | + return data; | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | +extension UserEntityExtension on UserEntity { | ||
| 67 | + UserEntity copyWith({ | ||
| 68 | + int? id, | ||
| 69 | + String? name, | ||
| 70 | + String? token, | ||
| 71 | + int? age, | ||
| 72 | + int? gender, | ||
| 73 | + String? avatarUrl, | ||
| 74 | + String? phoneNum, | ||
| 75 | + int? fillUserInfo, | ||
| 76 | + int? nowCourseModuleId, | ||
| 77 | + String? effectiveDate, | ||
| 78 | + }) { | ||
| 79 | + return UserEntity() | ||
| 80 | + ..id = id ?? this.id | ||
| 81 | + ..name = name ?? this.name | ||
| 82 | + ..token = token ?? this.token | ||
| 83 | + ..age = age ?? this.age | ||
| 84 | + ..gender = gender ?? this.gender | ||
| 85 | + ..avatarUrl = avatarUrl ?? this.avatarUrl | ||
| 86 | + ..phoneNum = phoneNum ?? this.phoneNum | ||
| 87 | + ..fillUserInfo = fillUserInfo ?? this.fillUserInfo | ||
| 88 | + ..nowCourseModuleId = nowCourseModuleId ?? this.nowCourseModuleId | ||
| 89 | + ..effectiveDate = effectiveDate ?? this.effectiveDate; | ||
| 90 | + } | ||
| 62 | } | 91 | } |
| 63 | \ No newline at end of file | 92 | \ No newline at end of file |
lib/models/product_entity.dart
0 → 100644
| 1 | +import 'package:wow_english/generated/json/base/json_field.dart'; | ||
| 2 | +import 'package:wow_english/generated/json/product_entity.g.dart'; | ||
| 3 | +import 'dart:convert'; | ||
| 4 | +export 'package:wow_english/generated/json/product_entity.g.dart'; | ||
| 5 | + | ||
| 6 | +@JsonSerializable() | ||
| 7 | +class ProductEntity { | ||
| 8 | + late String name; | ||
| 9 | + late double price; | ||
| 10 | + late String url; | ||
| 11 | + | ||
| 12 | + ProductEntity(); | ||
| 13 | + | ||
| 14 | + factory ProductEntity.fromJson(Map<String, dynamic> json) => $ProductEntityFromJson(json); | ||
| 15 | + | ||
| 16 | + Map<String, dynamic> toJson() => $ProductEntityToJson(this); | ||
| 17 | + | ||
| 18 | + @override | ||
| 19 | + String toString() { | ||
| 20 | + return jsonEncode(this); | ||
| 21 | + } | ||
| 22 | +} | ||
| 0 | \ No newline at end of file | 23 | \ No newline at end of file |
lib/pages/shop/home/shop_home_page.dart
| @@ -72,6 +72,7 @@ class _ShopHomeView extends StatelessWidget { | @@ -72,6 +72,7 @@ class _ShopHomeView extends StatelessWidget { | ||
| 72 | itemBuilder: (BuildContext context, int index) { | 72 | itemBuilder: (BuildContext context, int index) { |
| 73 | return LessonCardItem(onTap: () { | 73 | return LessonCardItem(onTap: () { |
| 74 | showToast('购买'); | 74 | showToast('购买'); |
| 75 | + pushNamed(AppRouteName.pay); | ||
| 75 | }); | 76 | }); |
| 76 | }), | 77 | }), |
| 77 | ), | 78 | ), |
lib/pages/shopping/bloc.dart
0 → 100644
| 1 | +import 'package:bloc/bloc.dart'; | ||
| 2 | +import 'package:wow_english/models/product_entity.dart'; | ||
| 3 | + | ||
| 4 | +import '../../utils/log_util.dart'; | ||
| 5 | +import 'event.dart'; | ||
| 6 | +import 'state.dart'; | ||
| 7 | + | ||
| 8 | +class ShoppingBloc extends Bloc<ShoppingEvent, ShoppingState> { | ||
| 9 | + | ||
| 10 | + ProductEntity? _productData; | ||
| 11 | + | ||
| 12 | + ProductEntity? get productData => _productData; | ||
| 13 | + | ||
| 14 | + PaymentChannel _curPaymentChannel = PaymentChannel.wechatPay; | ||
| 15 | + | ||
| 16 | + PaymentChannel get curPaymentChannel => _curPaymentChannel; | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + ShoppingBloc() : super(ShoppingState().init()) { | ||
| 20 | + //页面初始化时刻 | ||
| 21 | + on<InitEvent>(_init); | ||
| 22 | + on<ChangePaymentChannelEvent>(_changePaymentChannel); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + void _init(InitEvent event, Emitter<ShoppingState> emit) async { | ||
| 26 | + //处理一些初始化操作,然后刷新界面 | ||
| 27 | + emit(state.clone()); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + /// 更换支付渠道 | ||
| 31 | + void _changePaymentChannel(ChangePaymentChannelEvent event, | ||
| 32 | + Emitter<ShoppingState> emitter) async { | ||
| 33 | + Log.d("_curPaymentChannel=$_curPaymentChannel, event.paymentChannel=${event.paymentChannel}"); | ||
| 34 | + if (_curPaymentChannel != event.paymentChannel) { | ||
| 35 | + _curPaymentChannel = event.paymentChannel; | ||
| 36 | + emitter(PaymentChannelChangeState()); | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + void _gotoPay() { | ||
| 41 | + // 跳转到支付页面 | ||
| 42 | + } | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +enum PaymentChannel { | ||
| 46 | + | ||
| 47 | + wechatPay(1, "微信支付"), | ||
| 48 | + | ||
| 49 | + aliPay(2, "支付宝支付"); | ||
| 50 | + | ||
| 51 | + const PaymentChannel(this.payChannelType, this.payChannelName); | ||
| 52 | + | ||
| 53 | + final int payChannelType; | ||
| 54 | + | ||
| 55 | + final String payChannelName; | ||
| 56 | +} |
lib/pages/shopping/event.dart
0 → 100644
| 1 | +import 'bloc.dart'; | ||
| 2 | + | ||
| 3 | +abstract class ShoppingEvent {} | ||
| 4 | + | ||
| 5 | +class InitEvent extends ShoppingEvent {} | ||
| 6 | + | ||
| 7 | +class ChangePaymentChannelEvent extends ShoppingEvent { | ||
| 8 | + final PaymentChannel paymentChannel; | ||
| 9 | + | ||
| 10 | + ChangePaymentChannelEvent(this.paymentChannel); | ||
| 11 | +} | ||
| 0 | \ No newline at end of file | 12 | \ No newline at end of file |
lib/pages/shopping/state.dart
0 → 100644
lib/pages/shopping/view.dart
0 → 100644
| 1 | +import 'package:cached_network_image/cached_network_image.dart'; | ||
| 2 | +import 'package:flutter/material.dart'; | ||
| 3 | +import 'package:flutter_bloc/flutter_bloc.dart'; | ||
| 4 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 5 | +import 'package:wow_english/common/extension/string_extension.dart'; | ||
| 6 | + | ||
| 7 | +import '../../common/core/assets_const.dart'; | ||
| 8 | +import '../../common/widgets/we_app_bar.dart'; | ||
| 9 | +import '../../utils/image_util.dart'; | ||
| 10 | +import 'bloc.dart'; | ||
| 11 | +import 'event.dart'; | ||
| 12 | +import 'state.dart'; | ||
| 13 | + | ||
| 14 | +Widget buildRadioOption({ | ||
| 15 | + required int value, | ||
| 16 | + required ImageProvider icon, | ||
| 17 | + required String text, | ||
| 18 | + required int groupValue, | ||
| 19 | + required ValueChanged onChanged, | ||
| 20 | +}) { | ||
| 21 | + return Row( | ||
| 22 | + children: [ | ||
| 23 | + Image(image: icon, | ||
| 24 | + width: 20.0.w, | ||
| 25 | + height: 20.0.h, | ||
| 26 | + fit: BoxFit.contain), | ||
| 27 | + const SizedBox(width: 10.0), | ||
| 28 | + // Expanded( | ||
| 29 | + // child: Text( | ||
| 30 | + // text, | ||
| 31 | + // style: TextStyle(color: Color(0xFF333333), fontSize: 12.5.sp), | ||
| 32 | + // ), | ||
| 33 | + // ), | ||
| 34 | + Text( | ||
| 35 | + text, | ||
| 36 | + style: TextStyle(color: Color(0xFF333333), fontSize: 12.5.sp), | ||
| 37 | + ), | ||
| 38 | + Radio( | ||
| 39 | + value: value, | ||
| 40 | + groupValue: groupValue, | ||
| 41 | + onChanged: onChanged | ||
| 42 | + ), | ||
| 43 | + ], | ||
| 44 | + ); | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +class ShoppingPage extends StatelessWidget { | ||
| 48 | + const ShoppingPage({super.key}); | ||
| 49 | + | ||
| 50 | + @override | ||
| 51 | + Widget build(BuildContext context) { | ||
| 52 | + return BlocProvider( | ||
| 53 | + create: (BuildContext context) => | ||
| 54 | + ShoppingBloc() | ||
| 55 | + ..add(InitEvent()), | ||
| 56 | + child: _ShoppingView(), | ||
| 57 | + ); | ||
| 58 | + } | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +class _ShoppingView extends StatelessWidget { | ||
| 62 | + | ||
| 63 | + @override | ||
| 64 | + Widget build(BuildContext context) { | ||
| 65 | + final bloc = BlocProvider.of<ShoppingBloc>(context); | ||
| 66 | + return BlocListener<ShoppingBloc, ShoppingState>( | ||
| 67 | + listener: (context, state) { | ||
| 68 | + }, | ||
| 69 | + child: Scaffold( | ||
| 70 | + appBar: const WEAppBar( | ||
| 71 | + //标题传进来的 | ||
| 72 | + titleText: '支付', | ||
| 73 | + ), | ||
| 74 | + body: Container( | ||
| 75 | + margin: const EdgeInsets.only(left: 80.0, top: 28.0, right: 56.0), | ||
| 76 | + child: Row( | ||
| 77 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 78 | + children: [ | ||
| 79 | + CachedNetworkImage( | ||
| 80 | + imageUrl: "${bloc.productData?.url}", | ||
| 81 | + imageBuilder: (context, imageProvider) => | ||
| 82 | + Container( | ||
| 83 | + decoration: BoxDecoration( | ||
| 84 | + image: DecorationImage( | ||
| 85 | + image: imageProvider, | ||
| 86 | + fit: BoxFit.cover, | ||
| 87 | + ), | ||
| 88 | + borderRadius: BorderRadius.circular(5.0), | ||
| 89 | + ), | ||
| 90 | + ), | ||
| 91 | + placeholder: (context, url) => | ||
| 92 | + const CircularProgressIndicator(), | ||
| 93 | + // errorWidget: (context, url, error) => const Icon(Icons.error), | ||
| 94 | + height: 210.0.h, | ||
| 95 | + width: 210.0.w, | ||
| 96 | + ), | ||
| 97 | + const SizedBox(width: 35.5), | ||
| 98 | + _paymentWidget(), | ||
| 99 | + ], | ||
| 100 | + ), | ||
| 101 | + ), | ||
| 102 | + ),); | ||
| 103 | + } | ||
| 104 | +} | ||
| 105 | + | ||
| 106 | +Widget _paymentWidget() => | ||
| 107 | + BlocBuilder<ShoppingBloc, ShoppingState> | ||
| 108 | + ( | ||
| 109 | + builder: (context, state) { | ||
| 110 | + final bloc = BlocProvider.of<ShoppingBloc>(context); | ||
| 111 | + return Column( | ||
| 112 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 113 | + children: [ | ||
| 114 | + Text('套餐价格:${bloc.productData?.price ?? "199(记得删除)"}', | ||
| 115 | + style: TextStyle( | ||
| 116 | + color: const Color(0xFF333333), fontSize: 16.sp)), | ||
| 117 | + const SizedBox(height: 15.0), | ||
| 118 | + Text('套餐名称:${bloc.productData?.name ?? ''}', | ||
| 119 | + style: TextStyle( | ||
| 120 | + color: const Color(0xFF333333), fontSize: 16.sp)), | ||
| 121 | + const SizedBox(height: 15.0), | ||
| 122 | + Container( | ||
| 123 | + padding: | ||
| 124 | + EdgeInsets.symmetric(horizontal: 6.w, vertical: 10.h), | ||
| 125 | + decoration: BoxDecoration( | ||
| 126 | + image: DecorationImage( | ||
| 127 | + image: ImageUtil.getImageProviderOnDefault( | ||
| 128 | + AssetsConst.bgUserInformationText), | ||
| 129 | + fit: BoxFit.fill)), | ||
| 130 | + child: const Text('支付方式选择', | ||
| 131 | + style: TextStyle( | ||
| 132 | + color: Color(0xFF333333), | ||
| 133 | + fontSize: 12, | ||
| 134 | + fontFamily: 'PingFangSC-Regular')), | ||
| 135 | + ), | ||
| 136 | + const SizedBox(height: 15.0), | ||
| 137 | + buildRadioOption( | ||
| 138 | + value: PaymentChannel.wechatPay.payChannelType, | ||
| 139 | + icon: AssetImage('weixin'.assetPng), | ||
| 140 | + text: PaymentChannel.wechatPay.payChannelName, | ||
| 141 | + groupValue: bloc.curPaymentChannel.payChannelType, | ||
| 142 | + onChanged: (newValue) { | ||
| 143 | + bloc.add( | ||
| 144 | + ChangePaymentChannelEvent(PaymentChannel.wechatPay)); | ||
| 145 | + }, | ||
| 146 | + ), | ||
| 147 | + buildRadioOption( | ||
| 148 | + value: PaymentChannel.aliPay.payChannelType, | ||
| 149 | + icon: AssetImage('zhifubao'.assetPng), | ||
| 150 | + text: PaymentChannel.aliPay.payChannelName, | ||
| 151 | + groupValue: bloc.curPaymentChannel.payChannelType, | ||
| 152 | + onChanged: (newValue) { | ||
| 153 | + bloc.add( | ||
| 154 | + ChangePaymentChannelEvent(PaymentChannel.aliPay)); | ||
| 155 | + }, | ||
| 156 | + ), | ||
| 157 | + const SizedBox(height: 15.0), | ||
| 158 | + // 确认支付按钮 | ||
| 159 | + InkWell( | ||
| 160 | + onTap: () { | ||
| 161 | + }, | ||
| 162 | + child: Image( | ||
| 163 | + width: 125.w, | ||
| 164 | + height: 45.h, | ||
| 165 | + image: AssetImage('btn_pay'.assetPng), | ||
| 166 | + ), | ||
| 167 | + ), | ||
| 168 | + ], | ||
| 169 | + ); | ||
| 170 | + }, | ||
| 171 | + ); |
lib/route/route.dart
| @@ -23,6 +23,7 @@ import 'package:wow_english/pages/user/user_page.dart'; | @@ -23,6 +23,7 @@ import 'package:wow_english/pages/user/user_page.dart'; | ||
| 23 | import 'package:wow_english/pages/video/lookvideo/look_video_page.dart'; | 23 | import 'package:wow_english/pages/video/lookvideo/look_video_page.dart'; |
| 24 | 24 | ||
| 25 | import '../pages/reading/reading_page.dart'; | 25 | import '../pages/reading/reading_page.dart'; |
| 26 | +import '../pages/shopping/view.dart'; | ||
| 26 | import '../pages/user/setting/delete_account_page.dart'; | 27 | import '../pages/user/setting/delete_account_page.dart'; |
| 27 | import '../pages/user/setting/reback_page.dart'; | 28 | import '../pages/user/setting/reback_page.dart'; |
| 28 | 29 | ||
| @@ -43,6 +44,7 @@ class AppRouteName { | @@ -43,6 +44,7 @@ class AppRouteName { | ||
| 43 | static const String reAfter = 'reAfter'; | 44 | static const String reAfter = 'reAfter'; |
| 44 | static const String topicPic = 'topicPic'; | 45 | static const String topicPic = 'topicPic'; |
| 45 | static const String user = 'user'; | 46 | static const String user = 'user'; |
| 47 | + static const String pay = 'pay'; | ||
| 46 | 48 | ||
| 47 | /// 用户详细信息页 | 49 | /// 用户详细信息页 |
| 48 | static const String userInformation = 'userInformation'; | 50 | static const String userInformation = 'userInformation'; |
| @@ -101,6 +103,8 @@ class AppRouter { | @@ -101,6 +103,8 @@ class AppRouter { | ||
| 101 | return CupertinoPageRoute(builder: (_) => const ListenPage()); | 103 | return CupertinoPageRoute(builder: (_) => const ListenPage()); |
| 102 | case AppRouteName.shop: | 104 | case AppRouteName.shop: |
| 103 | return CupertinoPageRoute(builder: (_) => const ShopHomePage()); | 105 | return CupertinoPageRoute(builder: (_) => const ShopHomePage()); |
| 106 | + case AppRouteName.pay: | ||
| 107 | + return CupertinoPageRoute(builder: (_) => const ShoppingPage()); | ||
| 104 | case AppRouteName.exLesson: | 108 | case AppRouteName.exLesson: |
| 105 | return CupertinoPageRoute(builder: (_) => const ExchangeLessonPage()); | 109 | return CupertinoPageRoute(builder: (_) => const ExchangeLessonPage()); |
| 106 | case AppRouteName.exList: | 110 | case AppRouteName.exList: |
pubspec.yaml
| @@ -66,9 +66,9 @@ dependencies: | @@ -66,9 +66,9 @@ dependencies: | ||
| 66 | # 拍照,从相册中选择 https://pub.flutter-io.cn/packages/image_picker | 66 | # 拍照,从相册中选择 https://pub.flutter-io.cn/packages/image_picker |
| 67 | image_picker: ^0.8.7+5 | 67 | image_picker: ^0.8.7+5 |
| 68 | # 支付宝支付SDK https://pub.flutter-io.cn/packages/tobias | 68 | # 支付宝支付SDK https://pub.flutter-io.cn/packages/tobias |
| 69 | - # tobias: ^3.1.0 | 69 | + tobias: ^3.1.0 |
| 70 | # 微信SDK相关 https://pub.flutter-io.cn/packages/fluwx | 70 | # 微信SDK相关 https://pub.flutter-io.cn/packages/fluwx |
| 71 | - # fluwx: ^4.2.4+1 | 71 | + fluwx: ^4.5.5 |
| 72 | # json数据解析 https://pub.flutter-io.cn/packages/json_annotation | 72 | # json数据解析 https://pub.flutter-io.cn/packages/json_annotation |
| 73 | json_annotation: ^4.8.1 | 73 | json_annotation: ^4.8.1 |
| 74 | # double丢失精度问题 https://pub.dev/packages/decimal | 74 | # double丢失精度问题 https://pub.dev/packages/decimal |