简体   繁体   中英

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

How to change the color in this code

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;
                        },
                      ))
                    ],
                  ),



  

Check This Image

Add TextStyle to the TextField and provide color property:

     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;
                                },
                              ))
                            ],
                          ),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM