Skip to content

plans: fix overflow in plan edit dialog #144

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 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ updates:
- package-ecosystem: "pub"
directory: "/"
schedule:
interval: "weekly"
interval: "monthly"
8 changes: 2 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ jobs:
with:
channel: 'stable'

- run: flutter --version
- run: flutter pub get
- run: dart format --output=none --set-exit-if-changed .
- run: dart analyze --fatal-infos
- run: flutter test
- run: ./check.sh

test-ios:
name: Test iOS
Expand All @@ -41,4 +37,4 @@ jobs:
with:
channel: stable

- run: flutter test integration_test
- run: flutter test integration_test --timeout 2x
6 changes: 6 additions & 0 deletions check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
flutter --version
flutter pub get
dart format --version
dart format --fix --set-exit-if-changed .
dart analyze --fatal-infos
flutter test
45 changes: 38 additions & 7 deletions integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -458,14 +458,19 @@ void main() async {
await tester.pumpAndSettle();

expect(find.byType(Badge), findsNothing);
expect(find.byType(Divider), findsNWidgets(2));
expect(find.byKey(const Key('current-day')), findsOneWidget);
expect(find.byKey(const Key('target-day')), findsOneWidget);
expect(
(tester.firstWidget(find.byKey(const Key('target-day'))) as Divider)
.color,
Colors.green);

await tester.scrollUntilVisible(find.byKey(const Key('current-day')), 50.0);
await tester.pumpAndSettle();

expect(find.byKey(const Key('current-day')), findsOneWidget);

await tester.scrollUntilVisible(find.byKey(const Key('day-81')), -50.0);
await tester.pumpAndSettle();
await tester.tap(find
.descendant(
of: find.byKey(const Key('day-82')),
Expand Down Expand Up @@ -626,11 +631,8 @@ void main() async {

await tester.tap(find.byType(PlanCard).first);
await tester.pumpAndSettle();
await tester.scrollUntilVisible(
find.byKey(const Key('day-365')),
500.0,
maxScrolls: 200,
);
await tester.scrollUntilVisible(find.byKey(const Key('day-365')), 500.0,
maxScrolls: 300);
await tester.pumpAndSettle();
await Future<void>.delayed(Duration(seconds: 2));
await tester.tap(find
Expand Down Expand Up @@ -882,12 +884,18 @@ void main() async {

await tester.tap(find.byIcon(Icons.edit));
await tester.pumpAndSettle();
await tester.scrollUntilVisible(find.byKey(const Key('show-events')), 50.0,
scrollable: find.byType(Scrollable).last);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('show-events')));
await tester.pumpAndSettle();

var plan = providerContainer.read(plansProvider).plans.first;
expect(plan.showEvents, true);

await tester.scrollUntilVisible(find.byIcon(Icons.done), -50.0,
scrollable: find.byType(Scrollable).last);
await tester.pumpAndSettle();
await tester.tap(find.byIcon(Icons.done));
await tester.pumpAndSettle();

Expand All @@ -897,9 +905,15 @@ void main() async {

await tester.tap(find.byIcon(Icons.edit));
await tester.pumpAndSettle();
await tester.scrollUntilVisible(find.byKey(const Key('show-events')), 50.0,
scrollable: find.byType(Scrollable).last);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('show-events')));
await tester.pumpAndSettle();

await tester.scrollUntilVisible(find.byIcon(Icons.done), -50.0,
scrollable: find.byType(Scrollable).last);
await tester.pumpAndSettle();
await tester.tap(find.byIcon(Icons.done));
await tester.pumpAndSettle();

Expand All @@ -917,12 +931,19 @@ void main() async {

await tester.tap(find.byIcon(Icons.edit));
await tester.pumpAndSettle();
await tester.scrollUntilVisible(
find.byKey(const Key('show-locations')), 50.0,
scrollable: find.byType(Scrollable).last);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('show-locations')));
await tester.pumpAndSettle();

var plan = providerContainer.read(plansProvider).plans.first;
expect(plan.showLocations, true);

await tester.scrollUntilVisible(find.byIcon(Icons.done), -50.0,
scrollable: find.byType(Scrollable).last);
await tester.pumpAndSettle();
await tester.tap(find.byIcon(Icons.done));
await tester.pumpAndSettle();

Expand All @@ -932,9 +953,16 @@ void main() async {

await tester.tap(find.byIcon(Icons.edit));
await tester.pumpAndSettle();
await tester.scrollUntilVisible(
find.byKey(const Key('show-locations')), 50.0,
scrollable: find.byType(Scrollable).last);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('show-locations')));
await tester.pumpAndSettle();

await tester.scrollUntilVisible(find.byIcon(Icons.done), -50.0,
scrollable: find.byType(Scrollable).last);
await tester.pumpAndSettle();
await tester.tap(find.byIcon(Icons.done));
await tester.pumpAndSettle();

Expand Down Expand Up @@ -996,6 +1024,9 @@ void main() async {
matching: find.byType(Text))
.first);
await tester.pumpAndSettle();
await tester.scrollUntilVisible(find.byIcon(Icons.delete).first, 50.0,
scrollable: find.byType(Scrollable).last);
await tester.pumpAndSettle();
await tester.tap(find.byIcon(Icons.delete));
await tester.pumpAndSettle();

