30 lines
882 B
Dart
30 lines
882 B
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:photo_view/photo_view.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,
|
||
|
appBar: AppBar(
|
||
|
backgroundColor: Colors.transparent,
|
||
|
elevation: 0,
|
||
|
),
|
||
|
body: Center(
|
||
|
child: PhotoView(
|
||
|
imageProvider: NetworkImage(imageUrl),
|
||
|
backgroundDecoration: BoxDecoration(color: Colors.black),
|
||
|
minScale: PhotoViewComputedScale.contained,
|
||
|
maxScale: PhotoViewComputedScale.covered * 2,
|
||
|
onTapUp: (context, details, controllerValue) {
|
||
|
Navigator.of(context).pop();
|
||
|
},
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|