rewards_transaction_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_detail_entity.dart';
  4. import 'package:domain/entity/rewards_my_detail_entity.dart';
  5. import 'package:widgets/load_state_layout.dart';
  6. class RewardsTransactionState {
  7. //页面 LoadView 状态的展示
  8. LoadState loadingState;
  9. String? errorMessage;
  10. RewardsMyDetailEntity? detailInfo;
  11. RewardsTransactionState({
  12. this.loadingState = LoadState.State_Loading,
  13. String? errorMessage,
  14. RewardsMyDetailEntity? detailInfo,
  15. }) : detailInfo = detailInfo ?? RewardsMyDetailEntity();
  16. RewardsTransactionState copyWith({
  17. LoadState? loadingState,
  18. String? errorMessage,
  19. RewardsMyDetailEntity? detailInfo,
  20. }) {
  21. return RewardsTransactionState(
  22. loadingState: loadingState ?? this.loadingState,
  23. errorMessage: errorMessage ?? this.errorMessage,
  24. detailInfo: detailInfo ?? this.detailInfo,
  25. );
  26. }
  27. Map<String, dynamic> toMap() {
  28. return {
  29. 'loadingState': this.loadingState,
  30. 'errorMessage': this.errorMessage,
  31. 'detailInfo': this.detailInfo,
  32. };
  33. }
  34. factory RewardsTransactionState.fromMap(Map<String, dynamic> map) {
  35. return RewardsTransactionState(
  36. loadingState: map['loadingState'] as LoadState,
  37. errorMessage: map['errorMessage'] as String,
  38. detailInfo: map['detailInfo'] as RewardsMyDetailEntity,
  39. );
  40. }
  41. }