Showing
17 changed files
with
1078 additions
and
28 deletions
| ... | @@ -30,8 +30,25 @@ | ... | @@ -30,8 +30,25 @@ |
| 30 | android:name="com.yalantis.ucrop.UCropActivity" | 30 | android:name="com.yalantis.ucrop.UCropActivity" |
| 31 | android:screenOrientation="portrait" | 31 | android:screenOrientation="portrait" |
| 32 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> | 32 | android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> |
| 33 | + <activity | ||
| 34 | + android:name="com.braintreepayments.api.BraintreeBrowserSwitchActivity" | ||
| 35 | + android:launchMode="singleTask" | ||
| 36 | + android:exported="true"> | ||
| 37 | + <intent-filter> | ||
| 38 | + <action android:name="android.intent.action.VIEW" /> | ||
| 39 | + | ||
| 40 | + <category android:name="android.intent.category.DEFAULT" /> | ||
| 41 | + <category android:name="android.intent.category.BROWSABLE" /> | ||
| 42 | + | ||
| 43 | + <data android:scheme="pub.yiyan.parlando.Parlando.braintree" /> | ||
| 44 | + </intent-filter> | ||
| 45 | + </activity> | ||
| 46 | + | ||
| 33 | <meta-data | 47 | <meta-data |
| 34 | android:name="flutterEmbedding" | 48 | android:name="flutterEmbedding" |
| 35 | android:value="2" /> | 49 | android:value="2" /> |
| 50 | + <meta-data | ||
| 51 | + android:name="com.google.android.gms.wallet.api.enabled" | ||
| 52 | + android:value="true" /> | ||
| 36 | </application> | 53 | </application> |
| 37 | </manifest> | 54 | </manifest> | ... | ... |
| ... | @@ -344,6 +344,7 @@ class MapScreenState extends State<AccountEditPage> | ... | @@ -344,6 +344,7 @@ class MapScreenState extends State<AccountEditPage> |
| 344 | mainAxisAlignment: MainAxisAlignment.start, | 344 | mainAxisAlignment: MainAxisAlignment.start, |
| 345 | children: <Widget>[ | 345 | children: <Widget>[ |
| 346 | Expanded( | 346 | Expanded( |
| 347 | + flex: 2, | ||
| 347 | child: Text( | 348 | child: Text( |
| 348 | ParlandoLocalizations.of(context) | 349 | ParlandoLocalizations.of(context) |
| 349 | .accountEditPageUserGender, | 350 | .accountEditPageUserGender, |
| ... | @@ -352,9 +353,9 @@ class MapScreenState extends State<AccountEditPage> | ... | @@ -352,9 +353,9 @@ class MapScreenState extends State<AccountEditPage> |
| 352 | fontWeight: FontWeight.bold, | 353 | fontWeight: FontWeight.bold, |
| 353 | ), | 354 | ), |
| 354 | ), | 355 | ), |
| 355 | - flex: 2, | ||
| 356 | ), | 356 | ), |
| 357 | Expanded( | 357 | Expanded( |
| 358 | + flex: 2, | ||
| 358 | child: Text( | 359 | child: Text( |
| 359 | ParlandoLocalizations.of(context) | 360 | ParlandoLocalizations.of(context) |
| 360 | .accountEditPageUserBirthday, | 361 | .accountEditPageUserBirthday, |
| ... | @@ -363,7 +364,6 @@ class MapScreenState extends State<AccountEditPage> | ... | @@ -363,7 +364,6 @@ class MapScreenState extends State<AccountEditPage> |
| 363 | fontWeight: FontWeight.bold, | 364 | fontWeight: FontWeight.bold, |
| 364 | ), | 365 | ), |
| 365 | ), | 366 | ), |
| 366 | - flex: 2, | ||
| 367 | ), | 367 | ), |
| 368 | ], | 368 | ], |
| 369 | )), | 369 | )), |
| ... | @@ -378,6 +378,7 @@ class MapScreenState extends State<AccountEditPage> | ... | @@ -378,6 +378,7 @@ class MapScreenState extends State<AccountEditPage> |
| 378 | mainAxisAlignment: MainAxisAlignment.start, | 378 | mainAxisAlignment: MainAxisAlignment.start, |
| 379 | children: <Widget>[ | 379 | children: <Widget>[ |
| 380 | Flexible( | 380 | Flexible( |
| 381 | + flex: 2, | ||
| 381 | child: Padding( | 382 | child: Padding( |
| 382 | padding: EdgeInsets.only(right: 10.px), | 383 | padding: EdgeInsets.only(right: 10.px), |
| 383 | child: TextField( | 384 | child: TextField( |
| ... | @@ -389,9 +390,9 @@ class MapScreenState extends State<AccountEditPage> | ... | @@ -389,9 +390,9 @@ class MapScreenState extends State<AccountEditPage> |
| 389 | enabled: !_status, | 390 | enabled: !_status, |
| 390 | ), | 391 | ), |
| 391 | ), | 392 | ), |
| 392 | - flex: 2, | ||
| 393 | ), | 393 | ), |
| 394 | Flexible( | 394 | Flexible( |
| 395 | + flex: 2, | ||
| 395 | child: TextField( | 396 | child: TextField( |
| 396 | decoration: InputDecoration( | 397 | decoration: InputDecoration( |
| 397 | hintText: ParlandoLocalizations.of( | 398 | hintText: ParlandoLocalizations.of( |
| ... | @@ -400,7 +401,6 @@ class MapScreenState extends State<AccountEditPage> | ... | @@ -400,7 +401,6 @@ class MapScreenState extends State<AccountEditPage> |
| 400 | ), | 401 | ), |
| 401 | enabled: !_status, | 402 | enabled: !_status, |
| 402 | ), | 403 | ), |
| 403 | - flex: 2, | ||
| 404 | ), | 404 | ), |
| 405 | ], | 405 | ], |
| 406 | )), | 406 | )), |
| ... | @@ -436,6 +436,7 @@ class MapScreenState extends State<AccountEditPage> | ... | @@ -436,6 +436,7 @@ class MapScreenState extends State<AccountEditPage> |
| 436 | mainAxisAlignment: MainAxisAlignment.start, | 436 | mainAxisAlignment: MainAxisAlignment.start, |
| 437 | children: <Widget>[ | 437 | children: <Widget>[ |
| 438 | Expanded( | 438 | Expanded( |
| 439 | + flex: 2, | ||
| 439 | child: Padding( | 440 | child: Padding( |
| 440 | padding: EdgeInsets.only(right: 10.px), | 441 | padding: EdgeInsets.only(right: 10.px), |
| 441 | child: ElevatedButton( | 442 | child: ElevatedButton( |
| ... | @@ -448,9 +449,9 @@ class MapScreenState extends State<AccountEditPage> | ... | @@ -448,9 +449,9 @@ class MapScreenState extends State<AccountEditPage> |
| 448 | }, | 449 | }, |
| 449 | ), | 450 | ), |
| 450 | ), | 451 | ), |
| 451 | - flex: 2, | ||
| 452 | ), | 452 | ), |
| 453 | Expanded( | 453 | Expanded( |
| 454 | + flex: 2, | ||
| 454 | child: Padding( | 455 | child: Padding( |
| 455 | padding: EdgeInsets.only(left: 10.px), | 456 | padding: EdgeInsets.only(left: 10.px), |
| 456 | child: ElevatedButton( | 457 | child: ElevatedButton( |
| ... | @@ -465,7 +466,6 @@ class MapScreenState extends State<AccountEditPage> | ... | @@ -465,7 +466,6 @@ class MapScreenState extends State<AccountEditPage> |
| 465 | }, | 466 | }, |
| 466 | ), | 467 | ), |
| 467 | ), | 468 | ), |
| 468 | - flex: 2, | ||
| 469 | ), | 469 | ), |
| 470 | ], | 470 | ], |
| 471 | ), | 471 | ), | ... | ... |
| ... | @@ -11,7 +11,6 @@ import 'package:cached_network_image/cached_network_image.dart'; | ... | @@ -11,7 +11,6 @@ import 'package:cached_network_image/cached_network_image.dart'; |
| 11 | import 'package:flustars/flustars.dart'; | 11 | import 'package:flustars/flustars.dart'; |
| 12 | import 'package:flutter/material.dart'; | 12 | import 'package:flutter/material.dart'; |
| 13 | import 'package:Parlando/membership/membership_router.dart'; | 13 | import 'package:Parlando/membership/membership_router.dart'; |
| 14 | -import 'package:Parlando/poem/poem_router.dart'; | ||
| 15 | import 'package:Parlando/routers/fluro_navigator.dart'; | 14 | import 'package:Parlando/routers/fluro_navigator.dart'; |
| 16 | import 'package:Parlando/setting/setting_router.dart'; | 15 | import 'package:Parlando/setting/setting_router.dart'; |
| 17 | import 'package:Parlando/tiktok/style/style.dart'; | 16 | import 'package:Parlando/tiktok/style/style.dart'; | ... | ... |
| ... | @@ -13,12 +13,16 @@ import 'package:Parlando/category/models/category_item_entity.dart'; | ... | @@ -13,12 +13,16 @@ import 'package:Parlando/category/models/category_item_entity.dart'; |
| 13 | import 'package:Parlando/home/models/home_entity.dart'; | 13 | import 'package:Parlando/home/models/home_entity.dart'; |
| 14 | import 'package:Parlando/home/models/setting_entity.dart'; | 14 | import 'package:Parlando/home/models/setting_entity.dart'; |
| 15 | import 'package:Parlando/login/models/auth_entity.dart'; | 15 | import 'package:Parlando/login/models/auth_entity.dart'; |
| 16 | +import 'package:Parlando/membership/models/membership_entity.dart'; | ||
| 17 | +import 'package:Parlando/membership/models/order_entity.dart'; | ||
| 18 | +import 'package:Parlando/membership/models/pay_entity.dart'; | ||
| 16 | import 'package:Parlando/models/upload_entity.dart'; | 19 | import 'package:Parlando/models/upload_entity.dart'; |
| 17 | import 'package:Parlando/poem/models/lang_sort_entity.dart'; | 20 | import 'package:Parlando/poem/models/lang_sort_entity.dart'; |
| 18 | import 'package:Parlando/poem/models/search_entity.dart'; | 21 | import 'package:Parlando/poem/models/search_entity.dart'; |
| 19 | import 'package:Parlando/timeline/models/friend_entity.dart'; | 22 | import 'package:Parlando/timeline/models/friend_entity.dart'; |
| 20 | 23 | ||
| 21 | JsonConvert jsonConvert = JsonConvert(); | 24 | JsonConvert jsonConvert = JsonConvert(); |
| 25 | + | ||
| 22 | typedef JsonConvertFunction<T> = T Function(Map<String, dynamic> json); | 26 | typedef JsonConvertFunction<T> = T Function(Map<String, dynamic> json); |
| 23 | 27 | ||
| 24 | class JsonConvert { | 28 | class JsonConvert { |
| ... | @@ -54,6 +58,21 @@ class JsonConvert { | ... | @@ -54,6 +58,21 @@ class JsonConvert { |
| 54 | (AuthEntity).toString(): AuthEntity.fromJson, | 58 | (AuthEntity).toString(): AuthEntity.fromJson, |
| 55 | (AuthData).toString(): AuthData.fromJson, | 59 | (AuthData).toString(): AuthData.fromJson, |
| 56 | (AuthError).toString(): AuthError.fromJson, | 60 | (AuthError).toString(): AuthError.fromJson, |
| 61 | + (MembershipEntity).toString(): MembershipEntity.fromJson, | ||
| 62 | + (MembershipData).toString(): MembershipData.fromJson, | ||
| 63 | + (MembershipDataGoodsList).toString(): MembershipDataGoodsList.fromJson, | ||
| 64 | + (MembershipError).toString(): MembershipError.fromJson, | ||
| 65 | + (OrderEntity).toString(): OrderEntity.fromJson, | ||
| 66 | + (OrderData).toString(): OrderData.fromJson, | ||
| 67 | + (OrderError).toString(): OrderError.fromJson, | ||
| 68 | + (PayEntity).toString(): PayEntity.fromJson, | ||
| 69 | + (PayData).toString(): PayData.fromJson, | ||
| 70 | + (PayDataPurchaseUnits).toString(): PayDataPurchaseUnits.fromJson, | ||
| 71 | + (PayDataPurchaseUnitsAmount).toString(): | ||
| 72 | + PayDataPurchaseUnitsAmount.fromJson, | ||
| 73 | + (PayDataPurchaseUnitsPayee).toString(): PayDataPurchaseUnitsPayee.fromJson, | ||
| 74 | + (PayDataLinks).toString(): PayDataLinks.fromJson, | ||
| 75 | + (PayError).toString(): PayError.fromJson, | ||
| 57 | (UploadEntity).toString(): UploadEntity.fromJson, | 76 | (UploadEntity).toString(): UploadEntity.fromJson, |
| 58 | (UploadData).toString(): UploadData.fromJson, | 77 | (UploadData).toString(): UploadData.fromJson, |
| 59 | (UploadError).toString(): UploadError.fromJson, | 78 | (UploadError).toString(): UploadError.fromJson, |
| ... | @@ -306,6 +325,84 @@ class JsonConvert { | ... | @@ -306,6 +325,84 @@ class JsonConvert { |
| 306 | .map<AuthError>((Map<String, dynamic> e) => AuthError.fromJson(e)) | 325 | .map<AuthError>((Map<String, dynamic> e) => AuthError.fromJson(e)) |
| 307 | .toList() as M; | 326 | .toList() as M; |
| 308 | } | 327 | } |
| 328 | + if (<MembershipEntity>[] is M) { | ||
| 329 | + return data | ||
| 330 | + .map<MembershipEntity>( | ||
| 331 | + (Map<String, dynamic> e) => MembershipEntity.fromJson(e)) | ||
| 332 | + .toList() as M; | ||
| 333 | + } | ||
| 334 | + if (<MembershipData>[] is M) { | ||
| 335 | + return data | ||
| 336 | + .map<MembershipData>( | ||
| 337 | + (Map<String, dynamic> e) => MembershipData.fromJson(e)) | ||
| 338 | + .toList() as M; | ||
| 339 | + } | ||
| 340 | + if (<MembershipDataGoodsList>[] is M) { | ||
| 341 | + return data | ||
| 342 | + .map<MembershipDataGoodsList>( | ||
| 343 | + (Map<String, dynamic> e) => MembershipDataGoodsList.fromJson(e)) | ||
| 344 | + .toList() as M; | ||
| 345 | + } | ||
| 346 | + if (<MembershipError>[] is M) { | ||
| 347 | + return data | ||
| 348 | + .map<MembershipError>( | ||
| 349 | + (Map<String, dynamic> e) => MembershipError.fromJson(e)) | ||
| 350 | + .toList() as M; | ||
| 351 | + } | ||
| 352 | + if (<OrderEntity>[] is M) { | ||
| 353 | + return data | ||
| 354 | + .map<OrderEntity>((Map<String, dynamic> e) => OrderEntity.fromJson(e)) | ||
| 355 | + .toList() as M; | ||
| 356 | + } | ||
| 357 | + if (<OrderData>[] is M) { | ||
| 358 | + return data | ||
| 359 | + .map<OrderData>((Map<String, dynamic> e) => OrderData.fromJson(e)) | ||
| 360 | + .toList() as M; | ||
| 361 | + } | ||
| 362 | + if (<OrderError>[] is M) { | ||
| 363 | + return data | ||
| 364 | + .map<OrderError>((Map<String, dynamic> e) => OrderError.fromJson(e)) | ||
| 365 | + .toList() as M; | ||
| 366 | + } | ||
| 367 | + if (<PayEntity>[] is M) { | ||
| 368 | + return data | ||
| 369 | + .map<PayEntity>((Map<String, dynamic> e) => PayEntity.fromJson(e)) | ||
| 370 | + .toList() as M; | ||
| 371 | + } | ||
| 372 | + if (<PayData>[] is M) { | ||
| 373 | + return data | ||
| 374 | + .map<PayData>((Map<String, dynamic> e) => PayData.fromJson(e)) | ||
| 375 | + .toList() as M; | ||
| 376 | + } | ||
| 377 | + if (<PayDataPurchaseUnits>[] is M) { | ||
| 378 | + return data | ||
| 379 | + .map<PayDataPurchaseUnits>( | ||
| 380 | + (Map<String, dynamic> e) => PayDataPurchaseUnits.fromJson(e)) | ||
| 381 | + .toList() as M; | ||
| 382 | + } | ||
| 383 | + if (<PayDataPurchaseUnitsAmount>[] is M) { | ||
| 384 | + return data | ||
| 385 | + .map<PayDataPurchaseUnitsAmount>((Map<String, dynamic> e) => | ||
| 386 | + PayDataPurchaseUnitsAmount.fromJson(e)) | ||
| 387 | + .toList() as M; | ||
| 388 | + } | ||
| 389 | + if (<PayDataPurchaseUnitsPayee>[] is M) { | ||
| 390 | + return data | ||
| 391 | + .map<PayDataPurchaseUnitsPayee>( | ||
| 392 | + (Map<String, dynamic> e) => PayDataPurchaseUnitsPayee.fromJson(e)) | ||
| 393 | + .toList() as M; | ||
| 394 | + } | ||
| 395 | + if (<PayDataLinks>[] is M) { | ||
| 396 | + return data | ||
| 397 | + .map<PayDataLinks>( | ||
| 398 | + (Map<String, dynamic> e) => PayDataLinks.fromJson(e)) | ||
| 399 | + .toList() as M; | ||
| 400 | + } | ||
| 401 | + if (<PayError>[] is M) { | ||
| 402 | + return data | ||
| 403 | + .map<PayError>((Map<String, dynamic> e) => PayError.fromJson(e)) | ||
| 404 | + .toList() as M; | ||
| 405 | + } | ||
| 309 | if (<UploadEntity>[] is M) { | 406 | if (<UploadEntity>[] is M) { |
| 310 | return data | 407 | return data |
| 311 | .map<UploadEntity>( | 408 | .map<UploadEntity>( | ... | ... |
lib/generated/json/membership_entity.g.dart
0 → 100644
| 1 | +import 'package:Parlando/generated/json/base/json_convert_content.dart'; | ||
| 2 | +import 'package:Parlando/membership/models/membership_entity.dart'; | ||
| 3 | + | ||
| 4 | +MembershipEntity $MembershipEntityFromJson(Map<String, dynamic> json) { | ||
| 5 | + final MembershipEntity membershipEntity = MembershipEntity(); | ||
| 6 | + final String? status = jsonConvert.convert<String>(json['status']); | ||
| 7 | + if (status != null) { | ||
| 8 | + membershipEntity.status = status; | ||
| 9 | + } | ||
| 10 | + final int? code = jsonConvert.convert<int>(json['code']); | ||
| 11 | + if (code != null) { | ||
| 12 | + membershipEntity.code = code; | ||
| 13 | + } | ||
| 14 | + final String? message = jsonConvert.convert<String>(json['message']); | ||
| 15 | + if (message != null) { | ||
| 16 | + membershipEntity.message = message; | ||
| 17 | + } | ||
| 18 | + final MembershipData? data = | ||
| 19 | + jsonConvert.convert<MembershipData>(json['data']); | ||
| 20 | + if (data != null) { | ||
| 21 | + membershipEntity.data = data; | ||
| 22 | + } | ||
| 23 | + final MembershipError? error = | ||
| 24 | + jsonConvert.convert<MembershipError>(json['error']); | ||
| 25 | + if (error != null) { | ||
| 26 | + membershipEntity.error = error; | ||
| 27 | + } | ||
| 28 | + return membershipEntity; | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +Map<String, dynamic> $MembershipEntityToJson(MembershipEntity entity) { | ||
| 32 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 33 | + data['status'] = entity.status; | ||
| 34 | + data['code'] = entity.code; | ||
| 35 | + data['message'] = entity.message; | ||
| 36 | + data['data'] = entity.data?.toJson(); | ||
| 37 | + data['error'] = entity.error?.toJson(); | ||
| 38 | + return data; | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +MembershipData $MembershipDataFromJson(Map<String, dynamic> json) { | ||
| 42 | + final MembershipData membershipData = MembershipData(); | ||
| 43 | + final int? id = jsonConvert.convert<int>(json['id']); | ||
| 44 | + if (id != null) { | ||
| 45 | + membershipData.id = id; | ||
| 46 | + } | ||
| 47 | + final String? title = jsonConvert.convert<String>(json['title']); | ||
| 48 | + if (title != null) { | ||
| 49 | + membershipData.title = title; | ||
| 50 | + } | ||
| 51 | + final String? intro = jsonConvert.convert<String>(json['intro']); | ||
| 52 | + if (intro != null) { | ||
| 53 | + membershipData.intro = intro; | ||
| 54 | + } | ||
| 55 | + final String? bgType = jsonConvert.convert<String>(json['bg_type']); | ||
| 56 | + if (bgType != null) { | ||
| 57 | + membershipData.bgType = bgType; | ||
| 58 | + } | ||
| 59 | + final String? bgImages = jsonConvert.convert<String>(json['bg_images']); | ||
| 60 | + if (bgImages != null) { | ||
| 61 | + membershipData.bgImages = bgImages; | ||
| 62 | + } | ||
| 63 | + final String? videoUrl = jsonConvert.convert<String>(json['video_url']); | ||
| 64 | + if (videoUrl != null) { | ||
| 65 | + membershipData.videoUrl = videoUrl; | ||
| 66 | + } | ||
| 67 | + final String? videoCover = jsonConvert.convert<String>(json['video_cover']); | ||
| 68 | + if (videoCover != null) { | ||
| 69 | + membershipData.videoCover = videoCover; | ||
| 70 | + } | ||
| 71 | + final String? terminal = jsonConvert.convert<String>(json['terminal']); | ||
| 72 | + if (terminal != null) { | ||
| 73 | + membershipData.terminal = terminal; | ||
| 74 | + } | ||
| 75 | + final String? state = jsonConvert.convert<String>(json['state']); | ||
| 76 | + if (state != null) { | ||
| 77 | + membershipData.state = state; | ||
| 78 | + } | ||
| 79 | + final String? createdAt = jsonConvert.convert<String>(json['created_at']); | ||
| 80 | + if (createdAt != null) { | ||
| 81 | + membershipData.createdAt = createdAt; | ||
| 82 | + } | ||
| 83 | + final String? updatedAt = jsonConvert.convert<String>(json['updated_at']); | ||
| 84 | + if (updatedAt != null) { | ||
| 85 | + membershipData.updatedAt = updatedAt; | ||
| 86 | + } | ||
| 87 | + final int? isVip = jsonConvert.convert<int>(json['is_vip']); | ||
| 88 | + if (isVip != null) { | ||
| 89 | + membershipData.isVip = isVip; | ||
| 90 | + } | ||
| 91 | + final List<MembershipDataGoodsList>? goodsList = jsonConvert | ||
| 92 | + .convertListNotNull<MembershipDataGoodsList>(json['goods_list']); | ||
| 93 | + if (goodsList != null) { | ||
| 94 | + membershipData.goodsList = goodsList; | ||
| 95 | + } | ||
| 96 | + return membershipData; | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +Map<String, dynamic> $MembershipDataToJson(MembershipData entity) { | ||
| 100 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 101 | + data['id'] = entity.id; | ||
| 102 | + data['title'] = entity.title; | ||
| 103 | + data['intro'] = entity.intro; | ||
| 104 | + data['bg_type'] = entity.bgType; | ||
| 105 | + data['bg_images'] = entity.bgImages; | ||
| 106 | + data['video_url'] = entity.videoUrl; | ||
| 107 | + data['video_cover'] = entity.videoCover; | ||
| 108 | + data['terminal'] = entity.terminal; | ||
| 109 | + data['state'] = entity.state; | ||
| 110 | + data['created_at'] = entity.createdAt; | ||
| 111 | + data['updated_at'] = entity.updatedAt; | ||
| 112 | + data['is_vip'] = entity.isVip; | ||
| 113 | + data['goods_list'] = entity.goodsList?.map((v) => v.toJson()).toList(); | ||
| 114 | + return data; | ||
| 115 | +} | ||
| 116 | + | ||
| 117 | +MembershipDataGoodsList $MembershipDataGoodsListFromJson( | ||
| 118 | + Map<String, dynamic> json) { | ||
| 119 | + final MembershipDataGoodsList membershipDataGoodsList = | ||
| 120 | + MembershipDataGoodsList(); | ||
| 121 | + final int? id = jsonConvert.convert<int>(json['id']); | ||
| 122 | + if (id != null) { | ||
| 123 | + membershipDataGoodsList.id = id; | ||
| 124 | + } | ||
| 125 | + final String? membershipId = | ||
| 126 | + jsonConvert.convert<String>(json['membership_id']); | ||
| 127 | + if (membershipId != null) { | ||
| 128 | + membershipDataGoodsList.membershipId = membershipId; | ||
| 129 | + } | ||
| 130 | + final String? name = jsonConvert.convert<String>(json['name']); | ||
| 131 | + if (name != null) { | ||
| 132 | + membershipDataGoodsList.name = name; | ||
| 133 | + } | ||
| 134 | + final String? price = jsonConvert.convert<String>(json['price']); | ||
| 135 | + if (price != null) { | ||
| 136 | + membershipDataGoodsList.price = price; | ||
| 137 | + } | ||
| 138 | + final String? linePrice = jsonConvert.convert<String>(json['line_price']); | ||
| 139 | + if (linePrice != null) { | ||
| 140 | + membershipDataGoodsList.linePrice = linePrice; | ||
| 141 | + } | ||
| 142 | + final String? limitDays = jsonConvert.convert<String>(json['limit_days']); | ||
| 143 | + if (limitDays != null) { | ||
| 144 | + membershipDataGoodsList.limitDays = limitDays; | ||
| 145 | + } | ||
| 146 | + final String? limitUnit = jsonConvert.convert<String>(json['limit_unit']); | ||
| 147 | + if (limitUnit != null) { | ||
| 148 | + membershipDataGoodsList.limitUnit = limitUnit; | ||
| 149 | + } | ||
| 150 | + final String? terminal = jsonConvert.convert<String>(json['terminal']); | ||
| 151 | + if (terminal != null) { | ||
| 152 | + membershipDataGoodsList.terminal = terminal; | ||
| 153 | + } | ||
| 154 | + final String? state = jsonConvert.convert<String>(json['state']); | ||
| 155 | + if (state != null) { | ||
| 156 | + membershipDataGoodsList.state = state; | ||
| 157 | + } | ||
| 158 | + final String? sn = jsonConvert.convert<String>(json['sn']); | ||
| 159 | + if (sn != null) { | ||
| 160 | + membershipDataGoodsList.sn = sn; | ||
| 161 | + } | ||
| 162 | + final String? visits = jsonConvert.convert<String>(json['visits']); | ||
| 163 | + if (visits != null) { | ||
| 164 | + membershipDataGoodsList.visits = visits; | ||
| 165 | + } | ||
| 166 | + final String? virtualSales = | ||
| 167 | + jsonConvert.convert<String>(json['virtual_sales']); | ||
| 168 | + if (virtualSales != null) { | ||
| 169 | + membershipDataGoodsList.virtualSales = virtualSales; | ||
| 170 | + } | ||
| 171 | + final String? sales = jsonConvert.convert<String>(json['sales']); | ||
| 172 | + if (sales != null) { | ||
| 173 | + membershipDataGoodsList.sales = sales; | ||
| 174 | + } | ||
| 175 | + final String? stocks = jsonConvert.convert<String>(json['stocks']); | ||
| 176 | + if (stocks != null) { | ||
| 177 | + membershipDataGoodsList.stocks = stocks; | ||
| 178 | + } | ||
| 179 | + final String? createdAt = jsonConvert.convert<String>(json['created_at']); | ||
| 180 | + if (createdAt != null) { | ||
| 181 | + membershipDataGoodsList.createdAt = createdAt; | ||
| 182 | + } | ||
| 183 | + final String? updatedAt = jsonConvert.convert<String>(json['updated_at']); | ||
| 184 | + if (updatedAt != null) { | ||
| 185 | + membershipDataGoodsList.updatedAt = updatedAt; | ||
| 186 | + } | ||
| 187 | + return membershipDataGoodsList; | ||
| 188 | +} | ||
| 189 | + | ||
| 190 | +Map<String, dynamic> $MembershipDataGoodsListToJson( | ||
| 191 | + MembershipDataGoodsList entity) { | ||
| 192 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 193 | + data['id'] = entity.id; | ||
| 194 | + data['membership_id'] = entity.membershipId; | ||
| 195 | + data['name'] = entity.name; | ||
| 196 | + data['price'] = entity.price; | ||
| 197 | + data['line_price'] = entity.linePrice; | ||
| 198 | + data['limit_days'] = entity.limitDays; | ||
| 199 | + data['limit_unit'] = entity.limitUnit; | ||
| 200 | + data['terminal'] = entity.terminal; | ||
| 201 | + data['state'] = entity.state; | ||
| 202 | + data['sn'] = entity.sn; | ||
| 203 | + data['visits'] = entity.visits; | ||
| 204 | + data['virtual_sales'] = entity.virtualSales; | ||
| 205 | + data['sales'] = entity.sales; | ||
| 206 | + data['stocks'] = entity.stocks; | ||
| 207 | + data['created_at'] = entity.createdAt; | ||
| 208 | + data['updated_at'] = entity.updatedAt; | ||
| 209 | + return data; | ||
| 210 | +} | ||
| 211 | + | ||
| 212 | +MembershipError $MembershipErrorFromJson(Map<String, dynamic> json) { | ||
| 213 | + final MembershipError membershipError = MembershipError(); | ||
| 214 | + return membershipError; | ||
| 215 | +} | ||
| 216 | + | ||
| 217 | +Map<String, dynamic> $MembershipErrorToJson(MembershipError entity) { | ||
| 218 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 219 | + return data; | ||
| 220 | +} |
lib/generated/json/order_entity.g.dart
0 → 100644
| 1 | +import 'package:Parlando/generated/json/base/json_convert_content.dart'; | ||
| 2 | +import 'package:Parlando/membership/models/order_entity.dart'; | ||
| 3 | + | ||
| 4 | +OrderEntity $OrderEntityFromJson(Map<String, dynamic> json) { | ||
| 5 | + final OrderEntity orderEntity = OrderEntity(); | ||
| 6 | + final String? status = jsonConvert.convert<String>(json['status']); | ||
| 7 | + if (status != null) { | ||
| 8 | + orderEntity.status = status; | ||
| 9 | + } | ||
| 10 | + final int? code = jsonConvert.convert<int>(json['code']); | ||
| 11 | + if (code != null) { | ||
| 12 | + orderEntity.code = code; | ||
| 13 | + } | ||
| 14 | + final String? message = jsonConvert.convert<String>(json['message']); | ||
| 15 | + if (message != null) { | ||
| 16 | + orderEntity.message = message; | ||
| 17 | + } | ||
| 18 | + final OrderData? data = jsonConvert.convert<OrderData>(json['data']); | ||
| 19 | + if (data != null) { | ||
| 20 | + orderEntity.data = data; | ||
| 21 | + } | ||
| 22 | + final OrderError? error = jsonConvert.convert<OrderError>(json['error']); | ||
| 23 | + if (error != null) { | ||
| 24 | + orderEntity.error = error; | ||
| 25 | + } | ||
| 26 | + return orderEntity; | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +Map<String, dynamic> $OrderEntityToJson(OrderEntity entity) { | ||
| 30 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 31 | + data['status'] = entity.status; | ||
| 32 | + data['code'] = entity.code; | ||
| 33 | + data['message'] = entity.message; | ||
| 34 | + data['data'] = entity.data?.toJson(); | ||
| 35 | + data['error'] = entity.error?.toJson(); | ||
| 36 | + return data; | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +OrderData $OrderDataFromJson(Map<String, dynamic> json) { | ||
| 40 | + final OrderData orderData = OrderData(); | ||
| 41 | + final String? orderSn = jsonConvert.convert<String>(json['order_sn']); | ||
| 42 | + if (orderSn != null) { | ||
| 43 | + orderData.orderSn = orderSn; | ||
| 44 | + } | ||
| 45 | + return orderData; | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +Map<String, dynamic> $OrderDataToJson(OrderData entity) { | ||
| 49 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 50 | + data['order_sn'] = entity.orderSn; | ||
| 51 | + return data; | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +OrderError $OrderErrorFromJson(Map<String, dynamic> json) { | ||
| 55 | + final OrderError orderError = OrderError(); | ||
| 56 | + return orderError; | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +Map<String, dynamic> $OrderErrorToJson(OrderError entity) { | ||
| 60 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 61 | + return data; | ||
| 62 | +} |
lib/generated/json/pay_entity.g.dart
0 → 100644
| 1 | +import 'package:Parlando/generated/json/base/json_convert_content.dart'; | ||
| 2 | +import 'package:Parlando/membership/models/pay_entity.dart'; | ||
| 3 | + | ||
| 4 | +PayEntity $PayEntityFromJson(Map<String, dynamic> json) { | ||
| 5 | + final PayEntity payEntity = PayEntity(); | ||
| 6 | + final String? status = jsonConvert.convert<String>(json['status']); | ||
| 7 | + if (status != null) { | ||
| 8 | + payEntity.status = status; | ||
| 9 | + } | ||
| 10 | + final int? code = jsonConvert.convert<int>(json['code']); | ||
| 11 | + if (code != null) { | ||
| 12 | + payEntity.code = code; | ||
| 13 | + } | ||
| 14 | + final String? message = jsonConvert.convert<String>(json['message']); | ||
| 15 | + if (message != null) { | ||
| 16 | + payEntity.message = message; | ||
| 17 | + } | ||
| 18 | + final PayData? data = jsonConvert.convert<PayData>(json['data']); | ||
| 19 | + if (data != null) { | ||
| 20 | + payEntity.data = data; | ||
| 21 | + } | ||
| 22 | + final PayError? error = jsonConvert.convert<PayError>(json['error']); | ||
| 23 | + if (error != null) { | ||
| 24 | + payEntity.error = error; | ||
| 25 | + } | ||
| 26 | + return payEntity; | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +Map<String, dynamic> $PayEntityToJson(PayEntity entity) { | ||
| 30 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 31 | + data['status'] = entity.status; | ||
| 32 | + data['code'] = entity.code; | ||
| 33 | + data['message'] = entity.message; | ||
| 34 | + data['data'] = entity.data?.toJson(); | ||
| 35 | + data['error'] = entity.error?.toJson(); | ||
| 36 | + return data; | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +PayData $PayDataFromJson(Map<String, dynamic> json) { | ||
| 40 | + final PayData payData = PayData(); | ||
| 41 | + final String? id = jsonConvert.convert<String>(json['id']); | ||
| 42 | + if (id != null) { | ||
| 43 | + payData.id = id; | ||
| 44 | + } | ||
| 45 | + final String? intent = jsonConvert.convert<String>(json['intent']); | ||
| 46 | + if (intent != null) { | ||
| 47 | + payData.intent = intent; | ||
| 48 | + } | ||
| 49 | + final String? status = jsonConvert.convert<String>(json['status']); | ||
| 50 | + if (status != null) { | ||
| 51 | + payData.status = status; | ||
| 52 | + } | ||
| 53 | + final List<PayDataPurchaseUnits>? purchaseUnits = jsonConvert | ||
| 54 | + .convertListNotNull<PayDataPurchaseUnits>(json['purchase_units']); | ||
| 55 | + if (purchaseUnits != null) { | ||
| 56 | + payData.purchaseUnits = purchaseUnits; | ||
| 57 | + } | ||
| 58 | + final String? createTime = jsonConvert.convert<String>(json['create_time']); | ||
| 59 | + if (createTime != null) { | ||
| 60 | + payData.createTime = createTime; | ||
| 61 | + } | ||
| 62 | + final List<PayDataLinks>? links = | ||
| 63 | + jsonConvert.convertListNotNull<PayDataLinks>(json['links']); | ||
| 64 | + if (links != null) { | ||
| 65 | + payData.links = links; | ||
| 66 | + } | ||
| 67 | + return payData; | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +Map<String, dynamic> $PayDataToJson(PayData entity) { | ||
| 71 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 72 | + data['id'] = entity.id; | ||
| 73 | + data['intent'] = entity.intent; | ||
| 74 | + data['status'] = entity.status; | ||
| 75 | + data['purchase_units'] = | ||
| 76 | + entity.purchaseUnits?.map((v) => v.toJson()).toList(); | ||
| 77 | + data['create_time'] = entity.createTime; | ||
| 78 | + data['links'] = entity.links?.map((v) => v.toJson()).toList(); | ||
| 79 | + return data; | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +PayDataPurchaseUnits $PayDataPurchaseUnitsFromJson(Map<String, dynamic> json) { | ||
| 83 | + final PayDataPurchaseUnits payDataPurchaseUnits = PayDataPurchaseUnits(); | ||
| 84 | + final String? referenceId = jsonConvert.convert<String>(json['reference_id']); | ||
| 85 | + if (referenceId != null) { | ||
| 86 | + payDataPurchaseUnits.referenceId = referenceId; | ||
| 87 | + } | ||
| 88 | + final PayDataPurchaseUnitsAmount? amount = | ||
| 89 | + jsonConvert.convert<PayDataPurchaseUnitsAmount>(json['amount']); | ||
| 90 | + if (amount != null) { | ||
| 91 | + payDataPurchaseUnits.amount = amount; | ||
| 92 | + } | ||
| 93 | + final PayDataPurchaseUnitsPayee? payee = | ||
| 94 | + jsonConvert.convert<PayDataPurchaseUnitsPayee>(json['payee']); | ||
| 95 | + if (payee != null) { | ||
| 96 | + payDataPurchaseUnits.payee = payee; | ||
| 97 | + } | ||
| 98 | + final String? description = jsonConvert.convert<String>(json['description']); | ||
| 99 | + if (description != null) { | ||
| 100 | + payDataPurchaseUnits.description = description; | ||
| 101 | + } | ||
| 102 | + final String? customId = jsonConvert.convert<String>(json['custom_id']); | ||
| 103 | + if (customId != null) { | ||
| 104 | + payDataPurchaseUnits.customId = customId; | ||
| 105 | + } | ||
| 106 | + final String? softDescriptor = | ||
| 107 | + jsonConvert.convert<String>(json['soft_descriptor']); | ||
| 108 | + if (softDescriptor != null) { | ||
| 109 | + payDataPurchaseUnits.softDescriptor = softDescriptor; | ||
| 110 | + } | ||
| 111 | + return payDataPurchaseUnits; | ||
| 112 | +} | ||
| 113 | + | ||
| 114 | +Map<String, dynamic> $PayDataPurchaseUnitsToJson(PayDataPurchaseUnits entity) { | ||
| 115 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 116 | + data['reference_id'] = entity.referenceId; | ||
| 117 | + data['amount'] = entity.amount?.toJson(); | ||
| 118 | + data['payee'] = entity.payee?.toJson(); | ||
| 119 | + data['description'] = entity.description; | ||
| 120 | + data['custom_id'] = entity.customId; | ||
| 121 | + data['soft_descriptor'] = entity.softDescriptor; | ||
| 122 | + return data; | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | +PayDataPurchaseUnitsAmount $PayDataPurchaseUnitsAmountFromJson( | ||
| 126 | + Map<String, dynamic> json) { | ||
| 127 | + final PayDataPurchaseUnitsAmount payDataPurchaseUnitsAmount = | ||
| 128 | + PayDataPurchaseUnitsAmount(); | ||
| 129 | + final String? currencyCode = | ||
| 130 | + jsonConvert.convert<String>(json['currency_code']); | ||
| 131 | + if (currencyCode != null) { | ||
| 132 | + payDataPurchaseUnitsAmount.currencyCode = currencyCode; | ||
| 133 | + } | ||
| 134 | + final String? value = jsonConvert.convert<String>(json['value']); | ||
| 135 | + if (value != null) { | ||
| 136 | + payDataPurchaseUnitsAmount.value = value; | ||
| 137 | + } | ||
| 138 | + return payDataPurchaseUnitsAmount; | ||
| 139 | +} | ||
| 140 | + | ||
| 141 | +Map<String, dynamic> $PayDataPurchaseUnitsAmountToJson( | ||
| 142 | + PayDataPurchaseUnitsAmount entity) { | ||
| 143 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 144 | + data['currency_code'] = entity.currencyCode; | ||
| 145 | + data['value'] = entity.value; | ||
| 146 | + return data; | ||
| 147 | +} | ||
| 148 | + | ||
| 149 | +PayDataPurchaseUnitsPayee $PayDataPurchaseUnitsPayeeFromJson( | ||
| 150 | + Map<String, dynamic> json) { | ||
| 151 | + final PayDataPurchaseUnitsPayee payDataPurchaseUnitsPayee = | ||
| 152 | + PayDataPurchaseUnitsPayee(); | ||
| 153 | + final String? emailAddress = | ||
| 154 | + jsonConvert.convert<String>(json['email_address']); | ||
| 155 | + if (emailAddress != null) { | ||
| 156 | + payDataPurchaseUnitsPayee.emailAddress = emailAddress; | ||
| 157 | + } | ||
| 158 | + final String? merchantId = jsonConvert.convert<String>(json['merchant_id']); | ||
| 159 | + if (merchantId != null) { | ||
| 160 | + payDataPurchaseUnitsPayee.merchantId = merchantId; | ||
| 161 | + } | ||
| 162 | + return payDataPurchaseUnitsPayee; | ||
| 163 | +} | ||
| 164 | + | ||
| 165 | +Map<String, dynamic> $PayDataPurchaseUnitsPayeeToJson( | ||
| 166 | + PayDataPurchaseUnitsPayee entity) { | ||
| 167 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 168 | + data['email_address'] = entity.emailAddress; | ||
| 169 | + data['merchant_id'] = entity.merchantId; | ||
| 170 | + return data; | ||
| 171 | +} | ||
| 172 | + | ||
| 173 | +PayDataLinks $PayDataLinksFromJson(Map<String, dynamic> json) { | ||
| 174 | + final PayDataLinks payDataLinks = PayDataLinks(); | ||
| 175 | + final String? href = jsonConvert.convert<String>(json['href']); | ||
| 176 | + if (href != null) { | ||
| 177 | + payDataLinks.href = href; | ||
| 178 | + } | ||
| 179 | + final String? rel = jsonConvert.convert<String>(json['rel']); | ||
| 180 | + if (rel != null) { | ||
| 181 | + payDataLinks.rel = rel; | ||
| 182 | + } | ||
| 183 | + final String? method = jsonConvert.convert<String>(json['method']); | ||
| 184 | + if (method != null) { | ||
| 185 | + payDataLinks.method = method; | ||
| 186 | + } | ||
| 187 | + return payDataLinks; | ||
| 188 | +} | ||
| 189 | + | ||
| 190 | +Map<String, dynamic> $PayDataLinksToJson(PayDataLinks entity) { | ||
| 191 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 192 | + data['href'] = entity.href; | ||
| 193 | + data['rel'] = entity.rel; | ||
| 194 | + data['method'] = entity.method; | ||
| 195 | + return data; | ||
| 196 | +} | ||
| 197 | + | ||
| 198 | +PayError $PayErrorFromJson(Map<String, dynamic> json) { | ||
| 199 | + final PayError payError = PayError(); | ||
| 200 | + return payError; | ||
| 201 | +} | ||
| 202 | + | ||
| 203 | +Map<String, dynamic> $PayErrorToJson(PayError entity) { | ||
| 204 | + final Map<String, dynamic> data = <String, dynamic>{}; | ||
| 205 | + return data; | ||
| 206 | +} |
| 1 | import 'package:Parlando/account/view_models/account_view_model.dart'; | 1 | import 'package:Parlando/account/view_models/account_view_model.dart'; |
| 2 | +import 'package:Parlando/membership/view_models/membership_view_model.dart'; | ||
| 2 | import 'package:dio/dio.dart'; | 3 | import 'package:dio/dio.dart'; |
| 3 | import 'package:flustars/flustars.dart'; | 4 | import 'package:flustars/flustars.dart'; |
| 4 | import 'package:flutter/material.dart'; | 5 | import 'package:flutter/material.dart'; |
| ... | @@ -128,7 +129,8 @@ class MyApp extends StatelessWidget { | ... | @@ -128,7 +129,8 @@ class MyApp extends StatelessWidget { |
| 128 | providers: [ | 129 | providers: [ |
| 129 | ChangeNotifierProvider(create: (_) => ThemeProvider()), | 130 | ChangeNotifierProvider(create: (_) => ThemeProvider()), |
| 130 | ChangeNotifierProvider(create: (_) => LocaleProvider()), | 131 | ChangeNotifierProvider(create: (_) => LocaleProvider()), |
| 131 | - ChangeNotifierProvider(create: (_) => AccountViewProvider()) | 132 | + ChangeNotifierProvider(create: (_) => AccountViewProvider()), |
| 133 | + ChangeNotifierProvider(create: (_) => MembershipViewProvider()) | ||
| 132 | ], | 134 | ], |
| 133 | child: Consumer2<ThemeProvider, LocaleProvider>( | 135 | child: Consumer2<ThemeProvider, LocaleProvider>( |
| 134 | builder: | 136 | builder: | ... | ... |
lib/membership/models/membership_entity.dart
0 → 100644
| 1 | +import 'dart:convert'; | ||
| 2 | +import 'package:Parlando/generated/json/base/json_field.dart'; | ||
| 3 | +import 'package:Parlando/generated/json/membership_entity.g.dart'; | ||
| 4 | + | ||
| 5 | +@JsonSerializable() | ||
| 6 | +class MembershipEntity { | ||
| 7 | + String? status; | ||
| 8 | + int? code; | ||
| 9 | + String? message; | ||
| 10 | + MembershipData? data; | ||
| 11 | + MembershipError? error; | ||
| 12 | + | ||
| 13 | + MembershipEntity(); | ||
| 14 | + | ||
| 15 | + factory MembershipEntity.fromJson(Map<String, dynamic> json) => | ||
| 16 | + $MembershipEntityFromJson(json); | ||
| 17 | + | ||
| 18 | + Map<String, dynamic> toJson() => $MembershipEntityToJson(this); | ||
| 19 | + | ||
| 20 | + @override | ||
| 21 | + String toString() { | ||
| 22 | + return jsonEncode(this); | ||
| 23 | + } | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +@JsonSerializable() | ||
| 27 | +class MembershipData { | ||
| 28 | + int? id; | ||
| 29 | + String? title; | ||
| 30 | + String? intro; | ||
| 31 | + @JSONField(name: "bg_type") | ||
| 32 | + String? bgType; | ||
| 33 | + @JSONField(name: "bg_images") | ||
| 34 | + String? bgImages; | ||
| 35 | + @JSONField(name: "video_url") | ||
| 36 | + String? videoUrl; | ||
| 37 | + @JSONField(name: "video_cover") | ||
| 38 | + String? videoCover; | ||
| 39 | + String? terminal; | ||
| 40 | + String? state; | ||
| 41 | + @JSONField(name: "created_at") | ||
| 42 | + String? createdAt; | ||
| 43 | + @JSONField(name: "updated_at") | ||
| 44 | + String? updatedAt; | ||
| 45 | + @JSONField(name: "is_vip") | ||
| 46 | + int? isVip; | ||
| 47 | + @JSONField(name: "goods_list") | ||
| 48 | + List<MembershipDataGoodsList>? goodsList; | ||
| 49 | + | ||
| 50 | + MembershipData(); | ||
| 51 | + | ||
| 52 | + factory MembershipData.fromJson(Map<String, dynamic> json) => | ||
| 53 | + $MembershipDataFromJson(json); | ||
| 54 | + | ||
| 55 | + Map<String, dynamic> toJson() => $MembershipDataToJson(this); | ||
| 56 | + | ||
| 57 | + @override | ||
| 58 | + String toString() { | ||
| 59 | + return jsonEncode(this); | ||
| 60 | + } | ||
| 61 | +} | ||
| 62 | + | ||
| 63 | +@JsonSerializable() | ||
| 64 | +class MembershipDataGoodsList { | ||
| 65 | + int? id; | ||
| 66 | + @JSONField(name: "membership_id") | ||
| 67 | + String? membershipId; | ||
| 68 | + String? name; | ||
| 69 | + String? price; | ||
| 70 | + @JSONField(name: "line_price") | ||
| 71 | + String? linePrice; | ||
| 72 | + @JSONField(name: "limit_days") | ||
| 73 | + String? limitDays; | ||
| 74 | + @JSONField(name: "limit_unit") | ||
| 75 | + String? limitUnit; | ||
| 76 | + String? terminal; | ||
| 77 | + String? state; | ||
| 78 | + String? sn; | ||
| 79 | + String? visits; | ||
| 80 | + @JSONField(name: "virtual_sales") | ||
| 81 | + String? virtualSales; | ||
| 82 | + String? sales; | ||
| 83 | + String? stocks; | ||
| 84 | + @JSONField(name: "created_at") | ||
| 85 | + String? createdAt; | ||
| 86 | + @JSONField(name: "updated_at") | ||
| 87 | + String? updatedAt; | ||
| 88 | + | ||
| 89 | + MembershipDataGoodsList(); | ||
| 90 | + | ||
| 91 | + factory MembershipDataGoodsList.fromJson(Map<String, dynamic> json) => | ||
| 92 | + $MembershipDataGoodsListFromJson(json); | ||
| 93 | + | ||
| 94 | + Map<String, dynamic> toJson() => $MembershipDataGoodsListToJson(this); | ||
| 95 | + | ||
| 96 | + @override | ||
| 97 | + String toString() { | ||
| 98 | + return jsonEncode(this); | ||
| 99 | + } | ||
| 100 | +} | ||
| 101 | + | ||
| 102 | +@JsonSerializable() | ||
| 103 | +class MembershipError { | ||
| 104 | + MembershipError(); | ||
| 105 | + | ||
| 106 | + factory MembershipError.fromJson(Map<String, dynamic> json) => | ||
| 107 | + $MembershipErrorFromJson(json); | ||
| 108 | + | ||
| 109 | + Map<String, dynamic> toJson() => $MembershipErrorToJson(this); | ||
| 110 | + | ||
| 111 | + @override | ||
| 112 | + String toString() { | ||
| 113 | + return jsonEncode(this); | ||
| 114 | + } | ||
| 115 | +} |
lib/membership/models/order_entity.dart
0 → 100644
| 1 | +import 'dart:convert'; | ||
| 2 | +import 'package:Parlando/generated/json/base/json_field.dart'; | ||
| 3 | +import 'package:Parlando/generated/json/order_entity.g.dart'; | ||
| 4 | + | ||
| 5 | +@JsonSerializable() | ||
| 6 | +class OrderEntity { | ||
| 7 | + String? status; | ||
| 8 | + int? code; | ||
| 9 | + String? message; | ||
| 10 | + OrderData? data; | ||
| 11 | + OrderError? error; | ||
| 12 | + | ||
| 13 | + OrderEntity(); | ||
| 14 | + | ||
| 15 | + factory OrderEntity.fromJson(Map<String, dynamic> json) => | ||
| 16 | + $OrderEntityFromJson(json); | ||
| 17 | + | ||
| 18 | + Map<String, dynamic> toJson() => $OrderEntityToJson(this); | ||
| 19 | + | ||
| 20 | + @override | ||
| 21 | + String toString() { | ||
| 22 | + return jsonEncode(this); | ||
| 23 | + } | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +@JsonSerializable() | ||
| 27 | +class OrderData { | ||
| 28 | + @JSONField(name: "order_sn") | ||
| 29 | + String? orderSn; | ||
| 30 | + | ||
| 31 | + OrderData(); | ||
| 32 | + | ||
| 33 | + factory OrderData.fromJson(Map<String, dynamic> json) => | ||
| 34 | + $OrderDataFromJson(json); | ||
| 35 | + | ||
| 36 | + Map<String, dynamic> toJson() => $OrderDataToJson(this); | ||
| 37 | + | ||
| 38 | + @override | ||
| 39 | + String toString() { | ||
| 40 | + return jsonEncode(this); | ||
| 41 | + } | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +@JsonSerializable() | ||
| 45 | +class OrderError { | ||
| 46 | + OrderError(); | ||
| 47 | + | ||
| 48 | + factory OrderError.fromJson(Map<String, dynamic> json) => | ||
| 49 | + $OrderErrorFromJson(json); | ||
| 50 | + | ||
| 51 | + Map<String, dynamic> toJson() => $OrderErrorToJson(this); | ||
| 52 | + | ||
| 53 | + @override | ||
| 54 | + String toString() { | ||
| 55 | + return jsonEncode(this); | ||
| 56 | + } | ||
| 57 | +} |
lib/membership/models/pay_entity.dart
0 → 100644
| 1 | +import 'dart:convert'; | ||
| 2 | +import 'package:Parlando/generated/json/base/json_field.dart'; | ||
| 3 | +import 'package:Parlando/generated/json/pay_entity.g.dart'; | ||
| 4 | + | ||
| 5 | +@JsonSerializable() | ||
| 6 | +class PayEntity { | ||
| 7 | + String? status; | ||
| 8 | + int? code; | ||
| 9 | + String? message; | ||
| 10 | + PayData? data; | ||
| 11 | + PayError? error; | ||
| 12 | + | ||
| 13 | + PayEntity(); | ||
| 14 | + | ||
| 15 | + factory PayEntity.fromJson(Map<String, dynamic> json) => | ||
| 16 | + $PayEntityFromJson(json); | ||
| 17 | + | ||
| 18 | + Map<String, dynamic> toJson() => $PayEntityToJson(this); | ||
| 19 | + | ||
| 20 | + @override | ||
| 21 | + String toString() { | ||
| 22 | + return jsonEncode(this); | ||
| 23 | + } | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +@JsonSerializable() | ||
| 27 | +class PayData { | ||
| 28 | + String? id; | ||
| 29 | + String? intent; | ||
| 30 | + String? status; | ||
| 31 | + @JSONField(name: "purchase_units") | ||
| 32 | + List<PayDataPurchaseUnits>? purchaseUnits; | ||
| 33 | + @JSONField(name: "create_time") | ||
| 34 | + String? createTime; | ||
| 35 | + List<PayDataLinks>? links; | ||
| 36 | + | ||
| 37 | + PayData(); | ||
| 38 | + | ||
| 39 | + factory PayData.fromJson(Map<String, dynamic> json) => $PayDataFromJson(json); | ||
| 40 | + | ||
| 41 | + Map<String, dynamic> toJson() => $PayDataToJson(this); | ||
| 42 | + | ||
| 43 | + @override | ||
| 44 | + String toString() { | ||
| 45 | + return jsonEncode(this); | ||
| 46 | + } | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +@JsonSerializable() | ||
| 50 | +class PayDataPurchaseUnits { | ||
| 51 | + @JSONField(name: "reference_id") | ||
| 52 | + String? referenceId; | ||
| 53 | + PayDataPurchaseUnitsAmount? amount; | ||
| 54 | + PayDataPurchaseUnitsPayee? payee; | ||
| 55 | + String? description; | ||
| 56 | + @JSONField(name: "custom_id") | ||
| 57 | + String? customId; | ||
| 58 | + @JSONField(name: "soft_descriptor") | ||
| 59 | + String? softDescriptor; | ||
| 60 | + | ||
| 61 | + PayDataPurchaseUnits(); | ||
| 62 | + | ||
| 63 | + factory PayDataPurchaseUnits.fromJson(Map<String, dynamic> json) => | ||
| 64 | + $PayDataPurchaseUnitsFromJson(json); | ||
| 65 | + | ||
| 66 | + Map<String, dynamic> toJson() => $PayDataPurchaseUnitsToJson(this); | ||
| 67 | + | ||
| 68 | + @override | ||
| 69 | + String toString() { | ||
| 70 | + return jsonEncode(this); | ||
| 71 | + } | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +@JsonSerializable() | ||
| 75 | +class PayDataPurchaseUnitsAmount { | ||
| 76 | + @JSONField(name: "currency_code") | ||
| 77 | + String? currencyCode; | ||
| 78 | + String? value; | ||
| 79 | + | ||
| 80 | + PayDataPurchaseUnitsAmount(); | ||
| 81 | + | ||
| 82 | + factory PayDataPurchaseUnitsAmount.fromJson(Map<String, dynamic> json) => | ||
| 83 | + $PayDataPurchaseUnitsAmountFromJson(json); | ||
| 84 | + | ||
| 85 | + Map<String, dynamic> toJson() => $PayDataPurchaseUnitsAmountToJson(this); | ||
| 86 | + | ||
| 87 | + @override | ||
| 88 | + String toString() { | ||
| 89 | + return jsonEncode(this); | ||
| 90 | + } | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +@JsonSerializable() | ||
| 94 | +class PayDataPurchaseUnitsPayee { | ||
| 95 | + @JSONField(name: "email_address") | ||
| 96 | + String? emailAddress; | ||
| 97 | + @JSONField(name: "merchant_id") | ||
| 98 | + String? merchantId; | ||
| 99 | + | ||
| 100 | + PayDataPurchaseUnitsPayee(); | ||
| 101 | + | ||
| 102 | + factory PayDataPurchaseUnitsPayee.fromJson(Map<String, dynamic> json) => | ||
| 103 | + $PayDataPurchaseUnitsPayeeFromJson(json); | ||
| 104 | + | ||
| 105 | + Map<String, dynamic> toJson() => $PayDataPurchaseUnitsPayeeToJson(this); | ||
| 106 | + | ||
| 107 | + @override | ||
| 108 | + String toString() { | ||
| 109 | + return jsonEncode(this); | ||
| 110 | + } | ||
| 111 | +} | ||
| 112 | + | ||
| 113 | +@JsonSerializable() | ||
| 114 | +class PayDataLinks { | ||
| 115 | + String? href; | ||
| 116 | + String? rel; | ||
| 117 | + String? method; | ||
| 118 | + | ||
| 119 | + PayDataLinks(); | ||
| 120 | + | ||
| 121 | + factory PayDataLinks.fromJson(Map<String, dynamic> json) => | ||
| 122 | + $PayDataLinksFromJson(json); | ||
| 123 | + | ||
| 124 | + Map<String, dynamic> toJson() => $PayDataLinksToJson(this); | ||
| 125 | + | ||
| 126 | + @override | ||
| 127 | + String toString() { | ||
| 128 | + return jsonEncode(this); | ||
| 129 | + } | ||
| 130 | +} | ||
| 131 | + | ||
| 132 | +@JsonSerializable() | ||
| 133 | +class PayError { | ||
| 134 | + PayError(); | ||
| 135 | + | ||
| 136 | + factory PayError.fromJson(Map<String, dynamic> json) => | ||
| 137 | + $PayErrorFromJson(json); | ||
| 138 | + | ||
| 139 | + Map<String, dynamic> toJson() => $PayErrorToJson(this); | ||
| 140 | + | ||
| 141 | + @override | ||
| 142 | + String toString() { | ||
| 143 | + return jsonEncode(this); | ||
| 144 | + } | ||
| 145 | +} |
| 1 | import 'dart:ui'; | 1 | import 'dart:ui'; |
| 2 | 2 | ||
| 3 | +import 'package:Parlando/apis/api_response.dart'; | ||
| 4 | +import 'package:Parlando/login/login_router.dart'; | ||
| 5 | +import 'package:Parlando/membership/models/membership_entity.dart'; | ||
| 6 | +import 'package:Parlando/membership/models/order_entity.dart'; | ||
| 7 | +import 'package:Parlando/membership/models/pay_entity.dart'; | ||
| 8 | +import 'package:Parlando/membership/view_models/membership_view_model.dart'; | ||
| 9 | +import 'package:Parlando/net/dio_utils.dart'; | ||
| 10 | +import 'package:Parlando/net/http_api.dart'; | ||
| 11 | +import 'package:Parlando/res/constant.dart'; | ||
| 12 | +import 'package:cached_network_image/cached_network_image.dart'; | ||
| 13 | +import 'package:flustars/flustars.dart'; | ||
| 3 | import 'package:flutter/material.dart'; | 14 | import 'package:flutter/material.dart'; |
| 4 | import 'package:Parlando/res/resources.dart'; | 15 | import 'package:Parlando/res/resources.dart'; |
| 5 | import 'package:Parlando/routers/fluro_navigator.dart'; | 16 | import 'package:Parlando/routers/fluro_navigator.dart'; |
| 6 | import 'package:Parlando/extension/int_extension.dart'; | 17 | import 'package:Parlando/extension/int_extension.dart'; |
| 7 | import 'package:Parlando/util/toast_utils.dart'; | 18 | import 'package:Parlando/util/toast_utils.dart'; |
| 19 | +import 'package:flutter_braintree/flutter_braintree.dart'; | ||
| 20 | +import 'package:provider/provider.dart'; | ||
| 8 | 21 | ||
| 9 | class MembershipPage extends StatefulWidget { | 22 | class MembershipPage extends StatefulWidget { |
| 10 | const MembershipPage({Key? key}) : super(key: key); | 23 | const MembershipPage({Key? key}) : super(key: key); |
| 11 | 24 | ||
| 12 | @override | 25 | @override |
| 13 | - _MembershipPageState createState() => _MembershipPageState(); | 26 | + MembershipPageState createState() => MembershipPageState(); |
| 14 | } | 27 | } |
| 15 | 28 | ||
| 16 | -class _MembershipPageState extends State<MembershipPage> | 29 | +class MembershipPageState extends State<MembershipPage> |
| 17 | with WidgetsBindingObserver { | 30 | with WidgetsBindingObserver { |
| 31 | + bool _isLoading = false; | ||
| 32 | + | ||
| 18 | @override | 33 | @override |
| 19 | void initState() { | 34 | void initState() { |
| 20 | super.initState(); | 35 | super.initState(); |
| 36 | + if (SpUtil.containsKey(Constant.userToken)!) { | ||
| 37 | + Provider.of<MembershipViewProvider>(context, listen: false) | ||
| 38 | + .setSelectedMembership(null); | ||
| 39 | + Provider.of<MembershipViewProvider>(context, listen: false) | ||
| 40 | + .fetchMembershipData('0'); | ||
| 41 | + } else { | ||
| 42 | + NavigatorUtils.push(context, LoginRouter.loginPage, replace: true); | ||
| 43 | + } | ||
| 21 | } | 44 | } |
| 22 | 45 | ||
| 23 | @override | 46 | @override |
| 24 | Widget build(BuildContext context) { | 47 | Widget build(BuildContext context) { |
| 48 | + ApiResponse apiResponse = | ||
| 49 | + Provider.of<MembershipViewProvider>(context).response; | ||
| 50 | + switch (apiResponse.status) { | ||
| 51 | + case Status.LOADING: | ||
| 52 | + return const Center(child: CircularProgressIndicator()); | ||
| 53 | + case Status.COMPLETED: | ||
| 54 | + MembershipData mb = apiResponse.data as MembershipData; | ||
| 25 | return SafeArea( | 55 | return SafeArea( |
| 26 | child: Scaffold( | 56 | child: Scaffold( |
| 27 | backgroundColor: Colors.black, | 57 | backgroundColor: Colors.black, |
| 28 | body: Container( | 58 | body: Container( |
| 29 | alignment: Alignment.topCenter, | 59 | alignment: Alignment.topCenter, |
| 30 | - decoration: const BoxDecoration( | 60 | + decoration: BoxDecoration( |
| 31 | image: DecorationImage( | 61 | image: DecorationImage( |
| 32 | - image: AssetImage("assets/images/membership/membership_bg.png"), | 62 | + image: CachedNetworkImageProvider(mb.bgImages!), |
| 33 | fit: BoxFit.fill, | 63 | fit: BoxFit.fill, |
| 34 | ), | 64 | ), |
| 35 | ), | 65 | ), |
| ... | @@ -50,8 +80,8 @@ class _MembershipPageState extends State<MembershipPage> | ... | @@ -50,8 +80,8 @@ class _MembershipPageState extends State<MembershipPage> |
| 50 | ), | 80 | ), |
| 51 | const Spacer(), | 81 | const Spacer(), |
| 52 | Container( | 82 | Container( |
| 53 | - margin: | 83 | + margin: EdgeInsets.symmetric( |
| 54 | - EdgeInsets.symmetric(vertical: 60.px, horizontal: 20.px), | 84 | + vertical: 60.px, horizontal: 20.px), |
| 55 | height: MediaQuery.of(context).size.height / 2, | 85 | height: MediaQuery.of(context).size.height / 2, |
| 56 | width: double.infinity, | 86 | width: double.infinity, |
| 57 | decoration: BoxDecoration( | 87 | decoration: BoxDecoration( |
| ... | @@ -77,7 +107,7 @@ class _MembershipPageState extends State<MembershipPage> | ... | @@ -77,7 +107,7 @@ class _MembershipPageState extends State<MembershipPage> |
| 77 | crossAxisAlignment: CrossAxisAlignment.center, | 107 | crossAxisAlignment: CrossAxisAlignment.center, |
| 78 | children: [ | 108 | children: [ |
| 79 | Text( | 109 | Text( |
| 80 | - "成为一言会员,将可以享受会员专属临境体验。", | 110 | + mb.title!, |
| 81 | style: TextStyle( | 111 | style: TextStyle( |
| 82 | fontSize: 18.px, | 112 | fontSize: 18.px, |
| 83 | color: Colors.white, | 113 | color: Colors.white, |
| ... | @@ -89,14 +119,14 @@ class _MembershipPageState extends State<MembershipPage> | ... | @@ -89,14 +119,14 @@ class _MembershipPageState extends State<MembershipPage> |
| 89 | child: ListView.builder( | 119 | child: ListView.builder( |
| 90 | itemExtent: 48.0, | 120 | itemExtent: 48.0, |
| 91 | itemBuilder: (_, index) { | 121 | itemBuilder: (_, index) { |
| 92 | - return _buildItem(index); | 122 | + return _buildItem(mb.goodsList![index]); |
| 93 | }, | 123 | }, |
| 94 | - itemCount: 5, | 124 | + itemCount: mb.goodsList!.length, |
| 95 | ), | 125 | ), |
| 96 | ), | 126 | ), |
| 97 | Gaps.vGap24, | 127 | Gaps.vGap24, |
| 98 | Text( | 128 | Text( |
| 99 | - "遇到任何问题,请在微信中关注“一言临境”公众号", | 129 | + mb.intro!, |
| 100 | style: TextStyle( | 130 | style: TextStyle( |
| 101 | fontSize: 14.px, | 131 | fontSize: 14.px, |
| 102 | color: Colors.white, | 132 | color: Colors.white, |
| ... | @@ -104,7 +134,8 @@ class _MembershipPageState extends State<MembershipPage> | ... | @@ -104,7 +134,8 @@ class _MembershipPageState extends State<MembershipPage> |
| 104 | ), | 134 | ), |
| 105 | Gaps.vGap10, | 135 | Gaps.vGap10, |
| 106 | Row( | 136 | Row( |
| 107 | - mainAxisAlignment: MainAxisAlignment.spaceBetween, | 137 | + mainAxisAlignment: |
| 138 | + MainAxisAlignment.spaceBetween, | ||
| 108 | mainAxisSize: MainAxisSize.min, | 139 | mainAxisSize: MainAxisSize.min, |
| 109 | crossAxisAlignment: CrossAxisAlignment.center, | 140 | crossAxisAlignment: CrossAxisAlignment.center, |
| 110 | children: [ | 141 | children: [ |
| ... | @@ -162,27 +193,37 @@ class _MembershipPageState extends State<MembershipPage> | ... | @@ -162,27 +193,37 @@ class _MembershipPageState extends State<MembershipPage> |
| 162 | ), | 193 | ), |
| 163 | ), | 194 | ), |
| 164 | ); | 195 | ); |
| 196 | + case Status.ERROR: | ||
| 197 | + return Center( | ||
| 198 | + child: Text('暂时无法获取数据,请稍候再试!${apiResponse.message}'), | ||
| 199 | + ); | ||
| 200 | + case Status.INITIAL: | ||
| 201 | + default: | ||
| 202 | + return const Center( | ||
| 203 | + child: Text('正在获取数据....'), | ||
| 204 | + ); | ||
| 205 | + } | ||
| 165 | } | 206 | } |
| 166 | 207 | ||
| 167 | - Widget _buildItem(int index) { | 208 | + Widget _buildItem(MembershipDataGoodsList goods) { |
| 168 | return Flex( | 209 | return Flex( |
| 169 | direction: Axis.horizontal, | 210 | direction: Axis.horizontal, |
| 170 | children: [ | 211 | children: [ |
| 171 | - const Text( | 212 | + Text( |
| 172 | - "一个月", | 213 | + goods.name!, |
| 173 | - style: TextStyle( | 214 | + style: const TextStyle( |
| 174 | color: Colors.white, | 215 | color: Colors.white, |
| 175 | fontSize: 15.0, | 216 | fontSize: 15.0, |
| 176 | ), | 217 | ), |
| 177 | ), | 218 | ), |
| 178 | Gaps.hGap10, | 219 | Gaps.hGap10, |
| 179 | - const Expanded( | 220 | + Expanded( |
| 180 | flex: 1, | 221 | flex: 1, |
| 181 | child: Align( | 222 | child: Align( |
| 182 | alignment: Alignment.centerRight, | 223 | alignment: Alignment.centerRight, |
| 183 | child: Text( | 224 | child: Text( |
| 184 | - "99¥", | 225 | + goods.price!, |
| 185 | - style: TextStyle( | 226 | + style: const TextStyle( |
| 186 | color: Colors.white, | 227 | color: Colors.white, |
| 187 | fontSize: 15.0, | 228 | fontSize: 15.0, |
| 188 | ), | 229 | ), |
| ... | @@ -196,13 +237,58 @@ class _MembershipPageState extends State<MembershipPage> | ... | @@ -196,13 +237,58 @@ class _MembershipPageState extends State<MembershipPage> |
| 196 | style: TextStyle(color: Colors.white, fontSize: 15.0), | 237 | style: TextStyle(color: Colors.white, fontSize: 15.0), |
| 197 | ), | 238 | ), |
| 198 | onPressed: () { | 239 | onPressed: () { |
| 199 | - Toast.show("开通啦!"); | 240 | + DioUtils.instance.requestNetwork<OrderEntity>( |
| 241 | + Method.post, | ||
| 242 | + HttpApi.order, | ||
| 243 | + params: {'goods_id': goods.id}, | ||
| 244 | + onSuccess: (data) { | ||
| 245 | + String orderSn = data!.data!.orderSn!; | ||
| 246 | + DioUtils.instance.requestNetwork<PayEntity>( | ||
| 247 | + Method.get, | ||
| 248 | + "${HttpApi.pay}?order_sn=$orderSn&pay_type=paypal", | ||
| 249 | + params: [], | ||
| 250 | + onSuccess: (data) { | ||
| 251 | + String id = data!.data!.id!; | ||
| 252 | + payPalRequest(id); | ||
| 253 | + _isLoading = false; | ||
| 254 | + }, | ||
| 255 | + onError: (code, msg) { | ||
| 256 | + Toast.show(msg.toString()); | ||
| 257 | + _isLoading = false; | ||
| 258 | + setState(() {}); | ||
| 259 | + }, | ||
| 260 | + ); | ||
| 261 | + _isLoading = false; | ||
| 262 | + }, | ||
| 263 | + onError: (code, msg) { | ||
| 264 | + Toast.show(msg.toString()); | ||
| 265 | + _isLoading = false; | ||
| 266 | + setState(() {}); | ||
| 267 | + }, | ||
| 268 | + ); | ||
| 200 | }, | 269 | }, |
| 201 | ), | 270 | ), |
| 202 | ], | 271 | ], |
| 203 | ); | 272 | ); |
| 204 | } | 273 | } |
| 205 | 274 | ||
| 275 | + Future<void> payPalRequest(String key) async { | ||
| 276 | + final request = BraintreePayPalRequest( | ||
| 277 | + amount: '0.01', | ||
| 278 | + currencyCode: 'CNY', | ||
| 279 | + billingAgreementDescription: '贝宝支付很无敌', | ||
| 280 | + ); | ||
| 281 | + BraintreePaymentMethodNonce? result = await Braintree.requestPaypalNonce( | ||
| 282 | + key, | ||
| 283 | + request, | ||
| 284 | + ); | ||
| 285 | + if (result != null) { | ||
| 286 | + print('Nonce: ${result.nonce}'); | ||
| 287 | + } else { | ||
| 288 | + print('PayPal flow was canceled.'); | ||
| 289 | + } | ||
| 290 | + } | ||
| 291 | + | ||
| 206 | @override | 292 | @override |
| 207 | void didChangeAppLifecycleState(AppLifecycleState state) {} | 293 | void didChangeAppLifecycleState(AppLifecycleState state) {} |
| 208 | 294 | ... | ... |
| 1 | +import 'package:Parlando/apis/api_response.dart'; | ||
| 2 | +import 'package:Parlando/membership/models/membership_entity.dart'; | ||
| 3 | +import 'package:Parlando/net/dio_utils.dart'; | ||
| 4 | +import 'package:Parlando/net/http_api.dart'; | ||
| 5 | +import 'package:flutter/material.dart'; | ||
| 6 | + | ||
| 7 | +class MembershipViewProvider with ChangeNotifier { | ||
| 8 | + ApiResponse _apiResponse = ApiResponse.initial('Empty data'); | ||
| 9 | + MembershipData? _membership; | ||
| 10 | + | ||
| 11 | + ApiResponse get response { | ||
| 12 | + return _apiResponse; | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + MembershipData? get media { | ||
| 16 | + return _membership; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + Future<void> fetchMembershipData(String value) async { | ||
| 20 | + _apiResponse = ApiResponse.loading('请求数据中...'); | ||
| 21 | + DioUtils.instance.asyncRequestNetwork<MembershipEntity>( | ||
| 22 | + Method.get, | ||
| 23 | + HttpApi.membership, | ||
| 24 | + onSuccess: (data) { | ||
| 25 | + _apiResponse = ApiResponse.completed(data!.data); | ||
| 26 | + notifyListeners(); | ||
| 27 | + }, | ||
| 28 | + onError: (code, msg) { | ||
| 29 | + _apiResponse = ApiResponse.error(msg); | ||
| 30 | + notifyListeners(); | ||
| 31 | + }, | ||
| 32 | + ); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + void setSelectedMembership(MembershipData? membership) { | ||
| 36 | + _membership = membership; | ||
| 37 | + // notifyListeners(); | ||
| 38 | + } | ||
| 39 | +} |
| ... | @@ -9,11 +9,14 @@ class HttpApi { | ... | @@ -9,11 +9,14 @@ class HttpApi { |
| 9 | static const String immersive = 'immersive'; | 9 | static const String immersive = 'immersive'; |
| 10 | static const String avatar = 'avatar'; | 10 | static const String avatar = 'avatar'; |
| 11 | static const String user = 'user'; | 11 | static const String user = 'user'; |
| 12 | + static const String membership = 'membership'; | ||
| 12 | static const String home = 'home'; | 13 | static const String home = 'home'; |
| 13 | static const String myVideos = '/my/videos'; | 14 | static const String myVideos = '/my/videos'; |
| 14 | static const String praise = '/praise'; | 15 | static const String praise = '/praise'; |
| 15 | static const String addView = '/addview'; | 16 | static const String addView = '/addview'; |
| 16 | static const String collect = '/collect'; | 17 | static const String collect = '/collect'; |
| 18 | + static const String order = '/order'; | ||
| 19 | + static const String pay = '/pay'; | ||
| 17 | static const String search = 'search/repositories'; | 20 | static const String search = 'search/repositories'; |
| 18 | static const String subscriptions = 'users/simplezhli/subscriptions'; | 21 | static const String subscriptions = 'users/simplezhli/subscriptions'; |
| 19 | static const String upload = 'uuc/upload-inco'; | 22 | static const String upload = 'uuc/upload-inco'; | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -108,11 +108,13 @@ dependencies: | ... | @@ -108,11 +108,13 @@ dependencies: |
| 108 | email_validator: ^2.0.1 | 108 | email_validator: ^2.0.1 |
| 109 | 109 | ||
| 110 | getwidget: ^2.0.5 | 110 | getwidget: ^2.0.5 |
| 111 | - sign_in_with_apple: ^3.3.0 | 111 | + sign_in_with_apple: ^4.0.0 |
| 112 | event_bus: ^2.0.0 | 112 | event_bus: ^2.0.0 |
| 113 | 113 | ||
| 114 | animated_radial_menu: ^0.0.1 | 114 | animated_radial_menu: ^0.0.1 |
| 115 | 115 | ||
| 116 | + flutter_braintree: ^2.3.1 | ||
| 117 | + | ||
| 116 | dependency_overrides: | 118 | dependency_overrides: |
| 117 | decimal: 1.5.0 | 119 | decimal: 1.5.0 |
| 118 | 120 | ... | ... |
-
Please register or login to post a comment