rewards_confirm_state.dart 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /// YApi QuickType插件生成,具体参考文档:https://plugins.jetbrains.com/plugin/18847-yapi-quicktype/documentation
  2. import 'dart:convert';
  3. import 'package:domain/entity/rewards_detail_entity.dart';
  4. import 'package:widgets/load_state_layout.dart';
  5. class RewardsConfirmState {
  6. //页面 LoadView 状态的展示
  7. LoadState loadingState;
  8. String? errorMessage;
  9. RewardsDetailEntity? detailInfo;
  10. int? number=1;
  11. int? amount=0;
  12. RewardsConfirmState({
  13. this.loadingState = LoadState.State_Loading,
  14. String? errorMessage,
  15. this.number = 1,
  16. this.amount = 0,
  17. RewardsDetailEntity? detailInfo,
  18. }) : detailInfo = detailInfo ?? RewardsDetailEntity();
  19. RewardsConfirmState copyWith({
  20. LoadState? loadingState,
  21. String? errorMessage,
  22. int? number,
  23. int? amount,
  24. RewardsDetailEntity? detailInfo,
  25. }) {
  26. return RewardsConfirmState(
  27. loadingState: loadingState ?? this.loadingState,
  28. errorMessage: errorMessage ?? this.errorMessage,
  29. number: number ?? this.number,
  30. amount: amount ?? this.amount,
  31. detailInfo: detailInfo ?? this.detailInfo,
  32. );
  33. }
  34. Map<String, dynamic> toMap() {
  35. return {
  36. 'loadingState': this.loadingState,
  37. 'errorMessage': this.errorMessage,
  38. 'number': this.number,
  39. 'amount': this.amount,
  40. 'detailInfo': this.detailInfo,
  41. };
  42. }
  43. factory RewardsConfirmState.fromMap(Map<String, dynamic> map) {
  44. return RewardsConfirmState(
  45. loadingState: map['loadingState'] as LoadState,
  46. errorMessage: map['errorMessage'] as String,
  47. number: map['number'] as int,
  48. amount: map['amount'] as int,
  49. detailInfo: map['detailInfo'] as RewardsDetailEntity,
  50. );
  51. }
  52. }