Home > Back-end >  How do I implement sliding category bar in flutter?
How do I implement sliding category bar in flutter?

Time:11-21

Play Store Categories

I want to implement something similar to this found on the play store. What widgets/packages can help me achieve this?

CodePudding user response:

It is using TabBar, simply you can use DefaultTabController to handle it.

Example from doc

Widget build(BuildContext context) {
  return DefaultTabController(
    initialIndex: 1,
    length: 3,
    child: Scaffold(
      appBar: AppBar(
        title: const Text('TabBar Widget'),
        bottom: const TabBar(
          tabs: <Widget>[
            Tab(
              icon: Icon(Icons.cloud_outlined),
            ),
            Tab(
              icon: Icon(Icons.beach_access_sharp),
            ),
            Tab(
              icon: Icon(Icons.brightness_5_sharp),
            ),
          ],
        ),
      ),
      body: const TabBarView(
        children: <Widget>[
          Center(
            child: Text("It's cloudy here"),
          ),
          Center(
            child: Text("It's rainy here"),
          ),
          Center(
            child: Text("It's sunny here"),
          ),
        ],
      ),
    ),
  );
}

  • Related