mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Remove single window assumption from macrobenchmark (#119368)
This commit is contained in:
parent
3f95befe55
commit
2e8bebd178
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user