toWidget method
Return the associated Widget
Implementation
@override
Widget toWidget(BuildContext context) {
List<BottomNavigationBarItem> items = children
.map((e) => BottomNavigationBarItem(
icon: toIcon((e as SDUIBottomNavigationBarItem).icon) ??
const Icon(Icons.error),
label: e.caption))
.toList();
return BottomNavigationBar(
items: items,
backgroundColor: toColor(background),
selectedItemColor: toColor(selectedItemColor),
unselectedItemColor: toColor(unselectedItemColor),
iconSize: iconSize ?? 18.0,
unselectedFontSize: fontSize ?? 10.0,
selectedFontSize: fontSize ?? 10.0,
elevation: elevation,
currentIndex: currentIndex ?? 0,
type: BottomNavigationBarType.fixed,
onTap: (index) => (children[index] as SDUIBottomNavigationBarItem)
.action
.execute(context, {}).then(
(value) => children[index].action.handleResult(context, value)),
);
}