'Flutter: Convex_bottom_bar and adding new items to bottom bar

I have a convex bottom bar below my app and I want to add an item later. For example, I am creating a timer app, and when I press play, I just want to make a stop button item show up at the bottom bar and change the play icon into a pause icon. I couldn't find any solutions to make this happen.

My convex bottom bar

class PomoAppConvex extends StatelessWidget {
  static const List<IconData> itemsList = [
    Icons.stop,
    Icons.play_arrow,
    Icons.settings
  ];
  const PomoAppConvex({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ConvexAppBar(
      elevation: 0,
      style: TabStyle.custom,
      backgroundColor: Colors.red,
      items: [
        TabItem(
          icon: itemsList[0],
        ),
        TabItem(
          icon: itemsList[1],
        ),
        TabItem(
          icon: itemsList[2],
        ),
      ],
      initialActiveIndex: 0,
      onTap: (int i) => print("index=$i"),
    );
  }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source