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

Commit 9102f2f

Browse files
author
Casey Hillers
authored
Revert "Inject current FlutterView into tree and make available via View.of(context) (#116924)" (#117214)
This reverts commit a34e419.
1 parent 23a2fa3 commit 9102f2f

21 files changed

+108
-352
lines changed

packages/flutter/lib/src/widgets/binding.dart

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import 'framework.dart';
1919
import 'platform_menu_bar.dart';
2020
import 'router.dart';
2121
import 'service_extensions.dart';
22-
import 'view.dart';
2322
import 'widget_inspector.dart';
2423

2524
export 'dart:ui' show AppLifecycleState, Locale;
@@ -897,22 +896,6 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
897896
@override
898897
bool get framesEnabled => super.framesEnabled && _readyToProduceFrames;
899898

900-
/// Used by [runApp] to wrap the provided `rootWidget` in the default [View].
901-
///
902-
/// The [View] determines into what [FlutterView] the app is rendered into.
903-
/// For backwards-compatibility reasons, this method currently chooses
904-
/// [window] (which is a [FlutterView]) as the rendering target. This will
905-
/// change in a future version of Flutter.
906-
///
907-
/// The `rootWidget` widget provided to this method must not already be
908-
/// wrapped in a [View].
909-
Widget wrapWithDefaultView(Widget rootWidget) {
910-
return View(
911-
view: window,
912-
child: rootWidget,
913-
);
914-
}
915-
916899
/// Schedules a [Timer] for attaching the root widget.
917900
///
918901
/// This is called by [runApp] to configure the widget tree. Consider using
@@ -1031,9 +1014,8 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
10311014
/// * [WidgetsBinding.handleBeginFrame], which pumps the widget pipeline to
10321015
/// ensure the widget, element, and render trees are all built.
10331016
void runApp(Widget app) {
1034-
final WidgetsBinding binding = WidgetsFlutterBinding.ensureInitialized();
1035-
binding
1036-
..scheduleAttachRootWidget(binding.wrapWithDefaultView(app))
1017+
WidgetsFlutterBinding.ensureInitialized()
1018+
..scheduleAttachRootWidget(app)
10371019
..scheduleWarmUpFrame();
10381020
}
10391021

packages/flutter/lib/src/widgets/view.dart

Lines changed: 0 additions & 94 deletions
This file was deleted.

packages/flutter/lib/src/widgets/window.dart

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/flutter/lib/widgets.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,8 @@ export 'src/widgets/transitions.dart';
148148
export 'src/widgets/tween_animation_builder.dart';
149149
export 'src/widgets/unique_widget.dart';
150150
export 'src/widgets/value_listenable_builder.dart';
151-
// TODO(goderbauer): Enable once clean-up in google3 is done.
152-
// export 'src/widgets/view.dart';
153151
export 'src/widgets/viewport.dart';
154152
export 'src/widgets/visibility.dart';
155153
export 'src/widgets/widget_inspector.dart';
156154
export 'src/widgets/widget_span.dart';
157155
export 'src/widgets/will_pop_scope.dart';
158-
export 'src/widgets/window.dart';

packages/flutter/test/material/debug_test.dart

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
88

99
void main() {
1010
testWidgets('debugCheckHasMaterial control test', (WidgetTester tester) async {
11-
await tester.pumpWidget(const Center(child: Chip(label: Text('label'))));
11+
await tester.pumpWidget(const Chip(label: Text('label')));
1212
final dynamic exception = tester.takeException();
1313
expect(exception, isFlutterError);
1414
final FlutterError error = exception as FlutterError;
@@ -25,7 +25,7 @@ void main() {
2525
expect(error.diagnostics[3], isA<DiagnosticsProperty<Element>>());
2626
expect(error.diagnostics[4], isA<DiagnosticsBlock>());
2727
expect(
28-
error.toStringDeep(), startsWith(
28+
error.toStringDeep(),
2929
'FlutterError\n'
3030
' No Material widget found.\n'
3131
' Chip widgets require a Material widget ancestor within the\n'
@@ -42,13 +42,12 @@ void main() {
4242
' The specific widget that could not find a Material ancestor was:\n'
4343
' Chip\n'
4444
' The ancestors of this widget were:\n'
45-
' Center\n'
46-
// End of ancestor chain omitted, not relevant for test.
47-
));
45+
' [root]\n',
46+
);
4847
});
4948

5049
testWidgets('debugCheckHasMaterialLocalizations control test', (WidgetTester tester) async {
51-
await tester.pumpWidget(const Center(child: BackButton()));
50+
await tester.pumpWidget(const BackButton());
5251
final dynamic exception = tester.takeException();
5352
expect(exception, isFlutterError);
5453
final FlutterError error = exception as FlutterError;
@@ -65,7 +64,7 @@ void main() {
6564
expect(error.diagnostics[4], isA<DiagnosticsProperty<Element>>());
6665
expect(error.diagnostics[5], isA<DiagnosticsBlock>());
6766
expect(
68-
error.toStringDeep(), startsWith(
67+
error.toStringDeep(),
6968
'FlutterError\n'
7069
' No MaterialLocalizations found.\n'
7170
' BackButton widgets require MaterialLocalizations to be provided\n'
@@ -79,9 +78,8 @@ void main() {
7978
' ancestor was:\n'
8079
' BackButton\n'
8180
' The ancestors of this widget were:\n'
82-
' Center\n'
83-
// End of ancestor chain omitted, not relevant for test.
84-
));
81+
' [root]\n',
82+
);
8583
});
8684

8785
testWidgets('debugCheckHasScaffold control test', (WidgetTester tester) async {
@@ -235,7 +233,6 @@ void main() {
235233
' HeroControllerScope\n'
236234
' ScrollConfiguration\n'
237235
' MaterialApp\n'
238-
' View-[GlobalObjectKey TestWindow#00000]\n'
239236
' [root]\n'
240237
' Typically, the Scaffold widget is introduced by the MaterialApp\n'
241238
' or WidgetsApp widget at the top of your application widget tree.\n'
@@ -380,7 +377,6 @@ void main() {
380377
' Scaffold-[LabeledGlobalKey<ScaffoldState>#00000]\n'
381378
' MediaQuery\n'
382379
' Directionality\n'
383-
' View-[GlobalObjectKey TestWindow#00000]\n'
384380
' [root]\n'
385381
' Typically, the ScaffoldMessenger widget is introduced by the\n'
386382
' MaterialApp at the top of your application widget tree.\n'

packages/flutter/test/material/scaffold_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2458,7 +2458,6 @@ void main() {
24582458
' Scaffold\n'
24592459
' MediaQuery\n'
24602460
' Directionality\n'
2461-
' View-[GlobalObjectKey TestWindow#e6136]\n'
24622461
' [root]\n'
24632462
' Typically, the ScaffoldMessenger widget is introduced by the\n'
24642463
' MaterialApp at the top of your application widget tree.\n',

packages/flutter/test/material/text_field_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7431,6 +7431,7 @@ void main() {
74317431
final dynamic exception = tester.takeException();
74327432
expect(exception, isFlutterError);
74337433
expect(exception.toString(), startsWith('No Material widget found.'));
7434+
expect(exception.toString(), endsWith(':\n $textField\nThe ancestors of this widget were:\n [root]'));
74347435
});
74357436

74367437
testWidgets('TextField loses focus when disabled', (WidgetTester tester) async {

0 commit comments

Comments
 (0)