Improve transition to full screen image viewer
This commit is contained in:
parent
9a8b2dc8d9
commit
a3df02252d
@ -6,6 +6,8 @@ class FullscreenUrlImgViewer extends StatefulWidget {
|
|||||||
final List<String> urls;
|
final List<String> urls;
|
||||||
final int index;
|
final int index;
|
||||||
|
|
||||||
|
static const double imageScale = 2.5;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<FullscreenUrlImgViewer> createState() => _FullscreenUrlImgViewerState();
|
State<FullscreenUrlImgViewer> createState() => _FullscreenUrlImgViewerState();
|
||||||
}
|
}
|
||||||
@ -95,7 +97,7 @@ class _ViewerState extends State<_Viewer> with SingleTickerProviderStateMixin {
|
|||||||
widget.url,
|
widget.url,
|
||||||
),
|
),
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
scale: 2.5,
|
scale: FullscreenUrlImgViewer.imageScale,
|
||||||
progress: true,
|
progress: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -27,12 +27,14 @@ class _Header extends StatelessWidget {
|
|||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
bottom: false,
|
bottom: false,
|
||||||
minimum: EdgeInsets.symmetric(vertical: $styles.insets.sm),
|
minimum: EdgeInsets.symmetric(vertical: $styles.insets.sm),
|
||||||
|
child: Hero(
|
||||||
|
tag: data.image,
|
||||||
child: AppImage(
|
child: AppImage(
|
||||||
image: NetworkImage(data.image),
|
image: NetworkImage(data.image),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.contain,
|
||||||
alignment: Alignment.topCenter,
|
|
||||||
distractor: true,
|
distractor: true,
|
||||||
scale: 1.0,
|
scale: FullscreenUrlImgViewer.imageScale, // so the image isn't reloaded
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -42,6 +44,6 @@ class _Header extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _handleImagePressed(BuildContext context) {
|
void _handleImagePressed(BuildContext context) {
|
||||||
Navigator.push(context, CupertinoPageRoute(builder: (_) => FullscreenUrlImgViewer(urls: [data.image])));
|
appLogic.showFullscreenDialogRoute(context, FullscreenUrlImgViewer(urls: [data.image]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user