Commit 74ee010b authored by Morgan's avatar Morgan Committed by Darren Austin

Fix MaterialApp's _navigatorObserver when only builder used (#29413)

Fix MaterialApp's _navigatorObserver so it doesn't cause WidgetApp's assertion to fail when using custom navigator, fixes #18904
parent 223d68ac
......@@ -419,7 +419,7 @@ class _MaterialAppState extends State<MaterialApp> {
_navigatorObservers = List<NavigatorObserver>.from(widget.navigatorObservers)
..add(_heroController);
} else {
_navigatorObservers = null;
_navigatorObservers = const <NavigatorObserver>[];
}
}
......
......@@ -381,6 +381,17 @@ void main() {
expect(log, <String>['onGenerateRoute /', 'onUnknownRoute /']);
});
testWidgets('MaterialApp with builder and no route information works.', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/18904
await tester.pumpWidget(
MaterialApp(
builder: (BuildContext context, Widget child) {
return const SizedBox();
},
),
);
});
testWidgets('Can get text scale from media query', (WidgetTester tester) async {
double textScaleFactor;
await tester.pumpWidget(MaterialApp(
......
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