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:
Kate Lovett
2024-06-17 12:49:05 -07:00
committed by GitHub
parent d86448f965
commit 9b6813f4da
11 changed files with 3332 additions and 0 deletions

View 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);
});
}

View 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);
});
}