魏少阳 6e88b01f6d Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
# Conflicts:
#	star_lock/lib/main/lockDetail/card/addCardType/addCardManage/addCardTypeManage_tabbar.dart
#	star_lock/lib/network/api.dart
2024-01-23 18:42:36 +08:00

152 lines
6.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
import '../../checkingIn/checkingInSet/checkingInSet_entity.dart';
import 'checkInCreatCompany_logic.dart';
class CheckInCreatCompanyPage extends StatefulWidget {
const CheckInCreatCompanyPage({Key? key}) : super(key: key);
@override
State<CheckInCreatCompanyPage> createState() => _CheckInCreatCompanyPageState();
}
class _CheckInCreatCompanyPageState extends State<CheckInCreatCompanyPage> {
final logic = Get.put(CheckInCreatCompanyLogic());
final state = Get.find<CheckInCreatCompanyLogic>().state;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: "创建公司",
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
CommonItem(
leftTitel: "${TranslationLoader.lanKeys!.company!.tr}${TranslationLoader.lanKeys!.name!.tr}",
rightTitle: "",
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: getTFWidget(false, TranslationLoader.lanKeys!.enterYourName!.tr, 2)),
Obx(() => CommonItem(
leftTitel:
"${TranslationLoader.lanKeys!.work!.tr}${TranslationLoader.lanKeys!.time!.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:
"${TranslationLoader.lanKeys!.workday!.tr}${TranslationLoader.lanKeys!.set!.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: TranslationLoader.lanKeys!.sure!.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: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(30),
],
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
autofocus: false,
textAlign: TextAlign.end,
onChanged: (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),
),
// decoration: InputDecoration(
// //输入里面输入文字内边距设置
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
// hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
// hintStyle: TextStyle(fontSize: 22.sp),
// //不需要输入框下划线
// border: InputBorder.none,
// ),
),
)
],
),
);
}
}