首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Flutter Carouse Pro Zoom

Flutter Carouse Pro Zoom
EN

Stack Overflow用户
提问于 2020-05-01 15:17:29
回答 2查看 132关注 0票数 1

我有下面的carousel (使用carousel pro包),我可以制作可缩放的图像吗,所有的图像都是从网络接收的

代码语言:javascript
运行
复制
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,

                    ),
                    ),
EN

回答 2

Stack Overflow用户

发布于 2020-10-14 21:06:52

代码语言:javascript
运行
复制
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,               
                  ],
                )),
    );
  }
}
票数 0
EN

Stack Overflow用户

发布于 2021-09-05 18:25:03

你可以使用InteractiveViewer小部件,只需将你的旋转木马图像包装在InteractiveViewer中,并将scaleEnabled参数作为'True‘传递即可。

代码语言:javascript
运行
复制
InteractiveViewer(
        scaleEnabled: true,
        yourImageWidgetHere: ...,
 )

here is the sample example from flutter documentation

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61538356

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档