El Hombre Sin Nombre
El Hombre Sin Nombre

Reputation: 3092

Flutter 2.0 - New buttons style

I updated a project to new version of Flutter, some of properties is changed.

For example

  style: TextButton.styleFrom(
       primary: Colors.blue[700],
       highlightColor: Colors.black)

Return that highlightColor parameter doesn´t exist.

In other case

 style: TextButton.styleFrom(                 
     splashColor: Colors.white24,
     backgroundColor: Colors.black),

Return splashColor parameter doesn´t exist.

So, how can i set highlightColor and splashColor in new version of Flutter (2.0.3)?

Upvotes: 0

Views: 265

Answers (1)

Tasnuva Tavasum oshin
Tasnuva Tavasum oshin

Reputation: 4750

For Splash affect You can use ButtonStyle :

 ButtonStyle(
       overlayColor: MaterialStateColor.resolveWith((states) => Colors.red),
    ),

overlayColor → MaterialStateProperty<Color?>? The highlight color that's typically used to indicate that the button is focused, hovered, or pressed. final

Upvotes: 1

Related Questions