property_news_state.dart 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /// YApi QuickType插件生成,具体参考文档:https://plugins.jetbrains.com/plugin/18847-yapi-quicktype/documentation
  2. import 'dart:convert';
  3. import 'package:widgets/load_state_layout.dart';
  4. class PropertyNewsState {
  5. //页面 LoadView 状态的展示
  6. LoadState loadingState;
  7. String? errorMessage;
  8. int? curPage;
  9. int? pageSize = 10;
  10. int? filterCount = 1;
  11. List<Map<String, dynamic>> list;
  12. PropertyNewsState({
  13. this.loadingState = LoadState.State_Loading,
  14. String? errorMessage,
  15. this.curPage = 1,
  16. this.pageSize = 10,
  17. this.filterCount = 1,
  18. required this.list,
  19. });
  20. Map<String, dynamic> toMap() {
  21. return {
  22. 'loadingState': this.loadingState,
  23. 'errorMessage': this.errorMessage,
  24. 'curPage': this.curPage,
  25. 'pageSize': this.pageSize,
  26. 'filterCount': this.filterCount,
  27. 'list': this.list,
  28. };
  29. }
  30. factory PropertyNewsState.fromMap(Map<String, dynamic> map) {
  31. return PropertyNewsState(
  32. loadingState: map['loadingState'] as LoadState,
  33. errorMessage: map['errorMessage'] as String,
  34. curPage: map['curPage'] as int,
  35. pageSize: map['pageSize'] as int,
  36. filterCount: map['filterCount'] as int,
  37. list: map['list'] as List<Map<String, dynamic>>,
  38. );
  39. }
  40. PropertyNewsState copyWith({
  41. LoadState? loadingState,
  42. String? errorMessage,
  43. int? curPage,
  44. int? pageSize,
  45. int? filterCount,
  46. List<Map<String, dynamic>>? list,
  47. }) {
  48. return PropertyNewsState(
  49. loadingState: loadingState ?? this.loadingState,
  50. errorMessage: errorMessage ?? this.errorMessage,
  51. curPage: curPage ?? this.curPage,
  52. pageSize: pageSize ?? this.pageSize,
  53. filterCount: filterCount ?? this.filterCount,
  54. list: list ?? this.list,
  55. );
  56. }
  57. }