I want make it so when the menu is selected outside the white borders the font color of the letter changes to black instead of white, I tried to change it but I couldn't, if someone takes a look at the code would know where to put the adjustment?
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: controller.items.length,
itemBuilder: (_, index) {
final _item = controller.items[index];
if(_item['rota'] == Routes.home){
return Obx(() => Container(
decoration: (controller.selectedIndex == index)
? const BoxDecoration(
border: Border(
top: BorderSide(width: 3.0, color: Colors.white),
bottom: BorderSide(width: 3.0, color: Colors.white),
),
)
: null,
child: Obx(() => Card(
color: const Color(0XFF007E94),
elevation: 3,
child: ListTile(
title: Text(
_item['titulo'],
style: const TextStyle(color: (controller.selectedIndex == index ) ? Colors.black : Colors.white),
),
leading: _item['icone'],
onTap: () {
controller.selectedIndex = index ;
Get.toNamed(_item['rota']);
},
selected: controller.selectedIndex == index
),
)),
));
}
}
),
I tried this way but still can't adjust
CodePudding user response:
Try below code, remove const
keyword for TextStyle
title: Text(
_item['titulo'],
style: TextStyle(color: (controller.selectedIndex == index ) ? Colors.black : Colors.white),
),