Improve transition to full screen image viewer

This commit is contained in:
Grant Skinner 2022-09-17 16:57:22 -06:00
parent 9a8b2dc8d9
commit a3df02252d
2 changed files with 12 additions and 8 deletions

View File

@ -6,6 +6,8 @@ class FullscreenUrlImgViewer extends StatefulWidget {
final List<String> urls;
final int index;
static const double imageScale = 2.5;
@override
State<FullscreenUrlImgViewer> createState() => _FullscreenUrlImgViewerState();
}
@ -95,7 +97,7 @@ class _ViewerState extends State<_Viewer> with SingleTickerProviderStateMixin {
widget.url,
),
fit: BoxFit.contain,
scale: 2.5,
scale: FullscreenUrlImgViewer.imageScale,
progress: true,
),
),

View File

@ -27,12 +27,14 @@ class _Header extends StatelessWidget {
child: SafeArea(
bottom: false,
minimum: EdgeInsets.symmetric(vertical: $styles.insets.sm),
child: AppImage(
image: NetworkImage(data.image),
fit: BoxFit.cover,
alignment: Alignment.topCenter,
distractor: true,
scale: 1.0,
child: Hero(
tag: data.image,
child: AppImage(
image: NetworkImage(data.image),
fit: BoxFit.contain,
distractor: true,
scale: FullscreenUrlImgViewer.imageScale, // so the image isn't reloaded
),
),
),
),
@ -42,6 +44,6 @@ class _Header extends StatelessWidget {
}
void _handleImagePressed(BuildContext context) {
Navigator.push(context, CupertinoPageRoute(builder: (_) => FullscreenUrlImgViewer(urls: [data.image])));
appLogic.showFullscreenDialogRoute(context, FullscreenUrlImgViewer(urls: [data.image]));
}
}