Update ListTile docs for color animation issues and add example (#106955)
This commit is contained in:
31
examples/api/test/material/list_tile/list_tile.0_test.dart
Normal file
31
examples/api/test/material/list_tile/list_tile.0_test.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
// 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/material.dart';
|
||||
import 'package:flutter_api_samples/material/list_tile/list_tile.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('ListTile with Hero does not throw', (WidgetTester tester) async {
|
||||
const int totalTiles = 3;
|
||||
|
||||
await tester.pumpWidget(
|
||||
const example.ListTileApp(),
|
||||
);
|
||||
|
||||
expect(find.byType(ListTile), findsNWidgets(totalTiles));
|
||||
|
||||
const String heroTransitionText = 'Tap here for Hero transition';
|
||||
const String goBackText = 'Tap here to go back';
|
||||
|
||||
expect(find.text(heroTransitionText), findsOneWidget);
|
||||
expect(find.text(goBackText), findsNothing);
|
||||
await tester.tap(find.text(heroTransitionText));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(heroTransitionText), findsNothing);
|
||||
expect(find.text(goBackText), findsOneWidget);
|
||||
|
||||
expect(tester.takeException(), null);
|
||||
});
|
||||
}
|
||||
29
examples/api/test/material/list_tile/list_tile.1_test.dart
Normal file
29
examples/api/test/material/list_tile/list_tile.1_test.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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/material.dart';
|
||||
import 'package:flutter_api_samples/material/list_tile/list_tile.1.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('ListTiles wrapped in Card widgets', (WidgetTester tester) async {
|
||||
const int totalTiles = 7;
|
||||
|
||||
await tester.pumpWidget(
|
||||
const example.ListTileApp(),
|
||||
);
|
||||
|
||||
expect(find.byType(ListTile), findsNWidgets(totalTiles));
|
||||
|
||||
for (int i = 0; i < totalTiles; i++) {
|
||||
expect(
|
||||
find.ancestor(
|
||||
of: find.byType(ListTile).at(i),
|
||||
matching: find.byType(Card).at(i),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user