79488273

Date: 2025-03-06 04:34:11
Score: 2.5
Natty:
Report link

I have found a solution for this issue. We can catch the on tap event using a GlobalKey.

  1. Define the global key

    final GlobalKey convexAppBarKey = GlobalKey();

  2. Use convexAppBarKey as key of the ConvexAppBAr

    ConvexAppBar( key: convexAppBarKey, onTap: (index) { // Handle tab changes }, ),

  3. Call the onTap event any where you want.

    ElevatedButton( onPressed: () { convexAppBarKey.currentState?.tap(1); }, child: Text("Tap Here"), )

Reasons:
  • No code block (0.5):
  • Contains question mark (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Dimuthu Madhusahan