I have a FlatButton. I don't want the splash highlight when the button is clicked. I tried changing the splash colour to transparent, but that didn't work. Here is the code for my FlatButton.
Widget button = new Container( child: new Container( padding: new EdgeInsets.only(bottom: 20.0), alignment: Alignment.center, child: new FlatButton( onPressed: () { _onClickSignInButton(); }, splashColor: Colors.transparent, child: new Stack( alignment: Alignment.center, children: <Widget>[ new Image.asset('images/1.0x/button1.png', ), new Text("SIGN IN", style: new TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 16.0 ), ) ], ), ), ), );
By setting both highlightColor and splashColor in your theme to Colors. transparent removed the ripple. You can hold some concerns that setting highlightColor might have some knock-on effects.
The RaisedButton / FlatButton / TextButton widget(s) can be disabled by assigning onPressed property to null . They can be disabled when onPressed property is not used at all. In order to make these widgets clickable, a function needs to be assigned to the onPressed property.
As Flat button is depricated, you have to use TextButton instead of it, but in text button there is no direct property to change splash color. So if you want to change splash color to transparent you can do it like this.
splashColor. The splash color of the button's InkWell. The ink splash indicates that the button has been touched. It appears on top of the button's child and spreads in an expanding circle beginning where the touch occurred.
I'd expect an invisible highlight color to do what you want:
new FlatButton({ ... splashColor: Colors.transparent, highlightColor: Colors.transparent, // makes highlight invisible too })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With