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

Time:10-12

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

CodePudding user response:

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