我正在用 flutter 编写一个应用程序,它有 4 个选项卡式视图,有点像股票的 android 手机应用程序或时钟应用程序。其中一个视图散列一个浮动操作按钮,按下该按钮时会在列表中添加一些文本。但是,当我滚动到其他视图之一并返回时,所有文本都消失了。有没有办法来解决这个问题?
这是我的代码:
import 'package:flutter/material.dart';
import 'Screens/Dashboard.dart';
import 'Screens/CreateQuestionnaire.dart';
import 'Screens/AccountScreen.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
createState() => new MyAppState();
}
class MyAppState extends State<MyApp> {
final primaryColour = const Color(0xFF5CA1CA);
final secondaryColour = const Color(0xFFC36B42);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new DefaultTabController(
length: 4,
child: new Scaffold(
appBar: new AppBar(
actions: <Widget>[
new IconButton(icon: new …Run Code Online (Sandbox Code Playgroud)