flutter 基础 09 (时而无聊,时而愉快 )

2019-10-25  本文已影响0人  fanchuang
真相捕捉第一季

1. 笔记:

 1. 
2. 使用ImageProvider,因为它自带缓存:
ImageProvider avatar1 = ExactAssetImage('avatar-1.jpg');
3. 使底部导航按钮更小,更贴近底部:
在 BottomNavigationBarItem 添加: title: SizedBox.shrink()
4. 圆形的头像框:
icon: CircleAvatar(radius: , bg_img: )
5. 查询当前屏幕的宽度,或者是想占满空间:(下面这是一个正方形)
container(width: MediaQuery.of(context).size.height)
6. Image(fit: BoxFit.cover), 使图片自适应覆盖整个区域
7. Text(maxLines:2) 
8. Text(overflow: TextOverflow.ellipsis), 多余的显示为...
9. CupertinoSwitch toggle;在 material里面,相当于什么呢?
答案:Switch _mySwitch; 就是一个像灯泡开关一样的按钮。
10. 一种设计的技巧很不错: 2个页面,2个动画效果。背景对应背景,图片对应图片,
使用Hero,使页面切换更加柔和,更加自然。
11. 
12. 给一张图片添加一个圆角的边框? 
Container(
          height: 200,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(15),
//        color: Colors.blue,
            image: DecorationImage(
              image: AssetImage(pictures[0].picturePath),
              fit: BoxFit.cover,
            ),
          ),
        ),


上一篇 下一篇

猜你喜欢

热点阅读