我正试图让latbeltext“电子邮件”更高,以便它可以越过边界
TextFormField(
decoration: InputDecoration(
labelStyle: TextStyle(
color: AppColors.pink,
fontSize: 24,
height: -0.05, // this height is not changing the position of the text
fontWeight: FontWeight.bold,
),
floatingLabelBehavior: FloatingLabelBehavior.always,
floatingLabelStyle: TextStyle(
color: AppColors.black,
height: -0.05,
fontSize: 24, // Adjust the font size as desired
fontWeight: FontWeight.bold,
),
contentPadding:
EdgeInsets.symmetric(vertical: 15.0, horizontal: 24.0),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25.0),
borderSide: BorderSide(
color: AppColors.darkgrey,
),
),
// isDense: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(25.0),
),
hintText: 'Foulen@domaine.com',
labelText: "Email",
),
onSaved: (value) {
_email = value!;
},
),
字符串
问题是高度只在textformfield被聚焦时起作用when textfield is focusedwhen textfield is not focused我希望标签“电子邮件”即使在该字段未被聚焦时也保持在边框的顶部
1条答案
按热度按时间bnl4lu3b1#
你可以像这样使用
TextFormField
:字符串