I have two screens, where
First: Listing of data from Firebase
Second: Add data in that screen so I want to comeback to first screen, Everything working fine only there was a black screen when I go back. Now issue was gone, I have searched for how it works but its still not clear my concept about this, Can any one describe how it works?

Before:

return new MaterialApp(
      title: "AddEditNames ",
      home: new AddEditNameScreen(),
);

After:当我把它换成

 return new Scaffold(
      backgroundColor: Color.fromRGBO(30, 30, 30, 1.0),
      body: new AddEditNameScreen(),
      appBar: new AppBar(
        elevation: 0.0,
        backgroundColor: Colors.blueAccent,
        actions: <Widget>[
        ],
        title: new Text(
          "AddEditNames",
          style: new TextStyle(color: Colors.white),
        ),
        centerTitle: true,
      ),
 );

推荐答案

MaterialApp是你的应用程序的起始点,它告诉Ffltter你将在你的应用程序中使用material 组件并遵循material 设计.

ScaffoldMaterialApp下使用,它提供了许多基本功能,比如AppBarBottomNavigationBarDrawerFloatingActionButton等.

所以,这就是一个典型的应用程序是如何开始的.

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(),
      body: YourWidget(),
    ),
  ));
}

Flutter相关问答推荐

Flutter bloc -如何使用BlocBuilder?

如何从外部控制有状态窗口小部件本身?

我如何才能收到每天重复的预定通知?

底部导航栏项目在抖动中不更改 colored颜色

Flutter 对齐:不适用于多行文字

出现异常.RangeError(RangeError(index):无效值:有效值范围为空:0).分度误差

Flutter 图标记移动

如何正确处理Flutter 翼中使用火基时发生的碰撞?

如何使排内 children 的身高与其他排内 children 的身高相适应?

Flutter 渲染HTML和数学(LaTeX和Katex)

在 Flutter 中从 FireStore 获取数据并编译它们需要太多时间

在我使用 flutter_riverpod stateprovider 重新保存代码之前,UI 主题状态不会更新

为什么我们使用 RiverpodGenerator

Flutter中如何连续获取TextField的文本是否为空?

如何在 flutter 中过滤 DateTime(intl)?

我一直在try 创建按钮以导航到第二页,但不知何故 RaisedButton 功能无法正常工作

NoSuchMethodError:方法 '[]' 在 null 上被调用.我的信息流中的错误

一个或多个插件需要更高的 Android SDK 版本

阴影效果只出现在一张卡片的左边 在Flutter 中?

如何在Flutter 的 initState 中初始化 Firestore 查询