[英]Flutter - how to change TextField border color?
我已經嘗試了一切嘗試更改文本字段的邊框顏色,但它似乎被忽略了。
我試過 sideBorder(甚至寬度也被忽略),hintStyle,僅將特定主題應用於此小部件,它們似乎都被忽略了。
child: new Theme(
data: ThemeData(
primaryColor: Colors.white,
accentColor: Colors.white,
hintColor: Colors.white //This is Ignored,
inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white) //This is Ignored
),
),
),
child: new TextField(
style: TextStyle(color: Colors.white, decorationColor: Colors.white),
cursorColor: Colors.white,
decoration: InputDecoration(
border: new OutlineInputBorder(
//borderRadius: const BorderRadius.all(Radius.circular(30.0)),
borderSide: BorderSide(color: Colors.white, width: 0.0) //This is Ignored,
),
hintText: "Search people",
),
),
//new Divider(color: Colors.white, height: 20),
)
我想改變看起來很細的黑色邊框並改變它的顏色和寬度。
使用enabledBorder
和focusedBorder
(當文本字段為焦點時)
InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red, width: 5.0),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.blue, width: 3.0),
),
hintText: "Search people",
),
我同意其他答案,但如果您只使用下限,則使用此代碼:
TextField(
decoration: InputDecoration(
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black)),
),
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.