$scope.todos = [
{text:'learn', done:true},
{text:'build', done:false},
{text:'watch', done:false},
{text:'destroy', done:false},
{text:'rebuild', done:false}];
$scope.remaining = function() {
var count = 0;
angular.forEach($scope.todos, function(todo,i) {
todo.text = 'want2learn';
todo.text[i+1] = todo.text;
});
Run Code Online (Sandbox Code Playgroud)
是否有可能ForEach函数访问/设置对象的上一个/下一个索引数组值,可能吗?
我有 2 个按钮,用于控制 InteractiveViewer 小部件的滚动(向左和向右),希望在我对 Matrix4Tween 有更好的了解后,我可以添加自己的上下滚动按钮
现在按钮是这样的
Row(
children: [
ElevatedButton(
onPressed: () {
controller.value = Matrix4.identity()..translate(0.0, 0.0);
},
child: Text('<'),
),
ElevatedButton(
onPressed: () {
controller.value = Matrix4.identity()..translate(-(width), 0.0);
},
child: Text('>'),
),
],
),
Run Code Online (Sandbox Code Playgroud)
下面是一个 InteractiveViewer 小部件,其中包含 4 个 gridview
Container(
color: Colors.grey,
width: gridboxwidth,
height: gridboxheight,
child: InteractiveViewer(
alignPanAxis: true,
constrained: false,
transformationController: controller,
scaleEnabled: true,
minScale: 0.1,
maxScale: 1,
child: Column(
children: [
Row(
children: [
grid1(size),
grid3(size),
],
),
Row(
children: [
grid2(size),
grid4(size), …Run Code Online (Sandbox Code Playgroud)