// define field instance GlobalKey _appBarKey = GlobalKey(); // construct with key ConvexAppBar(key: _appBarKey, /* ... */); // access related State when necessary such as onPageChanged _appBarKey.currentState.animateTo(2/* index*/);