actually i have a listile. i want to change its background color, leading icon color and prefix icon color when i am tapping on it.
ListTile(
leading: AppIcon.PERSON,
trailing: Icon(Icons.arrow_right_alt_sharp),
// hoverColor: AppColors.PRIMARY_COLOR_20,
onTap: () {
print('tappers');
},
// selected: true,
splashColor: AppColors.PRIMARY_COLOR_20,
selectedTileColor: AppColors.PRIMARY_COLOR_20,
selectedColor: AppColors.PRIMARY_COLOR_20,
title: Text(
'Edit Account',
style: TextStyle(fontFamily: 'Inter'),
),
),
2
Answers
Create a variable that will hold those color values.
Assign those values to the parameters that needs the color. The setState will change the value of those colors inside the
onTap
parameter.@Shafi Munshi Kindly review the code below. It’s a condensed solution that I believe will be beneficial.