【发布时间】:2020-07-24 14:33:03
【问题描述】:
我正在使用flutter_swiper 从图像列表中滑动图像。我想使用MatrixGestureDetector 移动包含图像的滑动条并对其执行放大缩小。当我将 swiper 布局设置为 Default 时,它可以正常工作,但是当我将其更改为 Custom 或任何其他布局时,它会停止工作。谁能告诉我应该是什么问题???
这是我的代码
Stack(
children: <Widget>[
/// EYES
new Align(
child: MatrixGestureDetector(
onMatrixUpdate: (m, tm, sm, rm) {
setState(() {
notifier1.value =m;
});
},
shouldRotate: false,
// shouldScale: true,
// shouldTranslate: false,
child: AnimatedBuilder(
animation: notifier1,
builder: (ctx, child) {
return Transform(
transform: notifier1.value,
child: Stack(
children: <Widget>[
Align(
alignment: Alignment(0, -0.1),
child: Tooltip(
message: "Eyes Selected",
child: Container(
width: ew,
height: eh,
//color: Colors.purple,
child: new SizedBox(
child: Swiper(
onTap: (index){
itemNo = 1;
}
,
itemBuilder:
(BuildContext context,
int index) {
return Image.asset(
eImage[index],
);
},
itemCount: eImage.length,
itemWidth: 300,
itemHeight: 600,
//control: new SwiperControl(),
layout: SwiperLayout.DEFAULT,
customLayoutOption:
CustomLayoutOption(
startIndex: -1,
stateCount: 3)
.addRotate([
0 / 180,
0.0,
0 / 180
]).addTranslate([
Offset(-400.0, 0.0),
Offset(0.0, 0.0),
Offset(370, -40.0),
]),
),
height: 200,
width: 350,
),
),
),
),
],
),
);
},
),
),
),
],
),
【问题讨论】:
标签: flutter dart gesture swiper flutter-animation