Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Remove single window assumption from macrobenchmark (#119368)
Browse files Browse the repository at this point in the history
  • Loading branch information
goderbauer committed Jan 27, 2023
1 parent 3f95bef commit 2e8bebd
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions dev/benchmarks/macrobenchmarks/lib/src/clipper_cache.dart
Expand Up @@ -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);
Expand All @@ -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(
Expand Down

0 comments on commit 2e8bebd

Please sign in to comment.