|
@@ -80,217 +80,232 @@ class LabourTemplateAddPage extends BaseStatelessPage<LabourTemplateAddControlle
|
|
|
child: SingleChildScrollView(
|
|
|
scrollDirection: Axis.vertical,
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
- child: Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- //模板名称
|
|
|
- FormRequireText(text: "Template Name".tr).marginOnly(left: 15, top: 19),
|
|
|
+ child: Obx(() {
|
|
|
|
|
|
- CustomTextField(
|
|
|
- formKey: "template_name",
|
|
|
- formData: state.formData,
|
|
|
- height: 46,
|
|
|
- fontSize: 14,
|
|
|
- onSubmit: (key, value) {
|
|
|
- state.formData[key]!['focusNode'].unfocus();
|
|
|
- FocusScope.of(context).requestFocus(state.formData['desc']!['focusNode']);
|
|
|
- },
|
|
|
- marginTop: 10,
|
|
|
- ),
|
|
|
+ return Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ //模板名称
|
|
|
+ FormRequireText(text: "Template Name".tr).marginOnly(left: 15, top: 19),
|
|
|
|
|
|
- //年龄
|
|
|
- MyTextView(
|
|
|
- "Age".tr,
|
|
|
- textColor: Colors.white,
|
|
|
- fontSize: 14,
|
|
|
- isFontRegular: true,
|
|
|
- marginLeft: 15,
|
|
|
- marginTop: 15,
|
|
|
- ),
|
|
|
+ CustomTextField(
|
|
|
+ formKey: "template_name",
|
|
|
+ formData: state.formData,
|
|
|
+ height: 46,
|
|
|
+ fontSize: 14,
|
|
|
+ onSubmit: (key, value) {
|
|
|
+ state.formData[key]!['focusNode'].unfocus();
|
|
|
+ FocusScope.of(context).requestFocus(state.formData['desc']!['focusNode']);
|
|
|
+ },
|
|
|
+ marginTop: 10,
|
|
|
+ ),
|
|
|
|
|
|
- // 年龄的多选
|
|
|
- CustomCheckBox(
|
|
|
- options: state.indexEntity?.ageList.map((e) => e.txt!).toList() ?? [],
|
|
|
- onOptionsSelected: (selected) {
|
|
|
- // 转换选中的索引为对应的 value
|
|
|
- state.selectedAgeList = selected
|
|
|
- .map((index) {
|
|
|
- return state.indexEntity?.ageList[index].value; // 获取对应的 value
|
|
|
- })
|
|
|
- .whereType<String>()
|
|
|
- .toList();
|
|
|
- },
|
|
|
- selectedOptions: state.indexEntity?.ageList.where((e) => e.checked == "checked").map((e) => e.txt!).toList() ?? [],
|
|
|
- ).marginOnly(left: 15, right: 15, top: 10),
|
|
|
+ //年龄
|
|
|
+ Visibility(
|
|
|
+ visible: state.indexEntity?.ageList.isNotEmpty == true,
|
|
|
+ child: MyTextView(
|
|
|
+ "Age".tr,
|
|
|
+ textColor: Colors.white,
|
|
|
+ fontSize: 14,
|
|
|
+ isFontRegular: true,
|
|
|
+ marginLeft: 15,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
|
|
|
- //性别
|
|
|
- MyTextView(
|
|
|
- "Gender".tr,
|
|
|
- textColor: Colors.white,
|
|
|
- fontSize: 14,
|
|
|
- isFontRegular: true,
|
|
|
- marginLeft: 15,
|
|
|
- marginTop: 15,
|
|
|
- ),
|
|
|
+ // 年龄的多选
|
|
|
+ Visibility(
|
|
|
+ visible: state.indexEntity?.ageList.isNotEmpty == true,
|
|
|
+ child: CustomCheckBox(
|
|
|
+ options: state.indexEntity?.ageList.map((e) => e.txt!).toList() ?? [],
|
|
|
+ onOptionsSelected: (selected) {
|
|
|
+ // 转换选中的索引为对应的 value
|
|
|
+ state.selectedAgeList = selected
|
|
|
+ .map((index) {
|
|
|
+ return state.indexEntity?.ageList[index].value; // 获取对应的 value
|
|
|
+ })
|
|
|
+ .whereType<String>()
|
|
|
+ .toList();
|
|
|
+ },
|
|
|
+ selectedOptions: state.indexEntity?.ageList.where((e) => e.checked == "checked").map((e) => e.txt!).toList() ?? [],
|
|
|
+ ).marginOnly(left: 15, right: 15, top: 10),
|
|
|
+ ),
|
|
|
|
|
|
- //性别单选
|
|
|
- CustomRadioCheck(
|
|
|
- options: state.indexEntity?.sexList.map((e) => e.txt!).toList() ?? [],
|
|
|
- onOptionSelected: (index, text) {
|
|
|
- state.gender = state.indexEntity!.sexList[index].value;
|
|
|
- },
|
|
|
- selectedPosition: state.indexEntity?.sexList.indexWhere((e) => e.checked == "checked") ?? -1,
|
|
|
- ).marginOnly(left: 15, right: 15, top: 10),
|
|
|
+ //性别
|
|
|
+ Visibility(
|
|
|
+ visible: state.indexEntity?.sexList.isNotEmpty == true,
|
|
|
+ child: MyTextView(
|
|
|
+ "Gender".tr,
|
|
|
+ textColor: Colors.white,
|
|
|
+ fontSize: 14,
|
|
|
+ isFontRegular: true,
|
|
|
+ marginLeft: 15,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
|
|
|
- //语言
|
|
|
- MyTextView(
|
|
|
- "Language".tr,
|
|
|
- textColor: Colors.white,
|
|
|
- fontSize: 14,
|
|
|
- isFontRegular: true,
|
|
|
- marginLeft: 15,
|
|
|
- marginTop: 15,
|
|
|
- ),
|
|
|
+ //性别单选
|
|
|
+ Visibility(
|
|
|
+ visible: state.indexEntity?.sexList.isNotEmpty == true,
|
|
|
+ child: CustomRadioCheck(
|
|
|
+ options: state.indexEntity?.sexList.map((e) => e.txt!).toList() ?? [],
|
|
|
+ onOptionSelected: (index, text) {
|
|
|
+ state.gender = state.indexEntity!.sexList[index].value;
|
|
|
+ },
|
|
|
+ selectedPosition: state.indexEntity?.sexList.indexWhere((e) => e.checked == "checked") ?? -1,
|
|
|
+ ).marginOnly(left: 15, right: 15, top: 10),
|
|
|
+ ),
|
|
|
|
|
|
- // 语言的多选
|
|
|
- CustomCheckBox(
|
|
|
- options: state.indexEntity?.languageList.map((e) => e.txt!).toList() ?? [],
|
|
|
- onOptionsSelected: (selected) {
|
|
|
- // 转换选中的索引为对应的 value
|
|
|
- state.selectedLanguageList = selected
|
|
|
- .map((index) {
|
|
|
- return state.indexEntity?.languageList[index].value; // 获取对应的 value
|
|
|
- })
|
|
|
- .whereType<String>()
|
|
|
- .toList();
|
|
|
- },
|
|
|
- selectedOptions: state.indexEntity?.languageList.where((e) => e.checked == "checked").map((e) => e.txt!).toList() ?? [],
|
|
|
- ).marginOnly(left: 15, right: 15, top: 10),
|
|
|
+ //语言
|
|
|
+ MyTextView(
|
|
|
+ "Language".tr,
|
|
|
+ textColor: Colors.white,
|
|
|
+ fontSize: 14,
|
|
|
+ isFontRegular: true,
|
|
|
+ marginLeft: 15,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
|
|
|
+ // 语言的多选 (使用 Obx 刷新)
|
|
|
+ CustomCheckBox(
|
|
|
+ options: state.optionLanguageList.value,
|
|
|
+ onOptionsSelected: (selected) {
|
|
|
+ // 转换选中的索引为对应的 value
|
|
|
+ state.selectedLanguageList = selected
|
|
|
+ .map((index) {
|
|
|
+ return state.indexEntity?.languageList[index].value; // 获取对应的 value
|
|
|
+ })
|
|
|
+ .whereType<String>()
|
|
|
+ .toList();
|
|
|
+ },
|
|
|
+ selectedOptions: state.indexEntity?.languageList.where((e) => e.checked == "checked").map((e) => e.txt!).toList() ?? [],
|
|
|
+ ).marginOnly(left: 15, right: 15, top: 10),
|
|
|
|
|
|
- //模板详情
|
|
|
- MyTextView(
|
|
|
- "Description".tr,
|
|
|
- textColor: Colors.white,
|
|
|
- fontSize: 14,
|
|
|
- isFontRegular: true,
|
|
|
- marginLeft: 15,
|
|
|
- marginTop: 15,
|
|
|
- ),
|
|
|
+ //模板详情
|
|
|
+ MyTextView(
|
|
|
+ "Description".tr,
|
|
|
+ textColor: Colors.white,
|
|
|
+ fontSize: 14,
|
|
|
+ isFontRegular: true,
|
|
|
+ marginLeft: 15,
|
|
|
+ marginTop: 15,
|
|
|
+ ),
|
|
|
|
|
|
- IgnoreKeyboardDismiss(
|
|
|
- child: Container(
|
|
|
- height: 130,
|
|
|
- margin: const EdgeInsets.only(left: 15, right: 15, top: 10),
|
|
|
- padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: const Color(0xFF4DCFF6).withOpacity(0.2),
|
|
|
- borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
- ),
|
|
|
- child: TextField(
|
|
|
- cursorColor: ColorConstants.white,
|
|
|
- cursorWidth: 1.5,
|
|
|
- autofocus: false,
|
|
|
- enabled: true,
|
|
|
- focusNode: state.formData["desc"]!['focusNode'],
|
|
|
- controller: state.formData["desc"]!['controller'],
|
|
|
- // 装饰
|
|
|
- decoration: InputDecoration(
|
|
|
- isDense: true,
|
|
|
- isCollapsed: true,
|
|
|
- border: InputBorder.none,
|
|
|
- hintText: state.formData["desc"]!['hintText'],
|
|
|
- hintStyle: const TextStyle(
|
|
|
- color: ColorConstants.textGrayAECAE5,
|
|
|
+ IgnoreKeyboardDismiss(
|
|
|
+ child: Container(
|
|
|
+ height: 130,
|
|
|
+ margin: const EdgeInsets.only(left: 15, right: 15, top: 10),
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: TextField(
|
|
|
+ cursorColor: ColorConstants.white,
|
|
|
+ cursorWidth: 1.5,
|
|
|
+ autofocus: false,
|
|
|
+ enabled: true,
|
|
|
+ focusNode: state.formData["desc"]!['focusNode'],
|
|
|
+ controller: state.formData["desc"]!['controller'],
|
|
|
+ // 装饰
|
|
|
+ decoration: InputDecoration(
|
|
|
+ isDense: true,
|
|
|
+ isCollapsed: true,
|
|
|
+ border: InputBorder.none,
|
|
|
+ hintText: state.formData["desc"]!['hintText'],
|
|
|
+ hintStyle: const TextStyle(
|
|
|
+ color: ColorConstants.textGrayAECAE5,
|
|
|
+ fontSize: 15.0,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ style: const TextStyle(
|
|
|
+ color: ColorConstants.white,
|
|
|
fontSize: 15.0,
|
|
|
fontWeight: FontWeight.w400,
|
|
|
),
|
|
|
+ // 键盘动作右下角图标
|
|
|
+ textInputAction: TextInputAction.next,
|
|
|
+ onSubmitted: (value) {
|
|
|
+ state.formData[key]!['focusNode'].unfocus();
|
|
|
+ FocusScope.of(context).requestFocus(state.formData['contact']!['focusNode']);
|
|
|
+ },
|
|
|
),
|
|
|
- style: const TextStyle(
|
|
|
- color: ColorConstants.white,
|
|
|
- fontSize: 15.0,
|
|
|
- fontWeight: FontWeight.w400,
|
|
|
- ),
|
|
|
- // 键盘动作右下角图标
|
|
|
- textInputAction: TextInputAction.next,
|
|
|
- onSubmitted: (value) {
|
|
|
- state.formData[key]!['focusNode'].unfocus();
|
|
|
- FocusScope.of(context).requestFocus(state.formData['contact']!['focusNode']);
|
|
|
- },
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
|
|
|
- //备注
|
|
|
- MyTextView(
|
|
|
- "Note".tr,
|
|
|
- textColor: Colors.white,
|
|
|
- fontSize: 14,
|
|
|
- isFontRegular: true,
|
|
|
- marginLeft: 15,
|
|
|
- marginTop: 18,
|
|
|
- ),
|
|
|
+ //备注
|
|
|
+ MyTextView(
|
|
|
+ "Note".tr,
|
|
|
+ textColor: Colors.white,
|
|
|
+ fontSize: 14,
|
|
|
+ isFontRegular: true,
|
|
|
+ marginLeft: 15,
|
|
|
+ marginTop: 18,
|
|
|
+ ),
|
|
|
|
|
|
- IgnoreKeyboardDismiss(
|
|
|
- child: Container(
|
|
|
- height: 130,
|
|
|
- margin: const EdgeInsets.only(left: 15, right: 15, top: 10),
|
|
|
- padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: const Color(0xFF4DCFF6).withOpacity(0.2),
|
|
|
- borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
- ),
|
|
|
- child: TextField(
|
|
|
- cursorColor: ColorConstants.white,
|
|
|
- cursorWidth: 1.5,
|
|
|
- autofocus: false,
|
|
|
- enabled: true,
|
|
|
- focusNode: state.formData["note"]!['focusNode'],
|
|
|
- controller: state.formData["note"]!['controller'],
|
|
|
- // 装饰
|
|
|
- decoration: InputDecoration(
|
|
|
- isDense: true,
|
|
|
- isCollapsed: true,
|
|
|
- border: InputBorder.none,
|
|
|
- hintText: state.formData["note"]!['hintText'],
|
|
|
- hintStyle: const TextStyle(
|
|
|
- color: ColorConstants.textGrayAECAE5,
|
|
|
+ IgnoreKeyboardDismiss(
|
|
|
+ child: Container(
|
|
|
+ height: 130,
|
|
|
+ margin: const EdgeInsets.only(left: 15, right: 15, top: 10),
|
|
|
+ padding: const EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: const Color(0xFF4DCFF6).withOpacity(0.2),
|
|
|
+ borderRadius: const BorderRadius.all(Radius.circular(5)),
|
|
|
+ ),
|
|
|
+ child: TextField(
|
|
|
+ cursorColor: ColorConstants.white,
|
|
|
+ cursorWidth: 1.5,
|
|
|
+ autofocus: false,
|
|
|
+ enabled: true,
|
|
|
+ focusNode: state.formData["note"]!['focusNode'],
|
|
|
+ controller: state.formData["note"]!['controller'],
|
|
|
+ // 装饰
|
|
|
+ decoration: InputDecoration(
|
|
|
+ isDense: true,
|
|
|
+ isCollapsed: true,
|
|
|
+ border: InputBorder.none,
|
|
|
+ hintText: state.formData["note"]!['hintText'],
|
|
|
+ hintStyle: const TextStyle(
|
|
|
+ color: ColorConstants.textGrayAECAE5,
|
|
|
+ fontSize: 14.0,
|
|
|
+ fontWeight: FontWeight.w400,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ style: const TextStyle(
|
|
|
+ color: ColorConstants.white,
|
|
|
fontSize: 14.0,
|
|
|
fontWeight: FontWeight.w400,
|
|
|
),
|
|
|
+ // 键盘动作右下角图标
|
|
|
+ textInputAction: TextInputAction.next,
|
|
|
+ onSubmitted: (value) {
|
|
|
+ state.formData[key]!['focusNode'].unfocus();
|
|
|
+ FocusScope.of(context).requestFocus(state.formData['contact']!['focusNode']);
|
|
|
+ },
|
|
|
),
|
|
|
- style: const TextStyle(
|
|
|
- color: ColorConstants.white,
|
|
|
- fontSize: 14.0,
|
|
|
- fontWeight: FontWeight.w400,
|
|
|
- ),
|
|
|
- // 键盘动作右下角图标
|
|
|
- textInputAction: TextInputAction.next,
|
|
|
- onSubmitted: (value) {
|
|
|
- state.formData[key]!['focusNode'].unfocus();
|
|
|
- FocusScope.of(context).requestFocus(state.formData['contact']!['focusNode']);
|
|
|
- },
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
|
|
|
- //提交按钮
|
|
|
- MyButton(
|
|
|
- type: ClickType.throttle,
|
|
|
- milliseconds: 500,
|
|
|
- onPressed: () {
|
|
|
- FocusScope.of(context).unfocus();
|
|
|
- controller.doSubmit();
|
|
|
- },
|
|
|
- text: "Submit".tr,
|
|
|
- textColor: ColorConstants.white,
|
|
|
- fontSize: 16,
|
|
|
- radius: 20,
|
|
|
- backgroundColor: ColorConstants.textYellowFFBB1B,
|
|
|
- fontWeight: FontWeight.w500,
|
|
|
- ).marginSymmetric(vertical: 25, horizontal: 15),
|
|
|
- ],
|
|
|
- ),
|
|
|
+ //提交按钮
|
|
|
+ MyButton(
|
|
|
+ type: ClickType.throttle,
|
|
|
+ milliseconds: 500,
|
|
|
+ onPressed: () {
|
|
|
+ FocusScope.of(context).unfocus();
|
|
|
+ controller.doSubmit();
|
|
|
+ },
|
|
|
+ text: "Submit".tr,
|
|
|
+ textColor: ColorConstants.white,
|
|
|
+ fontSize: 16,
|
|
|
+ radius: 20,
|
|
|
+ backgroundColor: ColorConstants.textYellowFFBB1B,
|
|
|
+ fontWeight: FontWeight.w500,
|
|
|
+ ).marginSymmetric(vertical: 25, horizontal: 15),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }),
|
|
|
+
|
|
|
),
|
|
|
),
|
|
|
),
|