pikapika/lib/screens/FilePhotoViewScreen.dart

56 lines
1.8 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
2022-03-19 04:12:27 +00:00
import 'components/RightClickPop.dart';
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
2022-03-19 04:12:27 +00:00
Widget build(BuildContext context){
return RightClickPop(buildScreen(context));
}
Widget buildScreen(BuildContext context) => Scaffold(
2021-09-29 23:57:09 +00:00
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(
2022-03-19 04:12:27 +00:00
margin: const EdgeInsets.only(top: 30),
padding: const EdgeInsets.only(left: 4, right: 4),
2021-09-29 23:57:09 +00:00
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),
),
),
],
),
);
}