Reland TreeSliver (#149839)
Reland of https://github.com/flutter/flutter/pull/147171
It was reverted for a failing unit test that had passed in presubmit. Hopefully this sticks better.
Also fixed leaks in 37b10adc90
This commit is contained in:
21
examples/api/test/widgets/sliver/sliver_tree.0_test.dart
Normal file
21
examples/api/test/widgets/sliver/sliver_tree.0_test.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright 2014 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_api_samples/widgets/sliver/sliver_tree.0.dart'
|
||||
as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Can toggle nodes in TreeSliver', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.TreeSliverExampleApp(),
|
||||
);
|
||||
expect(find.text('Second'), findsOneWidget);
|
||||
expect(find.text('alpha'), findsNothing);
|
||||
// Toggle tree node.
|
||||
await tester.tap(find.text('Second'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('alpha'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
21
examples/api/test/widgets/sliver/sliver_tree.1_test.dart
Normal file
21
examples/api/test/widgets/sliver/sliver_tree.1_test.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright 2014 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_api_samples/widgets/sliver/sliver_tree.1.dart'
|
||||
as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Can toggle nodes in TreeSliver', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.TreeSliverExampleApp(),
|
||||
);
|
||||
expect(find.text('lib'), findsOneWidget);
|
||||
expect(find.text('src'), findsNothing);
|
||||
// Toggle tree node.
|
||||
await tester.tap(find.text('lib'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('src'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user