Unverified Commit 2e8bebd1 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Remove single window assumption from macrobenchmark (#119368)

parent 3f95befe
......@@ -23,11 +23,6 @@ class _ClipperCachePageState extends State<ClipperCachePage>
@override
void initState() {
super.initState();
const double itemHeight = 140;
_topMargin = (window.physicalSize.height / window.devicePixelRatio - itemHeight * 3) / 2;
if (_topMargin < 0) {
_topMargin = 0;
}
_controller.addListener(() {
if (_controller.offset < 10) {
_controller.animateTo(_animateOffset, duration: const Duration(milliseconds: 1000), curve: Curves.ease);
......@@ -40,6 +35,18 @@ class _ClipperCachePageState extends State<ClipperCachePage>
});
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
const double itemHeight = 140;
final FlutterView view = View.of(context);
_topMargin = (view.physicalSize.height / view.devicePixelRatio - itemHeight * 3) / 2;
if (_topMargin < 0) {
_topMargin = 0;
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment