Initialize method from animationController class

1.initialize function issues.

  • my goal is to call the toggle method from homPage to open the childPage drawer
    i im a bigginer
    -iI am counting on your kindness to help me plz…

    
          class HomePage extends StatefulWidget {
           const HomePage({Key? key}) : super(key: key);

    @override
    _HomePageState createState() => _HomePageState();
    }

    class _HomePageState extends State<HomePage>
    with SingleTickerProviderStateMixin {
    late AnimationController animationController;
    static const double maxSlide = 225.0;
    static const double minDragStartEdge = 60;
    static const double maxDragstartEdge = maxSlide - 16;
    bool _canBeDragged = false;
      @override
     void initState() {
     super.initState();
      animationController = AnimationController(
        vsync: this, duration: const Duration(milliseconds: 250));
      }

      void toggle() => animationController.isDismissed ? open() : close();
      void close() => animationController.reverse();
      void open() => animationController.forward();
       // Declaration des pages

         var myDrawer = const MyDrawerPages();
       var customChild = MyChildDrawerPages(onPressed: toggle);
           @override
        Widget build(BuildContext context) {
    return GestureDetector(
      //gestation des comportment des page
      onHorizontalDragStart: _onDragStart,
      onHorizontalDragUpdate: _onDragUpdate,
      onHorizontalDragEnd: _onDragEnd,
      onTap: toggle,
      child: AnimatedBuilder(
          animation: animationController,
          builder: (context, _) {
            double numValue = animationController.value;
            final slide = numValue * maxSlide;
            final scale = 1.0 - (numValue * 0.3);

            return Stack(children: [
              myDrawer,
              Transform(
                  transform: Matrix4.identity()
                    ..translate(slide)
                    ..scale(scale),
                  alignment: Alignment.centerLeft,
                  child: customChild),
            ]);
          }),
    );
  }

     void _onDragStart(DragStartDetails details) {
    bool isDragOpenFromLeft = animationController.isDismissed &&
        details.globalPosition.dx < minDragStartEdge;
    bool isDragCloseFromRight = animationController.isCompleted &&
        details.globalPosition.dx > maxDragstartEdge;

    _canBeDragged = isDragOpenFromLeft || isDragCloseFromRight;
  }

    void _onDragUpdate(DragUpdateDetails details) {
    if (_canBeDragged) {
      double delta = details.primaryDelta! / maxSlide;
      animationController.value += delta;
      }
    }

        void _onDragEnd(DragEndDetails details) {
    if (animationController.isDismissed || animationController.isCompleted) {
      return;
    }
    if (details.velocity.pixelsPerSecond.dx.abs() >= 365.0) {
      double visualVelocity = details.velocity.pixelsPerSecond.dx /
          MediaQuery.of(context).size.width;
      animationController.fling(velocity: visualVelocity);
    } else if (animationController.value < 0.5) {
      close();
    } else {
      open();
    }
  }
}


      
     class MyChildDrawerPages extends StatefulWidget {
       const MyChildDrawerPages({Key? key, required this.onPressed})
      : super(key: key);
      final VoidCallback onPressed;

     @override
     _MyChildDrawerPagesState createState() => _MyChildDrawerPagesState();
    }

    class _MyChildDrawerPagesState extends State<MyChildDrawerPages> {

     @override
      Widget build(BuildContext context) {
       return MaterialApp(
        home: Scaffold(
      backgroundColor: const Color(0xFF095592),
      appBar: AppBar(
        actions: [
          IconButton(onPressed: () {}, icon: const Icon(Icons.settings))
        ],
        leading: IconButton(
            onPressed: widget.onPressed,🤦‍♀️ icon: const Icon(Icons.menu)),
        title: const Text('Activty'),
        backgroundColor: Colors.transparent,
        elevation: 0,
      ),
      body: Container(), ```