Flutter有用代码段

2020-04-07  本文已影响0人  hypercode

1.Container圆角:

decoration: BoxDecoration(
                  color: Colors.cyan,
                  border: Border.all(color: Colors.white, width: 0),
                  borderRadius: BorderRadius.all(//圆角
                      Radius.circular(10.0)),
                ),

2.网络图片切圆角

ClipRRect(
                          borderRadius: BorderRadius.circular(10),
                          child:
                          FadeInImage.assetNetwork(
                            placeholder: "todo",
                            image: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2473188422,2942175013&fm=11&gp=0.jpg',
                            fit: BoxFit.cover,
                          ),
//                          Image.network(

//                              'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2473188422,2942175013&fm=11&gp=0.jpg',
//                              fit: BoxFit.fill),
                        )

3.图片填充父控件

ConstrainedBox(
        child: Image.asset(
                  AssetImages.start2,
                  fit: BoxFit.cover,
                  ),
        constraints: new BoxConstraints.expand(),
       )
上一篇 下一篇

猜你喜欢

热点阅读