82 lines
3.0 KiB
Dart
82 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import '../app_settings/app_colors.dart';
|
|
|
|
class KeyNameItem extends StatelessWidget {
|
|
KeyNameItem(
|
|
{required this.leftTitel, Key? key, this.rightTitle, this.controller})
|
|
: super(key: key);
|
|
String? leftTitel;
|
|
String? rightTitle;
|
|
TextEditingController? controller;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
height: 65.h,
|
|
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
|
// color: Colors.white,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
border: Border(
|
|
bottom: BorderSide(
|
|
color: AppColors.greyLineColor, // 设置边框颜色
|
|
width: 2.0.h, // 设置边框宽度
|
|
),
|
|
),
|
|
),
|
|
child: Row(
|
|
children: <Widget>[
|
|
Text(leftTitel ?? '', style: TextStyle(fontSize: 22.sp)),
|
|
SizedBox(width: 6.w),
|
|
Expanded(
|
|
child: TextField(
|
|
//输入框一行
|
|
maxLines: 1,
|
|
inputFormatters: <TextInputFormatter>[
|
|
FilteringTextInputFormatter.deny('\n'),
|
|
LengthLimitingTextInputFormatter(50),
|
|
],
|
|
keyboardType: TextInputType.text,
|
|
style: TextStyle(
|
|
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
|
controller: controller,
|
|
autofocus: false,
|
|
textAlign: TextAlign.end,
|
|
// decoration: InputDecoration(
|
|
// //输入里面输入文字内边距设置
|
|
// contentPadding: EdgeInsets.only(top: 24.h, bottom: 16.h),
|
|
// hintText: tfStr,
|
|
// hintStyle: TextStyle(fontSize: 22.sp),
|
|
// //不需要输入框下划线
|
|
// border: InputBorder.none,
|
|
// ),
|
|
decoration: InputDecoration(
|
|
//输入里面输入文字内边距设置
|
|
// contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
|
|
hintText: rightTitle,
|
|
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),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|