select_estate_state.dart 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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? address; //第二步选择的数据
  10. String? unitId; //第二步选择的数据
  11. String? type; //第三步数据:已经选中的类型
  12. // =================================== Begin ↓ ===================================
  13. SelectEstateState({
  14. this.estateList,
  15. this.selectedEstate,
  16. this.address,
  17. this.unitId,
  18. this.type,
  19. Map<String, Map<String, dynamic>>? formData,
  20. }) : formData = formData ??
  21. {
  22. 'estate': {
  23. 'value': '',
  24. 'controller': TextEditingController(),
  25. 'hintText': S.current.type_here,
  26. 'focusNode': FocusNode(),
  27. 'obsecure': false,
  28. },
  29. };
  30. SelectEstateState copyWith({
  31. double? remainingSpace,
  32. List<IdNameEntity>? estateList,
  33. IdNameEntity? selectedEstate,
  34. String? address,
  35. String? unitId,
  36. String? type,
  37. }) {
  38. return SelectEstateState(
  39. estateList: estateList ?? this.estateList,
  40. selectedEstate: selectedEstate ?? this.selectedEstate,
  41. address: address ?? this.address,
  42. unitId: unitId ?? this.unitId,
  43. type: type ?? this.type,
  44. formData: this.formData,
  45. );
  46. }
  47. }