select_estate_state.dart 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import 'package:cs_resources/generated/l10n.dart';
  2. import 'package:domain/entity/id_name_entity.dart';
  3. import 'package:flutter/material.dart';
  4. class SelectEstateState {
  5. //表单的校验与数据
  6. final Map<String, Map<String, dynamic>> formData;
  7. List<IdNameEntity>? estateList; //第一步的下拉选房产数据源
  8. IdNameEntity? selectedEstate; //第一步数据:已经选中的房产
  9. String? block; //第二步数据:已经选中的Block
  10. String? unit; //第二步数据:已经选中的单元
  11. String? room; //第二步数据:已经选中的单元-房间
  12. String? type; //第三步数据:已经选中的类型
  13. // =================================== Begin ↓ ===================================
  14. SelectEstateState({
  15. this.estateList,
  16. this.selectedEstate,
  17. this.block,
  18. this.unit,
  19. this.room,
  20. this.type,
  21. Map<String, Map<String, dynamic>>? formData,
  22. }) : formData = formData ??
  23. {
  24. 'estate': {
  25. 'value': '',
  26. 'controller': TextEditingController(),
  27. 'hintText': S.current.type_here,
  28. 'focusNode': FocusNode(),
  29. 'obsecure': false,
  30. },
  31. };
  32. SelectEstateState copyWith({
  33. double? remainingSpace,
  34. List<IdNameEntity>? estateList,
  35. IdNameEntity? selectedEstate,
  36. String? block,
  37. String? unit,
  38. String? room,
  39. String? type,
  40. }) {
  41. return SelectEstateState(
  42. estateList: estateList ?? this.estateList,
  43. selectedEstate: selectedEstate ?? this.selectedEstate,
  44. block: block ?? this.block,
  45. unit: unit ?? this.unit,
  46. room: room ?? this.room,
  47. type: type ?? this.type,
  48. formData: this.formData,
  49. );
  50. }
  51. }