Inner widget state change of Animated switcher

Viewed 260

I am working now on AnimatedSWitcher, it works nice But how to change state inside widget of Animated Switcher My code something like this:

                    void initstate(){
                   _layout=first();
                       }
                  first(){
            return InkWell(onTap:() 
            {
             setState(()
           {_layout=second();}); 
                  child:
         Row( 
           children:[
           Text("example"), 
           ...(other widgets)
              ]);


               second(){
            return InkWell(onTap:() 
            {
             setState(()
           {_layout=first();}); 
                  child:
         Row( 
           children:[
            Text("second example"),
         ]);

         @override
           Widget build(BuildContext context) {
              ...,
                  AnimatedSwitcher(duration: const Duration(milliseconds: 300),

                  transitionBuilder:
                      (Widget child, Animation<double> animation) {
                    return ScaleTransition(child: child, scale: animation);
                  },
                  child: _layout,
                ),
         }

And somewhere I have button to change text in first layout, but this setState is not working. My question is how to change the text inner widget of AnimatedSwitcher

0 Answers
Related