pikapika/lib/screens/FilePhotoViewScreen.dart

58 lines
1.9 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-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;
FilePhotoViewScreen(this.filePath);
@override
Widget build(BuildContext context) => Scaffold(
body: Stack(
children: [
PhotoView(
2021-11-06 07:01:25 +00:00
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),
),
),
Align(
alignment: Alignment.topRight,
child: InkWell(
onTap: () {
saveImage(filePath, context);
},
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.save, color: Colors.white),
),
),
),
],
),
);
}