i'm starting with Flutter and i'm struggling with the navigationBar, if i add the body i keep getting a stackOverflow. If i don't add the body everything is fine. Error:
The following StackOverflowError was thrown building DefaultTextStyle(debugLabel: (englishLike body1 2014).merge(blackMountainView bodyText2), inherit: false, color: Color(0xdd000000), family: Roboto, size: 14.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none, softWrap: wrapping at box width, overflow: clip):
Stack Overflow
The relevant error-causing widget was:
Scaffold Scaffold:file:///Users/salvatorelafiura/git/energy_flutter/lib/screen/main.dart:104:12
When the exception was thrown, this was the stack:
#0 new Uint8List (dart:typed_data-patch/typed_data_patch.dart:2201:3)
#1 _createTables.<anonymous closure> (dart:core/uri.dart:3872:60)
#2 new _GrowableList.generate (dart:core-patch/growable_array.dart:133:28)
Code of the current widget, 3 screens one bottomNavigation.
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widgetTitle.elementAt(selectedIndex)),
actions: <Widget>[
IconButton(
icon: const Icon(
Icons.logout,
color: Colors.white,
),
onPressed: () {
signOut();
},
)
],
),
body: Center(
child: IndexedStack(index: selectedIndex, children: tabPages),
),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(icon: Icon(Icons.home), label: "Pratica"),
BottomNavigationBarItem(icon: Icon(Icons.mail), label: "Messages"),
BottomNavigationBarItem(icon: Icon(Icons.person), label: "Profilo"),
],
currentIndex: selectedIndex,
onTap: onItemTapped,
backgroundColor: Colors.white,
fixedColor: Colors.blue,
selectedLabelStyle: const TextStyle(color: Colors.red, fontSize: 20),
unselectedFontSize: 16,
selectedIconTheme:
const IconThemeData(color: Colors.blue, opacity: 1.0, size: 30.0),
unselectedItemColor: Colors.grey,
unselectedLabelStyle: const TextStyle(fontSize: 18, color: Colors.pink),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}