Home > Enterprise >  flutter leading with tabs behind actions
flutter leading with tabs behind actions

Time:11-10

how can I make tabs behind actions in appBar ?like this ! photo tabbed leading bar

, my code look like this and I've tried to put tabs on leading

  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 2,
      child: Scaffold(
        appBar: AppBar(
          automaticallyImplyLeading: false,
          actions: [
            IconButton(onPressed: () {}, icon: Icon(Icons.home)),
            IconButton(onPressed: () {}, icon: Icon(Icons.search)),
            IconButton(onPressed: () {}, icon: Icon(Icons.archive)),
          ],
          leadingWidth: double.maxFinite,
          leading: TabBar(
            indicatorSize: TabBarIndicatorSize.tab,
            tabs: [
              Tab(text: "Pending"),
              Tab(text: "Delivered"),
            ],
          ),
        ),
        body: TabBarView(
          children: [
            Tab(text: "Pending"),
            Tab(text: "Delivered"),
          ],
        ),
      ),
    );
  }
}

and here how it's the output look like => output of my code

CodePudding user response:

You can add the carousel_slider dependency. To get it you can visit pub.dev and search for carousel_slider or here's a link https://pub.dev/packages/carousel_slider. I hope this helps )

CodePudding user response:

what if you put the tab in title instead of leading:

  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 2,
      child: Scaffold(
        appBar: AppBar(
          automaticallyImplyLeading: false,
          actions: [
            IconButton(onPressed: () {}, icon: Icon(Icons.home)),
            IconButton(onPressed: () {}, icon: Icon(Icons.search)),
            IconButton(onPressed: () {}, icon: Icon(Icons.archive)),
          ],
          title: TabBar(
            indicatorSize: TabBarIndicatorSize.tab,
            tabs: [
              Tab(text: "Pending"),
              Tab(text: "Delivered"),
            ],
          ),
        ),
        body: TabBarView(
          children: [
            Tab(text: "Pending"),
            Tab(text: "Delivered"),
          ],
        ),
      ),
    );
  }
}
  • Related