I want to add on tap effect and ripple effect on my code but when i try add "ink" its all turning red, i'm using flutter. here's my code ''' Expanded(

        child: Padding(
      padding: EdgeInsets.all(20.0),
      child: ListView(children: <Widget>[

        ListTile(
          leading: FaIcon(FontAwesomeIcons.thermometerFull),
          title: Text("Temperature"),
          trailing:
              Text(temp != null ? temp.toString() + "\u00B0" : 'loading'),
          onTap: () {},
        ),
        ListTile(
          leading: FaIcon(FontAwesomeIcons.thermometerHalf),
          title: Text("feels like"),
          trailing: Text(feels != null ? feels.toString() : "loading"),
        ),
        ListTile(
          hoverColor: Color.fromRGBO(153, 255, 255, 10),
          leading: FaIcon(FontAwesomeIcons.cloudMeatball),
          title: Text("Weather"),
          trailing: Text(desc != null ? desc.toString() : "loading"),
        ),
        ListTile(
          leading: FaIcon(FontAwesomeIcons.sun),
          title: Text("Humidity"),
          trailing:
              Text(humidity != null ? humidity.toString() : "loading"),
        ),
        ListTile(
          leading: FaIcon(FontAwesomeIcons.wind),
          title: Text("Wind speed"),
          trailing: Text(wind != null ? wind.toString() : "loading"),
        ),
        ListTile(
          leading: FaIcon(FontAwesomeIcons.bug),
          title: Text("Wind speed"),
          trailing: Text(wind != null ? wind.toString() : "loading"),
        ),
        ListTile(
          leading: FaIcon(FontAwesomeIcons.wind),
          title: Text("Wind speed"),
          trailing: Text(wind != null ? wind.toString() : "loading"),
        ), '''

can someone explain it in beginners way? this is my first try on flutter, thanks!


Solution 1: Mudassir

ListTile already has onTap property and a inkwell effect on tap.


Solution 2: pyshivam

ListTile already has onTap property and an inkwell effect on tap, however you also have to provide tileColor to ListTile.

Example:

ListTile(
  tileColor: Colors.blueGrey.shade50,
  onTap: () {},
  title: Text("title"),
);