Visitar URL original
Fix OpenContainer source(closed) widget staying hidden when the OpenContainer route is removed when the OpenContainer route is pushed from a different Route by chunhtai · Pull Request #260 · flutter/packages · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix format and addressing comments
  • Loading branch information
chunhtai committed Dec 30, 2020
commit f08760a965f7c7605d92f398f2b6b97ab96fabe2
17 changes: 9 additions & 8 deletions packages/animations/test/open_container_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1734,10 +1734,11 @@ void main() {
},
);

// Regression test for https://github.com/flutter/flutter/issues/72238.
testWidgets(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment here to help with context:

Suggested change
testWidgets(
// Regression test for https://github.com/flutter/flutter/issues/72238.
testWidgets(

'OpenContainer works when the route is removed',
(WidgetTester tester) async {

'OpenContainer\'s source widget is visible in closed container route if '
'open container route is pushed from not using the OpenContainer itself',
(WidgetTester tester) async {
final Widget openContainer = OpenContainer(
closedBuilder: (BuildContext context, VoidCallback action) {
return GestureDetector(
Expand All @@ -1759,12 +1760,12 @@ void main() {
await tester.tap(find.text('Closed'));
await tester.pumpAndSettle();

final Element container = tester.element(find.byType(OpenContainer, skipOffstage: false));
// Replace the open container route.
Navigator.pushReplacement<void, void>(
container,
MaterialPageRoute<void>(builder: (_) => const Placeholder())
final Element container = tester.element(
find.byType(OpenContainer, skipOffstage: false),
);
// Replace the open container route.
Navigator.pushReplacement<void, void>(container,
MaterialPageRoute<void>(builder: (_) => const Placeholder()));
await tester.pumpAndSettle();
// Go back to the main page and verify the closed builder is showed.
Navigator.pop(container);
Expand Down