我有下面的carousel (使用carousel pro包),我可以制作可缩放的图像吗,所有的图像都是从网络接收的
SizedBox(
height: 280.0,
width: 380.0,
child:
Carousel(
images: [
for(final image in imagesPosts[i]) ...[
NetworkImage(_urlImages+posts[i]['userid']+"/"+image),
//Text(image),
],
],
dotSize: 4.0,
dotSpacing: 15.0,
dotColor: Colors.lightGreenAccent,
indicatorBgPadding: 5.0,
dotBgColor: Colors.blue.withOpacity(0.5),
borderRadius: true,
autoplay: false,
//animationCurve: Curves.fastOutSlowIn,
),
),
发布于 2020-10-14 21:06:52
class DetailsPage extends StatefulWidget {
final pictures;
const DetailsPage(
{Key key,
this.pictures})
: super(key: key);
@override
_DetailsPageState createState() => _DetailsPageState();
}
class _DetailsPageState extends State<DetailsPage> {
bool isImageTapped = false;
int index = 0;
@override
Widget build(BuildContext context) {
Widget imageCarousel = Container(
height: 200,
child: Carousel(
boxFit: BoxFit.cover,
images: widget.pictures ,
onImageTap: (index) {
setState(() {
this.index = index;
this.isImageTapped = true;
});
},
),
);
return Container(
child: Scaffold(
body: isImageTapped
? GestureDetector(
child: Container(
width: double.infinity,
height: double.infinity,
child: widget.pictures[this.index],
),
onTap: () {
setState(() {
this.index=0;
this.isImageTapped = false;
});
},
)
: ListView(
children: [
imageCarousel,
],
)),
);
}
}
发布于 2021-09-05 18:25:03
你可以使用InteractiveViewer
小部件,只需将你的旋转木马图像包装在InteractiveViewer中,并将scaleEnabled
参数作为'True‘传递即可。
InteractiveViewer(
scaleEnabled: true,
yourImageWidgetHere: ...,
)
https://stackoverflow.com/questions/61538356
复制相似问题