File tree 1 file changed +12
-5
lines changed
dev/benchmarks/macrobenchmarks/lib/src
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,6 @@ class _ClipperCachePageState extends State<ClipperCachePage>
23
23
@override
24
24
void initState () {
25
25
super .initState ();
26
- const double itemHeight = 140 ;
27
- _topMargin = (window.physicalSize.height / window.devicePixelRatio - itemHeight * 3 ) / 2 ;
28
- if (_topMargin < 0 ) {
29
- _topMargin = 0 ;
30
- }
31
26
_controller.addListener (() {
32
27
if (_controller.offset < 10 ) {
33
28
_controller.animateTo (_animateOffset, duration: const Duration (milliseconds: 1000 ), curve: Curves .ease);
@@ -40,6 +35,18 @@ class _ClipperCachePageState extends State<ClipperCachePage>
40
35
});
41
36
}
42
37
38
+ @override
39
+ void didChangeDependencies () {
40
+ super .didChangeDependencies ();
41
+
42
+ const double itemHeight = 140 ;
43
+ final FlutterView view = View .of (context);
44
+ _topMargin = (view.physicalSize.height / view.devicePixelRatio - itemHeight * 3 ) / 2 ;
45
+ if (_topMargin < 0 ) {
46
+ _topMargin = 0 ;
47
+ }
48
+ }
49
+
43
50
@override
44
51
Widget build (BuildContext context) {
45
52
return Scaffold (
You can’t perform that action at this time.
0 commit comments