当我执行颤振运行时,出现错误
找不到目标文件“ lib / main.dart”。
为什么会发生这种情况,我该如何解决?
除了 content 和 index ,我想将额外的参数传递给我的 itemBuilder 函数。我该怎么做呢 ?
body: new ListView.builder
(
itemCount: litems.length,
itemBuilder: (BuildContext ctxt, int index) {
return new Text(litems[index]);
}
)
Run Code Online (Sandbox Code Playgroud)
我想要这样做的东西:
int k = "HI";
body: new ListView.builder
(
itemCount: litems.length,
itemBuilder: (BuildContext ctxt, int index, String k) {
return new Text(litems[index] + k);
}
)
Run Code Online (Sandbox Code Playgroud) 我是flutter的新手,我真的很想知道,有没有办法在flutter中而不是使用firebase连接到数据库服务器(例如mysql)。我正在开发一个智能停车系统项目,我需要将停车区的经纬度插入到服务器中创建的数据库中,并在用户请求时检索它。如果有人为上述问题提供解决方案(Flutter with database),那就太好了。
状态变量:
var moviePhotos = [
"http://www.kiwithebeauty.com/wp-content/uploads/2017/11/BLACK-PANTHER-COLLAGE-KIWI-THE-BEAUTY-MOVIE-MARVEL-800x350.png",
"https://static-ssl.businessinsider.com/image/5a7085a97e7a35f10c8b479f-1000/blackpanthershuri.jpg",
"https://longreadsblog.files.wordpress.com/2018/02/black-panther.jpg?w=1680",
"https://uziiw38pmyg1ai60732c4011-wpengine.netdna-ssl.com/wp-content/dropzone/2018/02/black-panther.jpg",
"https://static2.srcdn.com/wp-content/uploads/2017/10/Black-Panther-Trailer-1.jpg?q=50&w=1000&h=500&fit=crop&dpr=1.5",
"https://cdn.guidingtech.com/imager/media/assets/BP-2_acdb3e4bb37d0e3bcc26c97591d3dd6b.jpg",
"https://cdn.guidingtech.com/imager/media/assets/BP-8_acdb3e4bb37d0e3bcc26c97591d3dd6b.jpg"
];
var bannerPosition = 0;
Run Code Online (Sandbox Code Playgroud)
我希望下面的函数通过增加 bannerPosition 每 5 秒更改一次数组中的位置,以便在应用程序上呈现新图像
testing() async {
while(true){
await new Future.delayed(const Duration(seconds : 5));
if (bannerPosition < moviePhotos.length){
print("Banner Position Pre");
print(bannerPosition);
setState(() {
bannerPosition = bannerPosition + 1;
});
print("Banner Position Post");
print(bannerPosition);
}
else{
setState(() {
bannerPosition = 0;
});
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我执行此代码时,“Future.delayed(const Duration(seconds : 5))”不会以有序的方式发生,并导致图像渲染问题。