File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
dev/benchmarks/macrobenchmarks/lib/src Expand file tree Collapse file tree 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>
2323 @override
2424 void initState () {
2525 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- }
3126 _controller.addListener (() {
3227 if (_controller.offset < 10 ) {
3328 _controller.animateTo (_animateOffset, duration: const Duration (milliseconds: 1000 ), curve: Curves .ease);
@@ -40,6 +35,18 @@ class _ClipperCachePageState extends State<ClipperCachePage>
4035 });
4136 }
4237
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+
4350 @override
4451 Widget build (BuildContext context) {
4552 return Scaffold (
You can’t perform that action at this time.
0 commit comments