services_main_state.dart 946 B

123456789101112131415161718192021222324252627282930313233343536
  1. import 'package:domain/entity/service_category_entity.dart';
  2. import 'package:widgets/load_state_layout.dart';
  3. class ServiceMainState {
  4. //页面 LoadView 状态的展示
  5. LoadState? loadingState;
  6. String? errorMessage;
  7. // getter curId
  8. int? get curId => curCategory?.id;
  9. final ServiceCategoryEntity? curCategory;
  10. List<ServiceCategoryEntity>? datas;
  11. ServiceMainState({
  12. this.loadingState = LoadState.State_Loading,
  13. this.errorMessage,
  14. this.curCategory,
  15. this.datas,
  16. });
  17. ServiceMainState copyWith({
  18. LoadState? loadingState,
  19. String? errorMessage,
  20. ServiceCategoryEntity? curCategory,
  21. List<ServiceCategoryEntity>? datas,
  22. }) {
  23. return ServiceMainState(
  24. loadingState: loadingState ?? this.loadingState,
  25. errorMessage: errorMessage ?? this.errorMessage,
  26. curCategory: curCategory ?? this.curCategory,
  27. datas: datas ?? this.datas,
  28. );
  29. }
  30. }