我有文本欄位,它將從用戶那里收到很長的訊息,并且我將擴展設定為 True
問題是提示文本不在行首,我該如何改變它的位置?

SizedBox(
height: 150,
child: CustomTextField(
enabledRadius: 7,
focusedRadius: 7,
expands: true,
hintText: 'message',
controller: messageController,
textInputType: TextInputType.multiline,
),
),
uj5u.com熱心網友回復:
謝謝大家,我通過使用弄明白了
textAlignVertical: TextAlignVertical(y: -1),
uj5u.com熱心網友回復:
You can use `textAlign:TextAlign.start` to align the hint
在這里查看完整代碼:
SizedBox(
height: 150,
child: CustomTextField(
enabledRadius: 7,
focusedRadius: 7,
expands: true,
maxLines: null,
textAlign: TextAlign.start,
hintText: 'message',
controller: messageController,
textInputType: TextInputType.multiline,
),
),
uj5u.com熱心網友回復:
您可以TextFormField使用這些屬性進行自定義。
textAlign: TextAlign.left,
decoration: const InputDecoration(
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
hintText: '0',
counterText: '',
hintStyle: TextStyle(
color: greyPlaceholderColor,
fontSize: fontSize40,
fontWeight: FontWeight.w700)),
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/530396.html
標籤:扑镖风格文本域类型提示
