簡體   English   中英

Textformfield 輸入文本 position 不等於圖標 flutter

[英]Textformfield input text position not equal with icon flutter

我有帶有圖標的 textformfield,但輸入文本 position 不等於我有某種圖標

我該如何解決?

我試過的代碼

class TestPage extends StatefulWidget {
  @override
  _TestPageState createState() => _TestPageState();
}

class _TestPageState extends State<TestPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          TextFormField(
            decoration: InputDecoration(
                prefixIcon: Icon(Icons.person),
                filled: true,
                hintText: 'Email',
                fillColor: Colors.white
            ),
          ),
          TextFormField(
            decoration: InputDecoration(
                prefixIcon: Icon(Icons.https),
                filled: true,
                hintText: 'Password',
                fillColor: Colors.white
            ),
          ),
        ],
      )
    );
  }
}

對此

請遵循以下方法:

contentPadding: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0),

請在 InputDecoration 中使用內容填充,並嘗試將 TextFormField 放入容器中以獲得更好的 alignment。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM