'this is my code snippet and how to solve this error
bottomNavigationBar: MotionTabBar(
labels: ["Account", "Home", "Dashboard"],
initialSelectedTab: "Account",
tabIconColor: Colors.green,
tabSelectedColor: Colors.red,
onTabItemSelected: (int value) {
print(value);
setState(() {
_tabController.index = value;
});
},
icons: [Icons.account_box, Icons.home, Icons.menu],
textStyle: TextStyle(color: Colors.red),
),
body: MotionTabBarView(
controller: _tabController,
children: <Widget>[
SizedBox(
height: 100,
child: Center(
child: Text("Account"),
),
),
SizedBox(
height: 100,
child: Center(
child: Text("Home"),
),
),
SizedBox(
height: 100,
child: Center(
child: Text("Dashboard"),
),
),
],
)
Solution 1:[1]
Did you initialize _tabController in your initState method. Like this:
@override
void initState() {
super.initState();
_tabController = new MotionTabController(initialIndex:1,vsync: this);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Aloysius Samuel |

