Im using SidebarX package to create a sidebar in Flutter. I dont problem to navigate from the Sidemenu (by clicking on lables from the sidemenu). However, if i want to navigate by example clicking on a text inside a page, then im not sure on how to solve this... The only thing i can imagine is by using GestureDetector onTap around the text i want to click, but im unsure on what to write inside onTap.
I tried to make below controller global in a seperate file so that i can import it to any file. Then i tried SetState inside of onTap and it didnt work...
final controller = SidebarXController(selectedIndex: 0, extended: true);
GestureDetector(onTap: () {
setState(() {
controller.selectIndex == 3;
});
}, child: const Text('Go to Page 3'))
Please help! Im new at flutter and all help is appreciated!