Answers for "No TabController for TabBar."

0

No TabController for TabBar.

As The Error is Stating you need - TabController Edit Your Code as Below.

@override
  Widget build(BuildContext context) {
    // TODO: implement build
    return DefaultTabController(  // Added
      length: 4,  // Added
      initialIndex: 0, //Added
      child: Scaffold(
          appBar: AppBar(
            title: new Text("Tab App."),
          ),
          drawer: sideDrawer(context),  // Passed BuildContext in function.
          bottomNavigationBar: bottomTabBar()),
    );
  }

Widget sideDrawer(BuildContext context){ ......
Posted by: Guest on March-31-2021

Browse Popular Code Answers by Language