documents_state.dart 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 DocumentsState {
  5. //页面 LoadView 状态的展示
  6. LoadState loadingState;
  7. String? errorMessage;
  8. int? page;
  9. int? limit = 10;
  10. int? count = 1;
  11. List<Map<String, dynamic>>? list;
  12. DocumentsState({
  13. this.loadingState = LoadState.State_Loading,
  14. String? errorMessage,
  15. this.page = 1,
  16. this.limit = 10,
  17. this.count = 1,
  18. required this.list,
  19. });
  20. DocumentsState copyWith({
  21. LoadState? loadingState,
  22. String? errorMessage,
  23. int? page,
  24. int? limit,
  25. int? count,
  26. List<Map<String, dynamic>>? list,
  27. }) {
  28. return DocumentsState(
  29. loadingState: loadingState ?? this.loadingState,
  30. errorMessage: errorMessage ?? this.errorMessage,
  31. page: page ?? this.page,
  32. limit: limit ?? this.limit,
  33. count: count ?? this.count,
  34. list: list ?? this.list,
  35. );
  36. }
  37. Map<String, dynamic> toMap() {
  38. return {
  39. 'page': this.page,
  40. 'limit': this.limit,
  41. 'count': this.count,
  42. 'list': this.list,
  43. };
  44. }
  45. factory DocumentsState.fromMap(Map<String, dynamic> map) {
  46. return DocumentsState(
  47. page: map['page'] as int,
  48. limit: map['limit'] as int,
  49. count: map['count'] as int,
  50. list: map['list'] as List<Map<String, dynamic>>,
  51. );
  52. }
  53. }