Remove single window assumption from macrobenchmark (#119368)

This commit is contained in:
Michael Goderbauer 2023-01-27 12:42:42 -08:00 committed by GitHub
parent 3f95befe55
commit 2e8bebd178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(