From de52a4f5d01bc801b8cbe163aa509a1a08a8d23a Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 1 Apr 2021 16:03:34 +0800 Subject: [PATCH] update image preview --- .../activity/activity_detail_page.dart | 6 +--- lib/widget/picker/bee_image_preview.dart | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/lib/ui/community/activity/activity_detail_page.dart b/lib/ui/community/activity/activity_detail_page.dart index 59738d7f..01343396 100644 --- a/lib/ui/community/activity/activity_detail_page.dart +++ b/lib/ui/community/activity/activity_detail_page.dart @@ -104,15 +104,11 @@ class _ActivityDetailPageState extends State { ...model.imgUrls .map((e) => GestureDetector( onTap: () { - Get.to( - BeeImagePreview.path(path: e.url), - opaque: false, - ); + BeeImagePreview.toPath(path: e.url); }, child: Hero( tag: e.url, child: Container( - height: 228.w, decoration: BoxDecoration( color: Colors.black12, borderRadius: BorderRadius.circular(8.w), diff --git a/lib/widget/picker/bee_image_preview.dart b/lib/widget/picker/bee_image_preview.dart index 5e8dd8e2..9293daa7 100644 --- a/lib/widget/picker/bee_image_preview.dart +++ b/lib/widget/picker/bee_image_preview.dart @@ -9,6 +9,34 @@ import 'package:akuCommunity/const/resource.dart'; import 'package:akuCommunity/constants/api.dart'; class BeeImagePreview extends StatefulWidget { + static Future toFile({@required File file, String tag}) async { + return await navigator.push( + PageRouteBuilder( + opaque: false, + pageBuilder: (context, animation, secondAnimation) { + return FadeTransition( + opacity: animation, + child: BeeImagePreview.file(file: file, tag: tag), + ); + }, + ), + ); + } + + static toPath({@required String path, String tag}) { + navigator.push( + PageRouteBuilder( + opaque: false, + pageBuilder: (context, animation, secondAnimation) { + return FadeTransition( + opacity: animation, + child: BeeImagePreview.path(path: path, tag: tag), + ); + }, + ), + ); + } + final File file; final String path; final String tag;