Unverified Commit 3f98fb79 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Ensure frame is scheduled when root widget is attached (#40105)

parent 2bc8f999
......@@ -940,6 +940,9 @@ class RenderObjectToWidgetAdapter<T extends RenderObject> extends RenderObjectWi
owner.buildScope(element, () {
element.mount(null, null);
});
// This is most likely the first time the framework is ready to produce
// a frame. Ensure that we are asked for one.
SchedulerBinding.instance.ensureVisualUpdate();
} else {
element._newWidget = this;
element.markNeedsBuild();
......
// Copyright 2019 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/scheduler.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
void main() {
test('attachRootWidget will schedule a frame', () async {
final WidgetsFlutterBinding binding = WidgetsFlutterBinding.ensureInitialized();
expect(SchedulerBinding.instance.hasScheduledFrame, isFalse);
binding.attachRootWidget(const Placeholder());
expect(SchedulerBinding.instance.hasScheduledFrame, isTrue);
});
}
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