微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

颤动后退按钮 Navigator.pop 不起作用

如何解决颤动后退按钮 Navigator.pop 不起作用

First Screen

Second Screen

Third Screen

我正在使用图像(列表),就像我们的移动图库一样!第一个屏幕我有图像列表,一旦点击你可以看到全视图预览模式(如移动画廊)!你可以向左滚动,向右滚动查看照片!现在,当我们可以点击它时,它会转到另一个屏幕,但问题是当我回来时,它会转到第一个屏幕而不是第二个屏幕!我试图在上图中向您解释!你也可以看到我的代码...!我尝试了所有类型的 Navigator.pop 但什么也没发生!请尽快帮助我....

在我点击的第一个屏幕上,我将图像列表数组传递到我的第二个屏幕

   setState(() {
            Navigator.push(context,PageTransition(type: PageTransitionType.fade,child:CampaignSinglePhotos(
             currentindex: index,ImageId: listing,images: listing,),duration: Duration(milliseconds: 500)));});

在我的第二个屏幕上:PhotoViewgallery(向左向右滑动查看图像)

          Container(
            child:
            InkWell(
              child: Center(
                  child: PhotoViewgallery.builder(
                    itemCount: widget.images.length,builder: (BuildContext context,int index) {
                      return PhotoViewgalleryPageOptions(
                        imageProvider: AdvancednetworkImage( widget.images[index].photoPreviewImagePath,usediskCache: true,maxScale: PhotoViewComputedScale.covered * 1.5,minScale: PhotoViewComputedScale.contained * 1.0,);
                    },pageController:  PageController(initialPage: widget.currentindex,keepPage: true),enableRotation: false,scrollDirection: Axis.horizontal,onPageChanged: pageChange,)
              ),onTap: (){
                Navigator.pushReplacement(context,PageRouteBuilder(pageBuilder: (a,b,c) =>
                Download(),transitionDuration: Duration(seconds: 1),));
              },)
        ),

这是我的第三个屏幕

return Scaffold(
  body: Center(
    child: InkWell(child: RaisedButton(child: Text("Please go back")),onTap: (){
      Navigator.pop(context);
  },);

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。