我想隐藏屏幕上的按钮并在用户开始滚动到最后一次滚动后的 5 秒后显示它们。
我已经将我的SingleChildScrollViewwith包裹起来GestureDetector并更改了onTap回调中的可见性值,以使用Visibility小部件隐藏我的按钮。但是,没有像 onScroll on 这样的事件GestureDetector。
有没有人成功地实现了这种效果,或者有没有我想要实现的内置动画?
首先,非常感谢您观看我的问题;\ni想通过 startClickPosition&endPosition 制作一条贝塞尔曲线路径,并用它画一个圆圈。\在代码中,我使用了 _path.computeMetrics(),并得到一个 PathMetrics,然后我使用pms.elementAt(0) 获取 PathMetric,但我发现一个错误,其中 pms.length 为 0。这是我的代码:
\n\n Path getPath(){\n Path path = Path();\n path.moveTo(widget.startOffset.dx, widget.startOffset.dy);\n // i\'m ensure this 4 var got value and is right value,below this line.\n double startX = widget.endOffset.dx / 2; \n double startY = widget.startOffset.dy;\n double endX = widget.endOffset.dx;\n double endY = widget.endOffset.dy;\n path.quadraticBezierTo(startX,startY,endX ,endY);\n return path;\n }\n\n startAnimation(){\n _path = getPath();\n if(_path == null) print("path is null");\n PathMetrics pms = _path.computeMetrics(forceClosed: false);\n // here pms.length is always 0;\n PathMetric pm …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过 PopupMenuButton 删除我的卡片。
但是我无法将有关当前卡的任何信息传递给它的onSelected方法,它需要String并返回void.
onSelected: (String value) { print('Selected: $value'); },
Run Code Online (Sandbox Code Playgroud) 我有用 Matrix4 初始化的 ValueNotifier。我可以改变我的看法。现在我想以某种方式将 ValueNotifier 的当前值保存在 SQLite 中,并再次在加载时使用保存的 Matrix4 值初始化我的 ValueNotifier。下面是代码:
ValueNotifier<Matrix4> notifier = ValueNotifier(Matrix4.identity());
MatrixGestureDetector(
onMatrixUpdate: (matrix, translationMatrix, scaleMatrix, rotationMatrix) {
notifier.value = matrix;
},
child: AnimatedBuilder(animation: notifier,
builder: (context, child) {
return Transform(
transform: notifier.value,
child: Container(
width: width,
height: height,
color: Colors.yellow,
),
);
}),
)
Run Code Online (Sandbox Code Playgroud)