Remove Placeholder. It has no clients. (#9563)
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
// Copyright 2015 The Chromium 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 'basic.dart';
|
||||
import 'framework.dart';
|
||||
|
||||
/// A widget whose child can be mutated.
|
||||
class Placeholder extends StatefulWidget {
|
||||
/// Creates a widget whose child can be mutated.
|
||||
const Placeholder({ Key key }) : super(key: key);
|
||||
|
||||
@override
|
||||
PlaceholderState createState() => new PlaceholderState();
|
||||
}
|
||||
|
||||
/// State for a [Placeholder] widget.
|
||||
///
|
||||
/// Useful for setting the child currently displayed by this placeholder widget.
|
||||
class PlaceholderState extends State<Placeholder> {
|
||||
/// The child that this widget builds.
|
||||
///
|
||||
/// Mutating this field will cause this widget to rebuild with the new child.
|
||||
Widget get child => _child;
|
||||
Widget _child;
|
||||
set child(Widget value) {
|
||||
if (_child == value)
|
||||
return;
|
||||
setState(() {
|
||||
_child = value;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_child != null)
|
||||
return child;
|
||||
return const SizedBox(width: 0.0, height: 0.0);
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@ export 'src/widgets/page_storage.dart';
|
||||
export 'src/widgets/page_view.dart';
|
||||
export 'src/widgets/pages.dart';
|
||||
export 'src/widgets/performance_overlay.dart';
|
||||
export 'src/widgets/placeholder.dart';
|
||||
export 'src/widgets/preferred_size.dart';
|
||||
export 'src/widgets/primary_scroll_controller.dart';
|
||||
export 'src/widgets/raw_keyboard_listener.dart';
|
||||
|
||||
@@ -11,6 +11,11 @@ class TestState extends State<StatefulWidget> {
|
||||
Widget build(BuildContext context) => null;
|
||||
}
|
||||
|
||||
// TODO(ianh): Remove this once we add the real Placeholder widget
|
||||
class Placeholder extends Container {
|
||||
Placeholder({ Key key }) : super(key: key);
|
||||
}
|
||||
|
||||
void main() {
|
||||
testWidgets('UniqueKey control test', (WidgetTester tester) async {
|
||||
final Key key = new UniqueKey();
|
||||
@@ -440,7 +445,7 @@ void main() {
|
||||
final GlobalKey key = new GlobalKey();
|
||||
await tester.pumpWidget(new Container(key: key));
|
||||
expect(log, isEmpty);
|
||||
await tester.pumpWidget(const Placeholder());
|
||||
await tester.pumpWidget(new Placeholder());
|
||||
debugPrint = oldCallback;
|
||||
debugPrintGlobalKeyedWidgetLifecycle = false;
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
// Copyright 2017 The Chromium 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_test/flutter_test.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Placeholder control test', (WidgetTester tester) async {
|
||||
final GlobalKey<PlaceholderState> key = new GlobalKey<PlaceholderState>();
|
||||
|
||||
await tester.pumpWidget(new Placeholder(key: key));
|
||||
|
||||
key.currentState.child = const Text('target');
|
||||
|
||||
expect(find.text('target'), findsNothing);
|
||||
|
||||
await tester.pump();
|
||||
|
||||
expect(find.text('target'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user