I have a ListTile in flutter but I cannot seem to figure out how to make the splash/ripple effect fit the border. My border is rounded, but the splash is just a normal rectangle with no round borders, as seen on the image below.
ListTile
Below is the code for the ListTile.
Ink(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
),
child: ListTile(
title: text(title, 0.0),
leading: Icon(
icon,
color: primaryColor,
),
)
)
An easy way to achieve a ripple effect on your flutter app by using the ripple_effect plugin so in today’s article we will walk through How to Solve if InkWell Not Showing Ripple Effect In Flutter. How to Solve if InkWell Not Showing Ripple Effect In Flutter?? Using Inkwell effect code snippet will look like a below: just click the middle square.
Flutter framework already provides splash effect functionality to many of it’s widgets like RaisedButton, FlatButton, ListTile etc. by default. However, if you want to use this feature to your custom widgets, you will have to explicitly make use of InkWell widget.
We wrapped the Center and Text widgets by an InkWell widget. But if you run the app now, you would still not be able to see splash ripple effect. This is because an InkWell widget must always have a Material widget as it’s parent widget.
After seeing a ton of different answers about changing the splash color of different widgets, namely ListTile, here are two quick ways of doing it: Be sure to check your specific widget, as some (such as RaisedButton and IconButton) already have splashColor and highlightColor properties you can set without having to modify or add a Theme.
You can use InkWell:
InkWell(
customBorder: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
onTap: () {},
splashColor: Colors.red,
child: ListTile(
title: Text("Title"),
),
),
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