Search code examples
formsfluttercolorsprogram-entry-pointtextformfield

How to change TextFormField() widget color Flutter


I changed primary color black to white. my all TextFormField() focus color became white. how can I change this Color I tryed to change color properties but doens't work at all

 TextFormField(
     style: TextStyle(color: Colors.grey),
     focusNode: _confirmPasswordFocusNode,
     obscureText: true,
     decoration: InputDecoration(
     fillColor: Colors.black54,
     hoverColor: Colors.black54,
     focusColor: Colors.black54,
     labelText: '비밀번호 확인',
     icon: Icon(Icons.lock_outline)),
     onChanged: (value) {
        ...

enter image description here

everybody somebody anybody help me body : TextFormField(),


Solution

  • It doesn't change because of the default scheme set to the screen.

    You just have to change the widgets that you are drawing by wrapping your TextFormField with new ThemeData()

          Theme(
              data: new ThemeData(
                primaryColor: Colors.black54,
                focusColor: Colors.black54,
                hintColor: Colors.black54,
              ),
              child: TextFormField(
                style: TextStyle(color: Colors.grey),
                obscureText: true,
                decoration: InputDecoration(
                    labelText: '비밀번호 확인', icon: Icon(Icons.lock_outline)),
              ),
            ),