import 'package:flutter/material.dart'; import 'package:photo_view/photo_view.dart'; import 'package:qhd_prevention/pages/my_appbar.dart'; // 查看大图 class SingleImageViewer extends StatelessWidget { final String imageUrl; const SingleImageViewer({Key? key, required this.imageUrl}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black.withValues(alpha: 0.5), appBar: MyAppbar( isBack: false, actions: [ IconButton(onPressed: () { Navigator.of(context).pop(); }, icon: Icon(Icons.close, color: Colors.white, size: 40,),) ], backgroundColor: Colors.black.withValues(alpha:0.5), title: '', ), body: Center( child: PhotoView( imageProvider: NetworkImage(imageUrl), backgroundDecoration: BoxDecoration(color: Colors.black.withValues(alpha:0.5)), minScale: PhotoViewComputedScale.contained, maxScale: PhotoViewComputedScale.covered * 2, onTapUp: (context, details, controllerValue) { Navigator.of(context).pop(); }, ), ), ); } }