I have flutter widget created with below code, where Tabs
are being created as shown below code snippet without having keys
in it.
How to find Settings
tab & click on it? Can this be done using ancestor or descendant?
Here is the image of the tabs
Here is the app code snippet.
// Imports...
class BottomNavigation extends StatelessWidget {
final TabItem currentTab;
final ValueChanged<TabItem> selectedTab;
const BottomNavigation({
super.key,
required this.currentTab,
required this.selectedTab,
});
@override
Widget build(BuildContext context) {
return BottomNavigationBar(
currentIndex: TabItem.values.indexOf(currentTab),
type: BottomNavigationBarType.fixed,
items: [
_buildItem(TabItem.home, context),
_buildItem(TabItem.creditHealth, context),
_buildItem(TabItem.setting, context),
],
onTap: (index) => selectedTab(
TabItem.values[index],
),
);
}
BottomNavigationBarItem _buildItem(
TabItem item,
BuildContext context
// var toolTip,
) {
return BottomNavigationBarItem(
// tooltip: toolTip,
icon: SvgPicture.asset(
svgF(tabIcons[item]!),
),
label: context.translate(
tabNameKeys[item]!,
),
);
}
}