Controlling State from outside of a StatefulWidget

前端 未结 7 1040
耶瑟儿~
耶瑟儿~ 2020-11-29 18:44

I\'m trying to understand the best practice for controlling a StatefulWidget\'s state outside of that Widgets State.

I have the following interface defined.

<
7条回答
  •  隐瞒了意图╮
    2020-11-29 19:15

    I do:

    class StartupPage extends StatefulWidget {
      StartupPageState state;
    
      @override
      StartupPageState createState() {
        this.state = new StartupPageState();
    
        return this.state;
      }
    }
    
    class DetectedAnimationState extends State {
    

    And outside just startupPage.state

提交回复
热议问题