pikapika/lib/screens/FilePhotoViewScreen.dart

50 lines
1.6 KiB
Dart
Raw Normal View History

2021-09-29 23:57:09 +00:00
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
2021-11-12 05:41:26 +00:00
import 'package:pikapika/basic/Common.dart';
2021-11-11 03:00:38 +00:00
import 'package:pikapika/basic/Cross.dart';
import 'package:pikapika/screens/components/Images.dart';
2021-09-29 23:57:09 +00:00
2021-10-26 11:04:23 +00:00
// 预览图片
2021-09-29 23:57:09 +00:00
class FilePhotoViewScreen extends StatelessWidget {
final String filePath;
2022-03-17 03:31:25 +00:00
const FilePhotoViewScreen(this.filePath, {Key? key}) : super(key: key);
2021-09-29 23:57:09 +00:00
@override
Widget build(BuildContext context) => Scaffold(
body: Stack(
children: [
2021-11-12 05:41:26 +00:00
GestureDetector(
onLongPress: () async {
String? choose =
await chooseListDialog(context, '请选择', ['保存图片']);
switch (choose) {
case '保存图片':
saveImage(filePath, context);
break;
}
},
child: PhotoView(
imageProvider: ResourceFileImageProvider(filePath),
),
2021-09-29 23:57:09 +00:00
),
InkWell(
onTap: () => Navigator.of(context).pop(),
child: Container(
margin: EdgeInsets.only(top: 30),
padding: EdgeInsets.only(left: 4, right: 4),
decoration: BoxDecoration(
color: Colors.black.withOpacity(.75),
borderRadius: BorderRadius.only(
topRight: Radius.circular(8),
bottomRight: Radius.circular(8),
),
),
child: Icon(Icons.keyboard_backspace, color: Colors.white),
),
),
],
),
);
}