import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/main/lockDetail/lockSet/checkInCreatCompany/checkInCreatCompany_state.dart'; import '../../../../appRouters.dart'; import '../../../../app_settings/app_colors.dart'; import '../../../../tools/commonItem.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../checkingIn/checkingInSet/checkingInSet_entity.dart'; import 'checkInCreatCompany_logic.dart'; class CheckInCreatCompanyPage extends StatefulWidget { const CheckInCreatCompanyPage({Key? key}) : super(key: key); @override State createState() => _CheckInCreatCompanyPageState(); } class _CheckInCreatCompanyPageState extends State { final CheckInCreatCompanyLogic logic = Get.put(CheckInCreatCompanyLogic()); final CheckInCreatCompanyState state = Get.find().state; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( barTitle: '创建公司'.tr, haveBack: true, backgroundColor: AppColors.mainColor), body: Column( children: [ CommonItem( leftTitel: '公司名称'.tr, rightTitle: '', isHaveLine: true, isHaveRightWidget: true, rightWidget: getTFWidget(false, '请输入姓名'.tr, 2)), Obx(() => CommonItem( leftTitel: '工作时间'.tr, rightTitle: (state.beginTime.value.isNotEmpty) ? '${state.beginTime.value} - ${state.endTime.value}' : '', isHaveLine: true, isHaveDirection: true, action: () async { var data = await Get.toNamed(Routers.checkingInSetWorkTimePage, arguments: { // "getKeyInfosData": state.lockSetInfoData.value, 'companyId': '1', 'pushType': '0', 'checkingInSetInfo': CheckingInSetInfo(), }); if(data != null) { state.beginTime.value = data['beginTime']; state.endTime.value = data['endTime']; state.beginTimeTimestamp.value = data['beginTimeTimestamp']; state.endTimeTimestamp.value = data['endTimeTimestamp']; logic.ifCanNext(); } })), Obx(() => CommonItem( leftTitel: '工作日设置'.tr, rightTitle: state.weekDaysStr.value, isHaveLine: true, isHaveDirection: true, action: () async { var data = await Get.toNamed(Routers.checkingInSetWorkdaySet, arguments: { 'getKeyInfosData': state.lockSetInfoData.value, 'companyId': '0', 'pushType': '0', 'checkingInSetInfo': CheckingInSetInfo(), }); if(data != null) { state.isCustom.value = data['attendanceType']; state.weekDays.value = data['weekDays']; state.weekDaysStr.value = state.weekDays.value.join(','); logic.ifCanNext(); } })), SizedBox( height: 30.h, ), Obx(() => SubmitBtn( btnName: '确定'.tr, borderRadius: 20.w, fontSize: 32.sp, isDelete: false, margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 20.w), padding: EdgeInsets.only(top: 20.w, bottom: 20.w), isDisabled: state.canNext.value, onClick: state.canNext.value ? logic.setCheckInCreateCompany: null)), ], ), ); } Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex) { return SizedBox( // height: 50.h, width: 320.w, child: Row( children: [ Expanded( child: TextField( controller:state.companyNameController, //输入框一行 maxLines: 1, inputFormatters: [ FilteringTextInputFormatter.deny('\n'), LengthLimitingTextInputFormatter(30), ], style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), autofocus: false, textAlign: TextAlign.end, onChanged: (String value) { logic.ifCanNext(); }, decoration: InputDecoration( //输入里面输入文字内边距设置 // contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0), hintText: tfStr, hintStyle: TextStyle(fontSize: 22.sp), focusedBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)), disabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)), enabledBorder: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)), border: const OutlineInputBorder(borderSide: BorderSide(width: 0, color: Colors.transparent)), contentPadding: const EdgeInsets.symmetric(vertical: 0), ), ), ) ], ), ); } }