- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我希望使用 transform 为容器的比例设置动画。 AnimatedContainer 的属性(property);但是,比例尺并没有过渡,而是直接从头跳到尾。
代码片段:
var container = new AnimatedContainer(
duration: const Duration(milliseconds: 200),
width: 50.0,
height: 50.0,
// selected is a bool that will be toggled
transform: selected ? new Matrix4.identity() : new Matrix4.identity().scaled(0.2,0.2),
decoration: new BoxDecoration(
shape: BoxShape.circle,
backgroundColor: Colors.blue[500],
),
child: new Center(
child: new Icon(
Icons.check,
color: Colors.white,
),
)
);
对正在发生的事情有任何见解吗?
最佳答案
AnimatedContainer 支持动画化它的变换值,如下:
/// scale to 95%, centerred
final width = 200.0;
final height = 300.0;
bool shouldScaleDown = true;// change value when needed
AnimatedContainer(
color: Colors.blueAccent,
width: width,
height: height,
duration: Duration(milliseconds: 100),
transform: (shouldScaleDown
? (Matrix4.identity()
..translate(0.025 * width, 0.025 * height)// translate towards right and down
..scale(0.95, 0.95))// scale with to 95% anchorred at topleft of the AnimatedContainer
: Matrix4.identity()),
child: Container(),
);
关于dart - 如何使用 AnimatedContainer 进行动画变换(例如 Scale),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42662936/
Example 使用 CupertinoPicker,我希望它使用 AnimatedContainer 以动画形式显示在文本输入下方的 View 中,但是当它变得可见时,我收到溢出警告。据我所知,您无
我正在尝试制作一个类,如果您单击一个按钮,它会变大,然后再次单击会缩小。但是动画不工作 这是我的 import 'package:flutter/material.dart'; import 'pac
我想为列表中两个项目之间的间隙设置动画。我想过使用高度最初为零的 AminatedContainer,但我不熟悉如何进行这项工作。我现在的代码是: new AnimatedContainer(
基本上我想在 2 个值之间设置 AnimatedContainer 的高度动画。但这就是问题所在。当我的状态为 1 时,我知道高度,因此我可以设置动画,但是当我的状态为 0 时,我希望动画容器扩展到可
因此,我正在做一些事情,我想列出这些“胶囊”(圆角矩形容器)的列表。当用户点击其中任意一个时,它将扩展到全屏,而其余的则停留在较低的层上,并且不执行任何操作。 我正在使用AnimatedContain
我找不到两者之间的区别,以及为什么您想要使用其中一个。 在我看来,他们俩几乎做了同样的事情。 为什么以及在哪里会使用其中一个? 最佳答案 AnimatedContainer 用于快速完成任务且用途简单
假设我们有 Column 的 3 个 child : Flexible( flex:1, child: Container( color: Colors.red, ),
我有一个带有子控件的简单AnimatedWidget。 AnimatedContainer( duration: Duration(milliseconds: 2000), curve:
Expanded( flex: 1, child: Padding( padding:
Expanded( flex: 1, child: Padding( padding:
我希望为 AnimatedContainer 和 ClipPath 在 y 轴上移动设置动画。 这是我当前的代码: class Clip extends StatelessWidget { fin
我希望使用 transform 为容器的比例设置动画。 AnimatedContainer 的属性(property);但是,比例尺并没有过渡,而是直接从头跳到尾。 代码片段: var contain
我是一名优秀的程序员,十分优秀!