Skip to content

Commit

Permalink
(viewer) Estimate size only once
Browse files Browse the repository at this point in the history
  • Loading branch information
violet-dev committed Sep 23, 2020
1 parent 1479ca9 commit a93510d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/pages/viewer/viewer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -592,13 +592,15 @@ class __VerticalImageViewerState extends State<_VerticalImageViewer>
fadeInDuration: Duration(microseconds: 500),
fadeInCurve: Curves.easeIn,
imageBuilder: (context, imageProvider, child) {
try {
final RenderBox renderBoxRed =
_keys[index].currentContext.findRenderObject();
final sizeRender = renderBoxRed.size;
if (sizeRender.height != 300)
_height[index] = width / sizeRender.aspectRatio;
} catch (e) {}
if (_height[index] == 0 || _height[index] == 300) {
try {
final RenderBox renderBoxRed =
_keys[index].currentContext.findRenderObject();
final sizeRender = renderBoxRed.size;
if (sizeRender.height != 300)
_height[index] = width / sizeRender.aspectRatio;
} catch (e) {}
}
return child;
},
progressIndicatorBuilder: (context, string, progress) {
Expand Down

0 comments on commit a93510d

Please sign in to comment.