94 lines
2.5 KiB
Dart
94 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:news_getx/theme/app_colors.dart';
|
|
import 'package:news_getx/theme/app_radii.dart';
|
|
|
|
/// 输入框
|
|
Widget InputTextEdit({
|
|
TextEditingController? controller,
|
|
TextInputType keyboardType = TextInputType.text,
|
|
String? hintText,
|
|
bool isPassword = false,
|
|
double marginTop = 15,
|
|
bool autoFocus = false,
|
|
}) {
|
|
return Container(
|
|
height: 44.h,
|
|
decoration: BoxDecoration(
|
|
color: AppColors.secondaryElement,
|
|
borderRadius: Radii.k6pxRadius,
|
|
),
|
|
margin: EdgeInsets.only(top: marginTop.h),
|
|
child: TextField(
|
|
decoration: InputDecoration(
|
|
hintText: hintText,
|
|
border: InputBorder.none,
|
|
contentPadding: EdgeInsets.fromLTRB(20, 10, 0, 9),
|
|
),
|
|
style: TextStyle(
|
|
color: AppColors.primaryText,
|
|
fontFamily: "Avenir",
|
|
fontWeight: FontWeight.w400,
|
|
fontSize: 18.sp,
|
|
),
|
|
controller: controller,
|
|
autofocus: autoFocus,
|
|
keyboardType: keyboardType,
|
|
maxLines: 1,
|
|
autocorrect: false,
|
|
// 自动纠正
|
|
obscureText: isPassword, // 隐藏输入内容, 密码框
|
|
),
|
|
);
|
|
}
|
|
|
|
/// email 输入框
|
|
/// 背景白色,文字黑色,带阴影
|
|
Widget inputEmailEdit({
|
|
TextEditingController? controller,
|
|
TextInputType keyboardType = TextInputType.text,
|
|
String? hintText,
|
|
bool isPassword = false,
|
|
double marginTop = 15,
|
|
bool autofocus = false,
|
|
}) {
|
|
return Container(
|
|
height: 44.h,
|
|
margin: EdgeInsets.only(top: marginTop.h),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.primaryBackground,
|
|
borderRadius: Radii.k6pxRadius,
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Color.fromARGB(41, 0, 0, 0),
|
|
offset: Offset(0, 1),
|
|
blurRadius: 0,
|
|
),
|
|
],
|
|
),
|
|
child: TextField(
|
|
autofocus: autofocus,
|
|
controller: controller,
|
|
keyboardType: keyboardType,
|
|
decoration: InputDecoration(
|
|
hintText: hintText,
|
|
contentPadding: EdgeInsets.fromLTRB(20, 10, 0, 9),
|
|
border: InputBorder.none,
|
|
hintStyle: TextStyle(
|
|
color: AppColors.primaryText,
|
|
),
|
|
),
|
|
style: TextStyle(
|
|
color: AppColors.primaryText,
|
|
fontFamily: "Avenir",
|
|
fontWeight: FontWeight.w400,
|
|
fontSize: 18.sp,
|
|
),
|
|
maxLines: 1,
|
|
autocorrect: false,
|
|
// 自动纠正
|
|
obscureText: isPassword, // 隐藏输入内容, 密码框
|
|
),
|
|
);
|
|
}
|