小编Fat*_* km的帖子

如何为Text小部件Flutter实现OnPressed回调

我有一个Text widget按下,另一个Route必须显示.但我看不到任何onPressed()方法Text widget.请帮忙.

text widget dart flutter

15
推荐指数
4
解决办法
1万
查看次数

选中后如何更改BottomNavigationBarItem图标,颤振

我是Flutter的新手。我有BottomNavigationBar4件物品。我想在按下时更改项目的图标。请帮忙。

到目前为止,这是我所做的。

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)

dart flutter bottombar

5
推荐指数
6
解决办法
1万
查看次数

如何使滑翔显示像毕加索?

我一直在使用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)

android gridview image picasso android-glide

3
推荐指数
1
解决办法
3430
查看次数

如何使用Dart http库flutter实现Post API调用

我试图在flutter中POST使用http Dart库执行请求.但我无法找到指定请求正文的方法.有人可以帮忙举个例子吗?非常感谢

api post http dart flutter

1
推荐指数
1
解决办法
7821
查看次数

标签 统计

dart ×3

flutter ×3

android ×1

android-glide ×1

api ×1

bottombar ×1

gridview ×1

http ×1

image ×1

picasso ×1

post ×1

text ×1

widget ×1