小编Arc*_*Ace的帖子

使用不同参数调用有状态小部件更新,而不是更新?

我刚刚开始学习 flutter,我使用 Stateful widget 下面的代码是 main.dart 文件

void main() {
  runApp(App());
}

class App extends StatefulWidget {
  @override
  _AppState createState() => _AppState();
}

class _AppState extends State<App> {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
        home: new Scaffold(backgroundColor: Colors.blueGrey.shade100,
      body: Home.Homescreen(HomeText: "default",), //initially setting text to default
      appBar: new AppBar(
        centerTitle: true,
        title: new Text("newApp",
            textDirection: TextDirection.ltr,
            style: TextStyle(fontSize:20 ,color: Colors.white)),
      ),
      bottomNavigationBar: new BottomNavigationBar(items: [
        new BottomNavigationBarItem(
            icon: Icon(Icons.home),
            title: new Text(
              "Home",
              textDirection: TextDirection.ltr, …
Run Code Online (Sandbox Code Playgroud)

android setstate flutter statelesswidget flutter-layout

5
推荐指数
2
解决办法
2130
查看次数