How to change the border color of a TextFormField?

0

I would like to change the border color of the TextFormField on login screen to white because the background is gradient and would make it easier to visualize the text. Today I'm using the pattern I created for the theme:

ThemeData buildTheme() {
  final ThemeData base = ThemeData();

  return base.copyWith(
    primaryColor: Colors.lightBlue,
    inputDecorationTheme: InputDecorationTheme(
      border: OutlineInputBorder(),
    ),
  );
}

And I tried to create a decoratoration in the field:

final password = TextFormField(
  autofocus: false,
  obscureText: true,
  decoration: InputDecoration(
    labelText: 'Senha',
    border: OutlineInputBorder(
      borderSide: BorderSide(
        color: Colors.white,
      ),
    )
  ),
);

But I did not succeed. How can I do this only for the fields on this screen?

    
asked by anonymous 29.11.2018 / 18:35

1 answer

0

To solve this problem I created a new theme for the TextFormField in question:

final password = new Theme(
  data: new ThemeData(
    hintColor: Colors.white,
  ),
  child: TextFormField(
    autofocus: false,
    obscureText: true,
    decoration: InputDecoration(
      labelText: 'Senha',
      border: OutlineInputBorder(),
    ),
  ),
);
    
29.11.2018 / 19:19