簡體   English   中英

如何更改在文本字段中輸入的文本的顏色?

[英]How to change the color of the text being entered in text field?

如何更改此代碼中的顏色

Alert Dialog(
                  backgroundColor: Color(0xFF161619),
                  title: Text('Enter Your Name',
                      style: TextStyle(color: Colors.white, fontSize: 25.0)),
                  content: Row(
                    children: [
                      Expanded(
                          child: TextField(
                        autofocus: true,
                        decoration: InputDecoration(
                            labelText: 'Name',
                            labelStyle: TextStyle(
                                color: Colors.white,
                                fontFamily: 'abel',
                                fontSize: 20.0),
                            hintText: 'eg. Raakib Zargar'),
                        onChanged: (value) {
                          teamName = value;
                        },
                      ))
                    ],
                  ),



  

檢查此圖像

將 TextStyle 添加到 TextField 並提供color屬性:

     Alert Dialog(
                          backgroundColor: Color(0xFF161619),
                          title: Text('Enter Your Name',
                              style: TextStyle(color: Colors.white, fontSize: 25.0)),
                          content: Row(
                            children: [
                              Expanded(
                                  child: TextField(
                see here --->   style: TextStyle(color: Colors.red),
                                autofocus: true,
                                decoration: InputDecoration(
     underline color --->       enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.red),),  
                                focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.green),),  
                                    labelText: 'Name',
                                    labelStyle: TextStyle(
                                        color: Colors.white,
                                        fontFamily: 'abel',
                                        fontSize: 20.0),
                                    hintText: 'eg. Raakib Zargar'),
                                onChanged: (value) {
                                  teamName = value;
                                },
                              ))
                            ],
                          ),

暫無
暫無

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

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