Repository navigation
fix: respect mobile auth insets and unify goal sheets #39
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:papyrus/models/reading_goal.dart'; | ||
| import 'package:papyrus/themes/app_theme.dart'; | ||
| import 'package:papyrus/widgets/goals/active_goal_details_sheet.dart'; | ||
| import 'package:papyrus/widgets/goals/completed_goal_chip.dart'; | ||
| import 'package:papyrus/widgets/shared/app_bottom_sheet.dart'; | ||
|
|
||
| void main() { | ||
| final goal = ReadingGoal( | ||
| id: 'goal', | ||
| type: GoalType.books, | ||
| targetValue: 12, | ||
| currentValue: 4, | ||
| period: GoalPeriod.yearly, | ||
| startDate: DateTime(2026), | ||
| endDate: DateTime(2026, 12, 31), | ||
| ); | ||
|
|
||
| Future<void> openSheet(WidgetTester tester, {required bool completed, double width = 390}) async { | ||
| tester.view.devicePixelRatio = 1; | ||
| tester.view.physicalSize = Size(width, 700); | ||
| tester.view.padding = const FakeViewPadding(bottom: 48); | ||
| tester.view.viewPadding = const FakeViewPadding(bottom: 48); | ||
| addTearDown(tester.view.reset); | ||
| await tester.pumpWidget( | ||
| MaterialApp( | ||
| theme: AppTheme.dark, | ||
| home: Scaffold( | ||
| body: Builder( | ||
| builder: (context) => TextButton( | ||
| onPressed: () { | ||
| if (completed) { | ||
| CompletedGoalChip.showDetailsSheet(context, goal: goal); | ||
| } else { | ||
| ActiveGoalDetailsSheet.show(context, goal: goal); | ||
| } | ||
| }, | ||
| child: const Text('Open'), | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
| ); | ||
| await tester.tap(find.text('Open')); | ||
| await tester.pumpAndSettle(); | ||
| } | ||
|
|
||
| for (final completed in [false, true]) { | ||
| for (final width in [320.0, 390.0]) { | ||
| testWidgets('${completed ? 'completed' : 'active'} goal actions fit above system navigation at $width', ( | ||
| tester, | ||
| ) async { | ||
| await openSheet(tester, completed: completed, width: width); | ||
| final done = find.widgetWithText(FilledButton, 'Done'); | ||
| final delete = find.widgetWithText(OutlinedButton, completed ? 'Delete goal' : 'Delete'); | ||
| expect(done.hitTestable(), findsOneWidget); | ||
| expect(delete.hitTestable(), findsOneWidget); | ||
| expect(find.byTooltip('Close').hitTestable(), findsOneWidget); | ||
| expect(tester.getRect(done).bottom, lessThanOrEqualTo(652)); | ||
| expect(tester.getRect(delete).top, tester.getRect(done).top); | ||
| expect(tester.getRect(delete).height, tester.getRect(done).height); | ||
| expect(tester.takeException(), isNull); | ||
| await tester.tap(done); | ||
| await tester.pumpAndSettle(); | ||
| expect(find.byType(AppBottomSheet), findsNothing); | ||
| }); | ||
| } | ||
|
|
||
| testWidgets('${completed ? 'completed' : 'active'} goal header closes the sheet', (tester) async { | ||
| await openSheet(tester, completed: completed); | ||
| await tester.tap(find.byTooltip('Close')); | ||
| await tester.pumpAndSettle(); | ||
| expect(find.byType(AppBottomSheet), findsNothing); | ||
| }); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
On devices with nonzero horizontal safe-area padding that still select
MobileAuthLayout—for example, a notched phone in landscape at 600–839 logical pixels—the defaultleftandrightsettings also inset the entire column. This narrowsCompactAuthHeaderand leaves surface-colored gutters beside the formerly full-width clipped hero, even though this change only needs bottom protection; disable the horizontal insets or apply the bottom safe area below the hero.AGENTS.md reference: AGENTS.md:L22-L24
Useful? React with 👍 / 👎.