select_unit_state.dart 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import 'package:flutter/material.dart';
  2. class SelectUnitState {
  3. //表单的校验与数据
  4. final Map<String, Map<String, dynamic>> formData;
  5. double remainingSpace;
  6. // =================================== Begin ↓ ===================================
  7. SelectUnitState({
  8. this.remainingSpace = 0,
  9. Map<String, Map<String, dynamic>>? formData,
  10. }) : formData = formData ??
  11. {
  12. 'block': {
  13. 'value': '',
  14. 'controller': TextEditingController(),
  15. 'hintText': '',
  16. 'focusNode': FocusNode(),
  17. 'obsecure': false,
  18. },
  19. 'unit': {
  20. 'value': '',
  21. 'controller': TextEditingController(),
  22. 'hintText': '',
  23. 'focusNode': FocusNode(),
  24. 'obsecure': false,
  25. },
  26. 'room': {
  27. 'value': '',
  28. 'controller': TextEditingController(),
  29. 'hintText': '',
  30. 'focusNode': FocusNode(),
  31. 'obsecure': false,
  32. },
  33. };
  34. SelectUnitState copyWith({
  35. double? remainingSpace,
  36. }) {
  37. return SelectUnitState(
  38. remainingSpace: remainingSpace ?? this.remainingSpace,
  39. );
  40. }
  41. }