rewards_redeem_state.dart 1.5 KB

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