119 lines
4.3 KiB
Dart

import 'package:flutter/material.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 '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: "",
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);
if(data != null) {
setState(() {
state.beginTime.value = data["beginTime"];
state.endTime.value = data["endTime"];
state.beginTimeTimestamp.value = data["beginTimeTimestamp"];
state.endTimeTimestamp.value = data["endTimeTimestamp"];
});
}
})),
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);
if(data != null) {
setState(() {
state.isCustom.value = data["attendanceType"];
state.weekDays.value = data["weekDays"];
state.weekDaysStr.value = state.weekDays.value.join(",");
});
}
})),
SizedBox(
height: 30.h,
),
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),
onClick: () {
logic.setCheckInCreateCompany();
}),
],
),
);
}
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,
autofocus: false,
textAlign: TextAlign.end,
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,
),
),
)
],
),
);
}
}