following_state.dart 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import 'package:widgets/load_state_layout.dart';
  2. class FollowingState {
  3. //页面 LoadView 状态的展示
  4. LoadState loadingState;
  5. String? errorMessage;
  6. int? curPage;
  7. int? pageSize = 10;
  8. int? filterCount = 0;
  9. List<Map<String, dynamic>>? list = [];
  10. FollowingState({
  11. this.loadingState = LoadState.State_Loading,
  12. String? errorMessage,
  13. this.curPage = 1,
  14. this.pageSize = 10,
  15. this.filterCount = 0,
  16. this.list,
  17. });
  18. FollowingState copyWith({
  19. LoadState? loadingState,
  20. String? errorMessage,
  21. int? curPage,
  22. int? pageSize,
  23. int? filterCount,
  24. List<Map<String, dynamic>>? list,
  25. }) {
  26. return FollowingState(
  27. loadingState: loadingState ?? this.loadingState,
  28. errorMessage: errorMessage ?? this.errorMessage,
  29. curPage: curPage ?? this.curPage,
  30. pageSize: pageSize ?? this.pageSize,
  31. filterCount: filterCount ?? this.filterCount,
  32. list: list ?? this.list,
  33. );
  34. }
  35. Map<String, dynamic> toMap() {
  36. return {
  37. 'loadingState': this.loadingState,
  38. 'errorMessage': this.errorMessage,
  39. 'curPage': this.curPage,
  40. 'pageSize': this.pageSize,
  41. 'filterCount': this.filterCount,
  42. 'list': this.list,
  43. };
  44. }
  45. factory FollowingState.fromMap(Map<String, dynamic> map) {
  46. return FollowingState(
  47. loadingState: map['loadingState'] as LoadState,
  48. errorMessage: map['errorMessage'] as String,
  49. curPage: map['curPage'] as int,
  50. pageSize: map['pageSize'] as int,
  51. filterCount: map['filterCount'] as int,
  52. list: map['list'] as List<Map<String, dynamic>>,
  53. );
  54. }
  55. }