enter image description here
In the first textfield, I set the size is 16 and everything is OK But in the second textfield, I set the size if 30 and the content is not center
This is my code:
TextFormField(
maxLines: 1,
scrollPadding: EdgeInsets.zero,
validator: validator,
readOnly: readOnly ?? false,
onChanged: onChanged,
controller: controller,
obscureText: obscureText ?? false,
keyboardType: keyBoardType,
// cursorHeight: GeneralHelper.scale(context: context,height: obscureText == true ?30:17),
style: TextStyle(
color: Colors.black,
fontSize: GeneralHelper.scale(
context: context,
// height: Genera开发者_StackOverflow社区lHelper.scale(context: context,height:17),
**height: GeneralHelper.scale(context: context,height: obscureText == true ?30:17),**
// height: 17,
),
),
I have post an image above, and above code is TextFormFieldRounded, I used it at:
TextFormFieldRounded(
radius: GeneralHelper.scale(context: context, height: 39.5),
controller: txtPhoneNumber,
hintStyle: TextStyle(
color: const Color(0xFF81C59E),
fontSize:
GeneralHelper.scale(context: context, height: 16),
fontWeight: FontWeight.w500,
),
elevation: 0,
backgroundColor: const Color(0xFFE3F4E1),
borderSize: BorderSide(
width: 0.5,
style: BorderStyle.solid,
color: Theme.of(context).colorScheme.primary),
keyBoardType: TextInputType.phone,
hintText: 'login_phone_number_hint'.tr,
onChanged: onChangedTextField,
),
SizedBox(
height: GeneralHelper.scale(context: context, height: 48),
),
TextFormFieldRounded(
radius: GeneralHelper.scale(context: context, height: 39.5),
backgroundColor: const Color(0xFFE3F4E1),
elevation: 0,
hintStyle: TextStyle(
color: const Color(0xFF81C59E),
fontSize:
GeneralHelper.scale(context: context, height: 16),
fontWeight: FontWeight.w500,
),
controller: txtPassword,
hintText: 'login_password_hint'.tr,
keyBoardType: TextInputType.text,
obscureText: !isShowPassword,
borderSize: BorderSide(
width: 0.5,
style: BorderStyle.solid,
color: Theme.of(context).colorScheme.primary),
),
I think the problem is cursorHeight, but It's not.
精彩评论