-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Fix OpenContainer source(closed) widget staying hidden when the OpenContainer route is removed when the OpenContainer route is pushed from a different Route #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1733,6 +1733,46 @@ void main() { | |||||||||||||||||
| expect(modalRoute.settings, routeSettings); | ||||||||||||||||||
| }, | ||||||||||||||||||
| ); | ||||||||||||||||||
|
|
||||||||||||||||||
| testWidgets( | ||||||||||||||||||
| 'OpenContainer works when the route is removed', | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe:
Suggested change
I'm trying to make this description more helpful, but I think that the link to the issue does help enough |
||||||||||||||||||
| (WidgetTester tester) async { | ||||||||||||||||||
|
|
||||||||||||||||||
| final Widget openContainer = OpenContainer( | ||||||||||||||||||
| closedBuilder: (BuildContext context, VoidCallback action) { | ||||||||||||||||||
| return GestureDetector( | ||||||||||||||||||
| onTap: action, | ||||||||||||||||||
| child: const Text('Closed'), | ||||||||||||||||||
| ); | ||||||||||||||||||
| }, | ||||||||||||||||||
| openBuilder: (BuildContext context, VoidCallback action) { | ||||||||||||||||||
| return GestureDetector( | ||||||||||||||||||
| onTap: action, | ||||||||||||||||||
| child: const Text('Open'), | ||||||||||||||||||
| ); | ||||||||||||||||||
| }, | ||||||||||||||||||
| ); | ||||||||||||||||||
| await tester.pumpWidget(_boilerplate(child: openContainer)); | ||||||||||||||||||
| expect(_getOpacity(tester, 'Closed'), 1.0); | ||||||||||||||||||
|
|
||||||||||||||||||
| // Open the container | ||||||||||||||||||
| await tester.tap(find.text('Closed')); | ||||||||||||||||||
| await tester.pumpAndSettle(); | ||||||||||||||||||
|
|
||||||||||||||||||
| final Element container = tester.element(find.byType(OpenContainer, skipOffstage: false)); | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
|
||||||||||||||||||
| // Replace the open container route. | ||||||||||||||||||
| Navigator.pushReplacement<void, void>( | ||||||||||||||||||
| container, | ||||||||||||||||||
| MaterialPageRoute<void>(builder: (_) => const Placeholder()) | ||||||||||||||||||
| ); | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
|
||||||||||||||||||
| await tester.pumpAndSettle(); | ||||||||||||||||||
| // Go back to the main page and verify the closed builder is showed. | ||||||||||||||||||
| Navigator.pop(container); | ||||||||||||||||||
| await tester.pumpAndSettle(); | ||||||||||||||||||
|
|
||||||||||||||||||
| expect(_getOpacity(tester, 'Closed'), 1.0); | ||||||||||||||||||
| }, | ||||||||||||||||||
| ); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| Color _getScrimColor(WidgetTester tester) { | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
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: