草庐IT

TestTextState

全部标签

dart - 如何在 StatelessWidget 中更改 StatefulWidget 的状态?

只是测试flutter。下面的代码示例是一个非常简单的flutter应用程序。问题是我不知道如何在TestTextState类中调用setState()函数,以便在每次按下更改按钮时更改文本。import'package:flutter/material.dart';voidmain()=>runApp(newMyApp());classMyAppextendsStatelessWidget{//Thiswidgetistherootofyourapplication.@overrideWidgetbuild(BuildContextcontext){returnnewMaterial

dart - 如何在 StatelessWidget 中更改 StatefulWidget 的状态?

只是测试flutter。下面的代码示例是一个非常简单的flutter应用程序。问题是我不知道如何在TestTextState类中调用setState()函数,以便在每次按下更改按钮时更改文本。import'package:flutter/material.dart';voidmain()=>runApp(newMyApp());classMyAppextendsStatelessWidget{//Thiswidgetistherootofyourapplication.@overrideWidgetbuild(BuildContextcontext){returnnewMaterial