home_service_state.dart 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import 'package:domain/entity/paid_service_entity.dart';
  2. import 'package:widgets/load_state_layout.dart';
  3. import '../../../constants_services.dart';
  4. import 'home_service_vm.dart';
  5. class HomeServiceState {
  6. //页面 LoadView 状态的展示
  7. LoadState loadingState;
  8. String? errorMessage;
  9. String? keyword;
  10. bool? isLiked;
  11. String sort = defaultSortType.name;
  12. // contact type 类型选项
  13. final List<String> sortByOptionsList = servicesConstants.sortByOptionsMap.keys.toList();
  14. String? sortBySelectedOption;
  15. List<PaidServiceList> activeCateGoryList;
  16. List<PaidServiceList> list;
  17. HomeServiceState({
  18. this.loadingState = LoadState.State_Loading,
  19. String? errorMessage,
  20. this.keyword,
  21. this.isLiked,
  22. required this.sort,
  23. this.sortBySelectedOption ,
  24. this.activeCateGoryList = const [],
  25. required this.list,
  26. });
  27. HomeServiceState copyWith({
  28. LoadState? loadingState,
  29. String? errorMessage,
  30. String? keyword,
  31. bool? isLiked,
  32. String? sort,
  33. String? sortBySelectedOption,
  34. List<PaidServiceList>? activeCateGoryList,
  35. List<PaidServiceList>? list,
  36. }) {
  37. return HomeServiceState(
  38. loadingState: loadingState ?? this.loadingState,
  39. errorMessage: errorMessage ?? this.errorMessage,
  40. keyword: keyword ?? this.keyword,
  41. isLiked: isLiked ?? this.isLiked,
  42. sort: sort ?? this.sort,
  43. sortBySelectedOption: sortBySelectedOption ?? this.sortBySelectedOption,
  44. activeCateGoryList: activeCateGoryList ?? this.activeCateGoryList,
  45. list: list ?? this.list,
  46. );
  47. }
  48. }