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