S91103-233608.jpg
1. 笔记
1. 关于页面内的滚动这一部分,暂时先放下了。以后见到相关的例子再继续。目前先看别的。
2. Align(alignment: Alignment(宽度, 高度),),
从左上到右下, 从[-1, -1] ---> [1, 1]
3. 获取随机的颜色:
double generateBorderRadius() => Random().nextDouble() * 64;
double generateMargin() => Random().nextDouble() * 64;
Color generateColor() => Color(0xFFFFFFFF & Random().nextInt(0xFFFFFFFF));
4. AspectRatio(aspectRatio: 3/2, child:XX(),),
指的是宽度与高度的比例是3:2,也可以写1.5, 但是3/2更好读一些,
动画部分的一些概念:
1. Offset(144.9, 209.9), Offset ,就是当前屏幕被点击的位置坐标
onPanDown: (details) { print(details.toString());},
2. AnimationController 在动画运行的过程中,有多种方式:
_controller.reverse(), forward(), reverse(), repeat(),
animateTo(0.8, duration: ,), 这个值必须是在0到1之间,代表动画完成的百分比。
3. AnimatedContainer, 比较适合用来放大或缩小一个组件
4. animation = Tween(begin: 0.0, end: money).animate(_controller);
只是一种写法,Tween代表变化的范围, Tween 与animation,经常一起合用。
5. AnimationController 是 Animation 的 parent. 怎么理解呢???
6. Column, 也可以从底部开始,
Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.stretch, // 水平方向上伸展占满
)
7. 2 种写法都可以的,选一种:
animation = _controller.drive(MyTween()); // 1st
animation = MyTween().animate(_controller); // 2sd
网友评论