我有一个Text widget
按下,另一个Route
必须显示.但我看不到任何onPressed()方法Text widget
.请帮忙.
我是Flutter的新手。我有BottomNavigationBar
4件物品。我想在按下时更改项目的图标。请帮忙。
到目前为止,这是我所做的。
bottomNavigationBar : new BottomNavigationBar(
currentIndex: index,
onTap: (int index) {
setState(() {
this.index = index;
}
);
_navigateToScreens(index);
},
type: BottomNavigationBarType.fixed,
items: [
new BottomNavigationBarItem(
backgroundColor: Colors.white,
icon: new Image.asset('images/1.0x/icon1.png'),
title: new Text("Route1", style: new TextStyle(
color: const Color(0xFF06244e), fontSize: 14.0))),
new BottomNavigationBarItem(
icon: new Image.asset('images/1.0x/icon2.png'),
title: new Text("Route2", style: new TextStyle(
color: const Color(0xFF06244e), fontSize: 14.0))),
new BottomNavigationBarItem(
icon: new Image.asset('images/1.0x/icon3.png'),
title: new Text("Route3", style: new TextStyle(
color: const Color(0xFF06244e), fontSize: 14.0),)),
new BottomNavigationBarItem(
icon: …
Run Code Online (Sandbox Code Playgroud) 我一直在使用Picasso的库在我的应用程序中将图像加载到我的gridview中,它的工作原理和我想要的完全一样.但是用户告诉我图像加载速度非常慢.我知道这是因为网络速度不佳而Picasso正在加载我的完整图像,这些图像非常大,然后调整它们以适合我的图像视图.所以我尝试使用滑动,它以几乎两倍的速度加载图像,但是在某些图像上它不像毕加索那样保持结构.例如毕加索加载图像看起来像
虽然滑行加载它们有不同的状态,这是它最初加载的
滚动后看起来像
然后最终经过大量滚动后看起来像
我非常有信心这是因为我的图像尺寸都不同而且似乎使我的占位符图像不同大小有效但我想知道的是我如何滑动以保持其初始状态,或者如何我能让毕加索加载得更快吗?我听说将颜色格式从888降低到565有戏剧性的效果,任何人都可以借给我两美分吗?感谢您提出的所有建议
编辑
这是我的imageview
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:id="@+id/imageView"/>
Run Code Online (Sandbox Code Playgroud)
这就是我给毕加索打电话的方式
Picasso.with(getActivity())
.load(mThumbIds[position])
.placeholder(R.drawable.placeholder)
.fit()
.into(imageView);
return imageView;
Run Code Online (Sandbox Code Playgroud)
这就是我现在称之为滑行的方式
Glide.with(getActivity())
.load(mThumbIds[position])
.asBitmap()
.placeholder(R.drawable.placeholder)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.fitCenter()
.error(R.drawable.ic_photos)
.into(imageView);
return imageView;
Run Code Online (Sandbox Code Playgroud)
如果重要,这是我的gridview
<GridView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="5dp"
android:id="@+id/gridview"
android:numColumns="2"
android:gravity="center"
android:drawSelectorOnTop="true"
android:listSelector="@drawable/ripple"
android:stretchMode="columnWidth"
>
Run Code Online (Sandbox Code Playgroud) 我试图在flutter中POST
使用http Dart库执行请求.但我无法找到指定请求正文的方法.有人可以帮忙举个例子吗?非常感谢