import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:wallpaper/models/imgnetodel.dart'; import 'package:photo_view/photo_view.dart'; import 'package:photo_view/photo_view_gallery.dart'; class ImgScanPageView extends GetView { final NetImgCategory dataModel; final int currentIndex; const ImgScanPageView({super.key,required this.dataModel,required this.currentIndex}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text("查看大图"), ), body: Stack( children: [ Container( child: PhotoViewGallery.builder( scrollPhysics: const BouncingScrollPhysics(), builder: (BuildContext context, int index) { return PhotoViewGalleryPageOptions( imageProvider: NetworkImage(dataModel.data![index].original!), initialScale: PhotoViewComputedScale.contained * 0.8, minScale: PhotoViewComputedScale.contained*0.4, maxScale: PhotoViewComputedScale.contained * 4, onTapDown: (context, details, controllerValue) { print("touch down..."); }, // heroAttributes: PhotoViewHeroAttributes(tag: galleryItems[index].id), ); }, itemCount: dataModel.data!.length, loadingBuilder: (context, event) => Center( child: Container( width: 20.0, height: 20.0, child: CircularProgressIndicator( value: event == null ? 0 : event.cumulativeBytesLoaded / event.expectedTotalBytes!, ), ), ), // backgroundDecoration: widget.backgroundDecoration, // pageController: widget.pageController, onPageChanged: onPageChanged, ) ), Align( alignment: Alignment.bottomCenter, child: SizedBox( height: 90, width: 90, child: IconButton(onPressed: (){ // print("download....."); }, icon: const Icon(Icons.download), color: Colors.white, ), ), ), ], ), ); } void onPageChanged(int index){ print("切换了图片...."); } }