Flutter 在颤振中水平重复图像
我想创建一个旋转地球仪效果。我的目标是通过拍摄一张世界地图并简单地水平滚动来实现。我想到的最干净的方法就是拍摄一张图像,重复它,然后使用Alignmentx,y设置动画 我只能让它重复并垂直滚动 在本例中,我使用对齐方式偏移了X和Y。你可以在Y上看到效果,但在X上看不到。我尝试了很多不同的技术来让它工作,但这是我能得到的最接近的结果Flutter 在颤振中水平重复图像,flutter,Flutter,我想创建一个旋转地球仪效果。我的目标是通过拍摄一张世界地图并简单地水平滚动来实现。我想到的最干净的方法就是拍摄一张图像,重复它,然后使用Alignmentx,y设置动画 我只能让它重复并垂直滚动 在本例中,我使用对齐方式偏移了X和Y。你可以在Y上看到效果,但在X上看不到。我尝试了很多不同的技术来让它工作,但这是我能得到的最接近的结果 return Container( decoration: const BoxDecoration( shape: BoxShape.circle,
return Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.blue,
),
width: 200.0,
height: 200.0,
child: ClipOval(
child: Image.network(
'https://pasarelapr.com/images/printable-world-maps-in-black-and-white/printable-world-maps-in-black-and-white-3.jpg',
repeat: ImageRepeat.repeat,
alignment: const Alignment(2.5, 3.5),
),
),
);
如何使其水平无限滚动?谢谢大家! 您可以查看有关图像重新绘制的更多详细信息: Image.repeatX=>水平方向 Image.repeatY=>垂直方向 此代码段适用于您:
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.blue,
),
height: 200,
width: 200,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: ClipOval(
child: Image.network(
'https://pasarelapr.com/images/printable-world-maps-in-black-and-white/printable-world-maps-in-black-and-white-3.jpg',
width: 600,
repeat: ImageRepeat.repeatX,
alignment: const Alignment(2.5, 3.5),
),
),
),
)
您可以查看有关图像重新绘制的更多详细信息: Image.repeatX=>水平方向 Image.repeatY=>垂直方向 此代码段适用于您:
Container(
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.blue,
),
height: 200,
width: 200,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: ClipOval(
child: Image.network(
'https://pasarelapr.com/images/printable-world-maps-in-black-and-white/printable-world-maps-in-black-and-white-3.jpg',
width: 600,
repeat: ImageRepeat.repeatX,
alignment: const Alignment(2.5, 3.5),
),
),
),
)
您提供的代码没有将地图水平对齐,只是垂直对齐。我编辑了我的答案,请检查这一条。有一个很好的解释,你提供的代码没有水平对齐地图,只是垂直对齐。我编辑我的答案,检查这个。这是一个很好的解释