我想在TextField中添加固定的不可编辑文本。
例如:当用户输入姓名后,固定文本“[user]”应显示在姓名后面。
例如:当用户输入姓名后,固定文本“[user]”应显示在姓名后面。
the result should be: Alexandra[user]
当用户输入名称时,固定单词[user]
必须始终存在!
我希望你理解我的要求,任何相关主题链接都将有所帮助!
我尝试过类似的初始文本,但用户可以编辑,我的应该是固定的。
Controller: TextEditingController(text: "Initial Text here"),
现在我的文本字段:
TextField(
decoration: InputDecoration(
labelText: ENTER_NAME,
labelStyle: GoogleFonts.poppins(
color: LIGHT_GREY_TEXT,
fontWeight: FontWeight.w400
),
border: UnderlineInputBorder(),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: LIGHT_GREY_TEXT)
),
errorText: isNameError ? ENTER_NAME : null,
),
style: GoogleFonts.poppins(
color: BLACK,
fontWeight: FontWeight.w500
),
onChanged: (val){
setState(() {
name = val;
isNameError = false;
});
},
),
hintText
会消失 (b)hintText
的值不会插入到数据库中。 我需要同时满足这两个选项的内容。 - AZxBB