fix:修复 开锁页-考勤-设置-节假日-姓名 输长位的显示半截,另输完后显示不全,应限制30位
This commit is contained in:
parent
a394c339a2
commit
faf006c677
@ -1,7 +1,9 @@
|
||||
import 'package:date_format/date_format.dart';
|
||||
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/checkingIn/checkingInHolidays/checkingInAddHolidays/checkingInAddHolidays_state.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
@ -20,8 +22,10 @@ class CheckingInAddHolidaysPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
||||
final logic = Get.put(CheckingInAddHolidaysLogic());
|
||||
final state = Get.find<CheckingInAddHolidaysLogic>().state;
|
||||
final CheckingInAddHolidaysLogic logic =
|
||||
Get.put(CheckingInAddHolidaysLogic());
|
||||
final CheckingInAddHolidaysState state =
|
||||
Get.find<CheckingInAddHolidaysLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -32,27 +36,31 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.name!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
setHeight: false,
|
||||
rightWidget: getTFWidget(
|
||||
"(${TranslationLoader.lanKeys!.mustFillIn!.tr})")),
|
||||
'(${TranslationLoader.lanKeys!.mustFillIn!.tr})')),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.startDate!.tr,
|
||||
rightTitle: state.beginDate.value.isEmpty ? "(${TranslationLoader.lanKeys!.mustFillIn!.tr})" : state.beginDate.value,
|
||||
rightTitle: state.beginDate.value.isEmpty
|
||||
? '(${TranslationLoader.lanKeys!.mustFillIn!.tr})'
|
||||
: state.beginDate.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: false,
|
||||
action: () async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
builder: (BuildContext context) {
|
||||
return ShowCalendar(
|
||||
datePickerMode: DatePickerMode.day,
|
||||
selectAction: (dateTime) {
|
||||
String beginDate = formatDate(dateTime, [yyyy,'-',mm,'-',dd]);
|
||||
selectAction: (DateTime dateTime) {
|
||||
final String beginDate = formatDate(
|
||||
dateTime, <String>[yyyy, '-', mm, '-', dd]);
|
||||
state.beginDate.value = beginDate;
|
||||
Get.back();
|
||||
// Navigator.of(context).pop(true);
|
||||
@ -61,17 +69,20 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.endDate!.tr,
|
||||
rightTitle: state.endDate.value.isEmpty ? "(${TranslationLoader.lanKeys!.mustFillIn!.tr})" : state.endDate.value,
|
||||
rightTitle: state.endDate.value.isEmpty
|
||||
? '(${TranslationLoader.lanKeys!.mustFillIn!.tr})'
|
||||
: state.endDate.value,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: false,
|
||||
action: () async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
builder: (BuildContext context) {
|
||||
return ShowCalendar(
|
||||
datePickerMode: DatePickerMode.day,
|
||||
selectAction: (dateTime) {
|
||||
String endDate = formatDate(dateTime, [yyyy,'-',mm,'-',dd]);
|
||||
selectAction: (DateTime dateTime) {
|
||||
final String endDate = formatDate(
|
||||
dateTime, <String>[yyyy, '-', mm, '-', dd]);
|
||||
state.endDate.value = endDate;
|
||||
Get.back();
|
||||
});
|
||||
@ -85,11 +96,12 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
||||
action: () async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
builder: (BuildContext context) {
|
||||
return ShowCalendar(
|
||||
datePickerMode: DatePickerMode.day,
|
||||
selectAction: (dateTime) {
|
||||
String makeUpWorkDate = formatDate(dateTime, [yyyy,'-',mm,'-',dd]);
|
||||
selectAction: (DateTime dateTime) {
|
||||
final String makeUpWorkDate = formatDate(
|
||||
dateTime, <String>[yyyy, '-', mm, '-', dd]);
|
||||
state.makeUpWorkDate.value = makeUpWorkDate;
|
||||
Get.back();
|
||||
});
|
||||
@ -112,30 +124,26 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
||||
}
|
||||
|
||||
Widget getTFWidget(String tfStr) {
|
||||
return Container(
|
||||
height: 50.h,
|
||||
width: 300.w,
|
||||
// color: Colors.red,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
maxLines: 1,
|
||||
controller: state.staffNameController,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
||||
hintText: tfStr,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
//不需要输入框下划线
|
||||
border: InputBorder.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
return Expanded(
|
||||
child: TextField(
|
||||
//输入框一行
|
||||
maxLines: 2,
|
||||
minLines: 1,
|
||||
controller: state.staffNameController,
|
||||
autofocus: false,
|
||||
textAlign: TextAlign.end,
|
||||
decoration: InputDecoration(
|
||||
//输入里面输入文字内边距设置
|
||||
contentPadding: const EdgeInsets.only(bottom: 3),
|
||||
hintText: tfStr,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor, height: 1),
|
||||
//不需要输入框下划线
|
||||
border: InputBorder.none,
|
||||
isCollapsed: true,
|
||||
),
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -145,7 +153,7 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
|
||||
return GestureDetector(
|
||||
onTap: () {},
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'images/icon_round_unSelect.png',
|
||||
width: 40.w,
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/checkingIn/checkingInHolidays/checkingInSetHolidays/checkingInSetHolidays_state.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||
import 'package:star_lock/tools/pickers/style/picker_style.dart';
|
||||
@ -25,8 +26,10 @@ class CheckingInSetHolidaysPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
final logic = Get.put(CheckingInSetHolidaysLogic());
|
||||
final state = Get.find<CheckingInSetHolidaysLogic>().state;
|
||||
final CheckingInSetHolidaysLogic logic =
|
||||
Get.put(CheckingInSetHolidaysLogic());
|
||||
final CheckingInSetHolidaysState state =
|
||||
Get.find<CheckingInSetHolidaysLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -37,12 +40,14 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
titleWidget: titleWidget(),
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
actionsList: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
var data = await Get.toNamed(
|
||||
final dynamic data = await Get.toNamed(
|
||||
Routers.checkingInAddHolidaysPage,
|
||||
arguments: {"companyId": state.companyId.value});
|
||||
arguments: <String, String>{
|
||||
'companyId': state.companyId.value
|
||||
});
|
||||
if (data != null) {
|
||||
logic.editStaffLoadData();
|
||||
}
|
||||
@ -58,12 +63,12 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
],
|
||||
),
|
||||
body: Obx(() {
|
||||
return state.holidaysListData.value!.isNotEmpty
|
||||
return state.holidaysListData.isNotEmpty
|
||||
? ListView.builder(
|
||||
itemCount: state.holidaysListData.value!.length,
|
||||
itemBuilder: (c, index) {
|
||||
HolidaysMonthListData holidaysMonthListData =
|
||||
state.holidaysListData.value![index];
|
||||
itemCount: state.holidaysListData.length,
|
||||
itemBuilder: (BuildContext c, int index) {
|
||||
final HolidaysMonthListData holidaysMonthListData =
|
||||
state.holidaysListData[index];
|
||||
return _checkingInListMouthItem(holidaysMonthListData);
|
||||
})
|
||||
: NoData();
|
||||
@ -71,34 +76,44 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
}
|
||||
|
||||
Widget _checkingInListMouthItem(HolidaysMonthListData holidaysMonthListData) {
|
||||
final double width = Get.width - 20.w * 2;
|
||||
final double l = width * 0.2;
|
||||
final double r = width * 0.8;
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
height: 140.h * holidaysMonthListData.listItem!.length + 20.w,
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: <Color>[
|
||||
colorWithMonth(int.parse(
|
||||
holidaysMonthListData.listItem![0].month.toString())),
|
||||
Colors.white
|
||||
],
|
||||
stops: const <double>[0.2, 0.2],
|
||||
),
|
||||
),
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
color: colorWithMonth(int.parse(
|
||||
holidaysMonthListData.listItem![0].month.toString())),
|
||||
width: 100.w,
|
||||
height: 140.h * holidaysMonthListData.listItem!.length,
|
||||
width: l,
|
||||
child: Center(
|
||||
child: Text(
|
||||
"${holidaysMonthListData.listItem![0].month}\n${TranslationLoader.lanKeys!.month!.tr}",
|
||||
'${holidaysMonthListData.listItem![0].month}\n${TranslationLoader.lanKeys!.month!.tr}',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 28.sp, color: Colors.white),
|
||||
))),
|
||||
SizedBox(
|
||||
height: 140.h * holidaysMonthListData.listItem!.length,
|
||||
width: 1.sw - 100.w - 20.w * 2,
|
||||
width: r,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: holidaysMonthListData.listItem!.length,
|
||||
itemBuilder: (c, index) {
|
||||
ListItem listItem = holidaysMonthListData.listItem![index];
|
||||
itemBuilder: (BuildContext c, int index) {
|
||||
final ListItem listItem =
|
||||
holidaysMonthListData.listItem![index];
|
||||
return _checkingInListItem(
|
||||
index,
|
||||
listItem.vacationName,
|
||||
DateTool().dateToYMDString(
|
||||
listItem.vacationStartDate.toString()),
|
||||
@ -107,10 +122,10 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
listItem.fillClassDate!.isNotEmpty
|
||||
? DateTool().dateToYMDString(
|
||||
listItem.fillClassDate.toString())
|
||||
: "", () async {
|
||||
var data = await Get.toNamed(
|
||||
: '', () async {
|
||||
final dynamic data = await Get.toNamed(
|
||||
Routers.checkingInDeletHolidaysPage,
|
||||
arguments: {"listItem": listItem});
|
||||
arguments: <String, ListItem>{'listItem': listItem});
|
||||
if (data != null) {
|
||||
logic.editStaffLoadData();
|
||||
}
|
||||
@ -123,83 +138,66 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _checkingInListItem(
|
||||
int index,
|
||||
String? lockTypeTitle,
|
||||
String? vacationStartDate,
|
||||
String? vacationEndDate,
|
||||
String? makeUpClass,
|
||||
Function() action) {
|
||||
Widget _checkingInListItem(String? lockTypeTitle, String? vacationStartDate,
|
||||
String? vacationEndDate, String? makeUpClass, Function() action) {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
color: Colors.white,
|
||||
height: 140.h,
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
lockTypeTitle!,
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"${TranslationLoader.lanKeys!.libertyDay!.tr}:$vacationStartDate - $vacationEndDate",
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"${TranslationLoader.lanKeys!.coverDate!.tr}:$makeUpClass",
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20.h),
|
||||
],
|
||||
child: Container(
|
||||
padding:
|
||||
EdgeInsets.only(left: 20.w, right: 20.w, top: 10.h, bottom: 10.h),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: AppColors.mainBackgroundColor, width: 1.h, // 设置边框宽度
|
||||
),
|
||||
),
|
||||
Container(color: AppColors.mainBackgroundColor, height: 1.h)
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
Characters(lockTypeTitle!).join('\u{200B}'),
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'${TranslationLoader.lanKeys!.libertyDay!.tr}:$vacationStartDate - $vacationEndDate',
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'${TranslationLoader.lanKeys!.coverDate!.tr}:$makeUpClass',
|
||||
style: TextStyle(fontSize: 20.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget titleWidget() {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
showListType();
|
||||
},
|
||||
onTap: showListType,
|
||||
child: Obx(() => Container(
|
||||
width: 300.w,
|
||||
height: 50.h,
|
||||
color: AppColors.mainColor,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"${state.selectYear.value}${TranslationLoader.lanKeys!.year!.tr}",
|
||||
'${state.selectYear.value}${TranslationLoader.lanKeys!.year!.tr}',
|
||||
style: TextStyle(color: Colors.white, fontSize: 26.sp),
|
||||
),
|
||||
SizedBox(
|
||||
@ -226,9 +224,7 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
// 样式 详见下方样式
|
||||
pickerStyle: PickerStyle(
|
||||
cancelButton: GestureDetector(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
onTap: Get.back,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.only(left: 22, right: 12),
|
||||
@ -237,9 +233,7 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
),
|
||||
),
|
||||
commitButton: GestureDetector(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
onTap: Get.back,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.only(left: 22, right: 12),
|
||||
@ -252,7 +246,7 @@ class _CheckingInSetHolidaysPageState extends State<CheckingInSetHolidaysPage> {
|
||||
selectDate: PDuration(year: 2023),
|
||||
minDate: PDuration(year: 1900),
|
||||
maxDate: PDuration(year: 2100),
|
||||
onConfirm: (p) {
|
||||
onConfirm: (PDuration p) {
|
||||
state.selectYear.value = p.year!;
|
||||
logic.editStaffLoadData();
|
||||
},
|
||||
|
||||
@ -12,6 +12,7 @@ class CommonItem extends StatelessWidget {
|
||||
this.isHaveLine = false,
|
||||
this.isHaveRightWidget = false,
|
||||
this.isPadding = true,
|
||||
this.setHeight = true,
|
||||
this.rightWidget,
|
||||
this.isTipsImg,
|
||||
this.action,
|
||||
@ -26,6 +27,7 @@ class CommonItem extends StatelessWidget {
|
||||
Function()? action;
|
||||
Function()? tipsImgAction;
|
||||
double? allHeight;
|
||||
bool? setHeight;
|
||||
bool? isTipsImg;
|
||||
bool? isPadding;
|
||||
|
||||
@ -34,7 +36,7 @@ class CommonItem extends StatelessWidget {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
height: allHeight ?? 65.h,
|
||||
height: setHeight == true ? allHeight ?? 65.h : null,
|
||||
padding: isPadding == true
|
||||
? EdgeInsets.only(left: 20.w, right: 10.w)
|
||||
: EdgeInsets.zero,
|
||||
@ -67,9 +69,7 @@ class CommonItem extends StatelessWidget {
|
||||
height: 20.w,
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
Container(),
|
||||
),
|
||||
if (isHaveRightWidget!) ...<Widget>[
|
||||
const Spacer(),
|
||||
rightWidget!
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user