following_state.dart 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import 'package:widgets/load_state_layout.dart';
  2. class FollowingState {
  3. //页面 LoadView 状态的展示
  4. LoadState loadingState;
  5. String? errorMessage;
  6. List<Map<String, dynamic>>? list = [];
  7. FollowingState({
  8. this.loadingState = LoadState.State_Loading,
  9. String? errorMessage,
  10. this.list,
  11. });
  12. FollowingState copyWith({
  13. LoadState? loadingState,
  14. String? errorMessage,
  15. int? page,
  16. int? limit,
  17. int? count,
  18. List<Map<String, dynamic>>? list,
  19. }) {
  20. return FollowingState(
  21. loadingState: loadingState ?? this.loadingState,
  22. errorMessage: errorMessage ?? this.errorMessage,
  23. list: list ?? this.list,
  24. );
  25. }
  26. Map<String, dynamic> toMap() {
  27. return {
  28. 'loadingState': this.loadingState,
  29. 'errorMessage': this.errorMessage,
  30. 'list': this.list,
  31. };
  32. }
  33. factory FollowingState.fromMap(Map<String, dynamic> map) {
  34. return FollowingState(
  35. loadingState: map['loadingState'] as LoadState,
  36. errorMessage: map['errorMessage'] as String,
  37. list: map['list'] as List<Map<String, dynamic>>,
  38. );
  39. }
  40. }