diff --git a/lib/ui/detail_page.dart b/lib/ui/detail_page.dart index 61f50d943..4d52b71bd 100644 --- a/lib/ui/detail_page.dart +++ b/lib/ui/detail_page.dart @@ -4,7 +4,6 @@ import 'package:like_button/like_button.dart'; import 'package:photos/core/cache/lru_map.dart'; import 'package:photos/favorite_photos_repository.dart'; import 'package:photos/models/photo.dart'; -import 'package:photos/ui/extents_page_view.dart'; import 'package:photos/ui/zoomable_image.dart'; import 'package:photos/utils/share_util.dart'; import 'package:logging/logging.dart'; @@ -56,7 +55,7 @@ class _DetailPageState extends State { Widget _buildPageView() { _pageController = PageController(initialPage: _selectedIndex); - return ExtentsPageView.extents( + return PageView.builder( itemBuilder: (context, index) { final photo = _photos[index]; if (_cachedImages.get(photo.generatedId) != null) { @@ -73,7 +72,6 @@ class _DetailPageState extends State { _cachedImages.put(photo.generatedId, image); return image; }, - extents: 1, onPageChanged: (int index) { setState(() { _selectedIndex = index; diff --git a/lib/ui/gallery.dart b/lib/ui/gallery.dart index abb718aa6..1a2f3ca88 100644 --- a/lib/ui/gallery.dart +++ b/lib/ui/gallery.dart @@ -40,7 +40,7 @@ class _GalleryState extends State { itemCount: _collatedPhotos.length, itemBuilder: _buildListItem, controller: _scrollController, - cacheExtent: 2000, + cacheExtent: 1000, ); } @@ -100,7 +100,10 @@ class _GalleryState extends State { ? Border.all(width: 4.0, color: Colors.blue) : null, ), - child: ThumbnailWidget(photo), + child: Hero( + tag: photo.generatedId, + child: ThumbnailWidget(photo), + ), ), ); } diff --git a/lib/ui/zoomable_image.dart b/lib/ui/zoomable_image.dart index 62f714db6..60c69e38f 100644 --- a/lib/ui/zoomable_image.dart +++ b/lib/ui/zoomable_image.dart @@ -1,4 +1,3 @@ -import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; import 'package:photos/core/cache/image_cache.dart'; @@ -53,6 +52,7 @@ class _ZoomableImageState extends State { scaleStateChangedCallback: _scaleStateChangedCallback, minScale: PhotoViewComputedScale.contained, gaplessPlayback: true, + heroAttributes: PhotoViewHeroAttributes(tag: widget.photo.generatedId), ); } else { return loadWidget;