![](/img/trans.png)
[英]Any ideas on why a "flutter install" to an android device doesn't show anything but "flutter run" works fine
[英]Why doesn't anything show up the body of this flutter scaffold?
有问题的类是从另一个页面调用的
onPressed: () {
Navigator.push(context, MaterialPageRoute(
builder: (context) =>
ProPage(iD: bestRatedPros[index]["ID"])));
},
其中 bestRatedPros 是具有以下类的变量 iD 的地图列表 -
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ProPage extends StatefulWidget {
ProPage({Key key, this.iD}) : super(key: key);
final iD;
@override
_ProPageState createState() => _ProPageState(iD);
}
class _ProPageState extends State<ProPage> {
int iD;
_ProPageState(this.iD);
@override
void initState() {
super.initState();
}
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.amber,
extendBodyBehindAppBar: true,
appBar: AppBar(
iconTheme: IconThemeData(
color: Colors.white, //change your color here
),
elevation: 0,
backgroundColor: Colors.amber
),
body:
Text("EWFWEFEWEWFWEF",style: TextStyle(color: Colors.black))
);
}
}
getDataFromBackend 函数和与之相关的所有变量都应该在主体内。 但不管它是什么,身体里什么都没有。 即使是简单的 Text 小部件也没有。 我只是想将变量 iD 从一个页面传递到另一个页面,而不会使事情复杂化。 运行日志不显示任何错误或警告。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.