| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import 'package:flutter/material.dart';
- import '../basic/Common.dart';
- import 'components/Images.dart';
- import 'components/RightClickPop.dart';
- import 'package:photo_view/photo_view.dart';
- // 预览图片
- class FilePhotoViewScreen extends StatelessWidget {
- final String filePath;
- const FilePhotoViewScreen(this.filePath, {Key? key}) : super(key: key);
- @override
- Widget build(BuildContext context){
- return rightClickPop(
- child: buildScreen(context),
- context: context,
- canPop: true,
- );
- }
- Widget buildScreen(BuildContext context) => Scaffold(
- body: Stack(
- children: [
- GestureDetector(
- onLongPress: () async {
- String? choose =
- await chooseListDialog(context, '请选择', ['保存图片']);
- switch (choose) {
- case '保存图片':
- // TODO: saveImage
- // saveImage(filePath, context);
- break;
- }
- },
- child: PhotoView(
- imageProvider: ResourceFileImageProvider(filePath),
- ),
- ),
- InkWell(
- onTap: () => Navigator.of(context).pop(),
- child: Container(
- margin: const EdgeInsets.only(top: 30),
- padding: const EdgeInsets.only(left: 4, right: 4),
- decoration: BoxDecoration(
- color: Colors.black.withOpacity(.75),
- borderRadius: const BorderRadius.only(
- topRight: Radius.circular(8),
- bottomRight: Radius.circular(8),
- ),
- ),
- child: const Icon(Icons.keyboard_backspace, color: Colors.white),
- ),
- ),
- ],
- ),
- );
- }
|