Expand Down
90 changes: 46 additions & 44 deletions lib/src/plans/presentations/plan_edit_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,52 +28,54 @@ class PlanEditDialog extends ConsumerWidget {
return Dialog.fullscreen(
child: Form(
key: _formKey,
child: Column(
children: [
Row(children: [
IconButton(
icon: const Icon(Icons.close),
onPressed: () {
planEdit.reset();
WidgetsBinding.instance
.addPostFrameCallback((_) => Navigator.pop(context));
}),
const Spacer(),
IconButton(
icon: const Icon(Icons.done),
onPressed: () {
if (_formKey.currentState!.validate()) {
planEdit.save();
child: SingleChildScrollView(
child: Column(
children: [
Row(children: [
IconButton(
icon: const Icon(Icons.close),
onPressed: () {
planEdit.reset();
WidgetsBinding.instance
.addPostFrameCallback((_) => Navigator.pop(context));
}
})
]),
PlanNameTile(planId),
const SizedBox(height: 20),
if (isNewPlan) PlanTypeSegmentedButton(planId),
if (isNewPlan) const SizedBox(height: 20),
PlanDurationSegmentedButton(planId),
const SizedBox(height: 20),
PlanLanguageTile(planId),
PlanWithTargetDateTile(planId),
if (plan.withTargetDate &&
adjustedTargetDate != null &&
plan.targetDate != adjustedTargetDate)
PlanResetTargetDateTile(planId, adjustedTargetDate),
PlanShowEventsTile(planId),
PlanShowLocationsTile(planId),
if (!isNewPlan)
ElevatedButton.icon(
onPressed: () {
planEdit.delete();
Navigator.popUntil(
context, ModalRoute.withName(PlansPage.routeName));
},
icon: const Icon(Icons.delete),
label:
Text(MaterialLocalizations.of(context).deleteButtonTooltip))
],
}),
const Spacer(),
IconButton(
icon: const Icon(Icons.done),
onPressed: () {
if (_formKey.currentState!.validate()) {
planEdit.save();
WidgetsBinding.instance
.addPostFrameCallback((_) => Navigator.pop(context));
}
})
]),
PlanNameTile(planId),
const SizedBox(height: 20),
if (isNewPlan) PlanTypeSegmentedButton(planId),
if (isNewPlan) const SizedBox(height: 20),
PlanDurationSegmentedButton(planId),
const SizedBox(height: 20),
PlanLanguageTile(planId),
PlanWithTargetDateTile(planId),
if (plan.withTargetDate &&
adjustedTargetDate != null &&
plan.targetDate != adjustedTargetDate)
PlanResetTargetDateTile(planId, adjustedTargetDate),
PlanShowEventsTile(planId),
PlanShowLocationsTile(planId),
if (!isNewPlan)
ElevatedButton.icon(
onPressed: () {
planEdit.delete();
Navigator.popUntil(
context, ModalRoute.withName(PlansPage.routeName));
},
icon: const Icon(Icons.delete),
label: Text(
MaterialLocalizations.of(context).deleteButtonTooltip))
],
),
),
));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/plans/presentations/plan_language_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PlanLanguageTile extends ConsumerWidget {

return ListTile(
title: Text(context.loc.planEditPageLanguageLabel),
trailing: DropdownButton<String>(
subtitle: DropdownButton<String>(
key: const Key('language'),
value: bibleLanguages?.bibleLanguages[plan.language] == null
? 'en'
Expand Down
6 changes: 1 addition & 5 deletions local_build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
flutter --version
flutter pub get
dart format .
dart analyze --fatal-infos
flutter test
./check.sh

if [[ $(uname) == 'Darwin' ]]; then
flutter test integration_test -d macos
Expand Down
Loading