Skip to content

Commit

Permalink
schedules: add note how to start anywhere on new schedule
Browse files Browse the repository at this point in the history
Closes #76
  • Loading branch information
wfleischer committed Dec 3, 2024
1 parent 02a5fe0 commit d1611fe
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 43 deletions.
1 change: 1 addition & 0 deletions assets/localization/app_cs.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"plansPageNoPlanYet": "Zatím žádný plán čtení Bible. Přidej jeden.",
"plansPageAddPlanTooltip": "Přidat",
"plansPageCardRemainingDays": "{remainingDays}d",
"schedulePageContinueNotice": "Úspěšně jsi vytvořil nový plán čtení Bible! Chceš-li pokračovat v rozvrhu, který jsi již začal, jednoduše vyber poslední část, kterou jsi četl.",
"schedulePageCardWeekday": "{date}",
"schedulePageJumpToBookmarkTooltip": "Přejít na záložku",
"schedulePageEventPrefixTerm": "{prefix, select, a{po} b{př.} other{asi}}",
Expand Down
1 change: 1 addition & 0 deletions assets/localization/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"plansPageNoPlanYet": "Noch kein Bibel-Leseplan. Füge einen hinzu.",
"plansPageAddPlanTooltip": "Hinzufügen",
"plansPageCardRemainingDays": "{remainingDays}T",
"schedulePageContinueNotice": "Du hast erfolgreich einen neuen Bibelleseplan erstellt! Um mit einem bereits begonnenen Leseprogramm fortzufahren, wähle einfach den letzten Abschnitt aus, den du gelesen hast.",
"schedulePageCardWeekday": "{date}",
"schedulePageJumpToBookmarkTooltip": "Springe zum Lesezeichen",
"schedulePageEventPrefixTerm": "{prefix, select, a{n.} b{v.} other{um}}",
Expand Down
4 changes: 4 additions & 0 deletions assets/localization/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
}
}
},
"schedulePageContinueNotice": "You have successfully created a new Bible reading plan! To continue with a schedule you have already started, simply select the last section you read.",
"@schedulePageContinueNotice": {
"description": "The notice displayed at the top of the schedule page for a new plan."
},
"schedulePageCardWeekday": "{date}",
"@schedulePageCardWeekday": {
"description": "Displaying the weekday on the day card on the schedule page.",
Expand Down
1 change: 1 addition & 0 deletions assets/localization/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"plansPageNoPlanYet": "Aún no hay un plan de lectura de la Biblia. Añade uno.",
"plansPageAddPlanTooltip": "Añadir",
"plansPageCardRemainingDays": "{remainingDays}d",
"schedulePageContinueNotice": "Has creado con éxito un nuevo plan de lectura de la Biblia. Para continuar con un plan que ya has comenzado, simplemente selecciona la última sección que has leído.",
"schedulePageCardWeekday": "{date}",
"schedulePageJumpToBookmarkTooltip": "Saltar al marcador",
"schedulePageEventPrefixTerm": "{prefix, select, a{a.} b{d.} other{c.}}",
Expand Down
1 change: 1 addition & 0 deletions assets/localization/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"plansPageNoPlanYet": "Pas encore de plan de lecture de la Bible. Ajoute-en un.",
"plansPageAddPlanTooltip": "Ajouter",
"plansPageCardRemainingDays": "{remainingDays}j",
"schedulePageContinueNotice": "Tu as créé avec succès un nouveau plan de lecture de la Bible ! Pour continuer avec un plan que tu as déjà commencé, sélectionne simplement la dernière section que tu as lue.",
"schedulePageCardWeekday": "{date}",
"schedulePageJumpToBookmarkTooltip": "Aller au marque-page",
"schedulePageEventPrefixTerm": "{prefix, select, a{apr.} b{av.} other{env.}}",
Expand Down
1 change: 1 addition & 0 deletions assets/localization/app_hu.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"plansPageNoPlanYet": "Még nincs bibliaolvasási terv. Adj hozzá egyet.",
"plansPageAddPlanTooltip": "Hozzáadás",
"plansPageCardRemainingDays": "{remainingDays}n",
"schedulePageContinueNotice": "Sikeresen létrehoztál egy új Bibliaolvasási tervet! Ha folytatni szeretnéd a már megkezdett ütemtervet, egyszerűen válaszd ki az utolsó részt, amit olvastál.",
"schedulePageCardWeekday": "{date}",
"schedulePageJumpToBookmarkTooltip": "Ugrás a könyvjelzőhöz",
"schedulePageEventPrefixTerm": "{prefix, select, a{a.} b{b.} other{c.}}",
Expand Down
1 change: 1 addition & 0 deletions assets/localization/app_it.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"plansPageNoPlanYet": "Ancora nessun piano di lettura della Bibbia. Aggiungine uno.",
"plansPageAddPlanTooltip": "Aggiungi",
"plansPageCardRemainingDays": "{remainingDays}g",
"schedulePageContinueNotice": "Hai creato con successo un nuovo piano di lettura della Bibbia! Per continuare con un piano che hai già iniziato, seleziona semplicemente l''ultima sezione che hai letto.",
"schedulePageCardWeekday": "{date}",
"schedulePageJumpToBookmarkTooltip": "Vai al segnalibro",
"schedulePageEventPrefixTerm": "{prefix, select, a{a.} b{d.} other{ca.}}",
Expand Down
1 change: 1 addition & 0 deletions assets/localization/app_pl.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"plansPageNoPlanYet": "Brak planu czytania Biblii. Dodaj jeden.",
"plansPageAddPlanTooltip": "Dodaj",
"plansPageCardRemainingDays": "{remainingDays}d",
"schedulePageContinueNotice": "Udało ci się stworzyć nowy plan czytania Biblii! Aby kontynuować plan, który już rozpocząłeś, po prostu wybierz ostatnią przeczytaną sekcję.",
"schedulePageCardWeekday": "{date}",
"schedulePageJumpToBookmarkTooltip": "Przejdź do zakładki",
"schedulePageEventPrefixTerm": "{prefix, select, a{po.} b{przed.} other{ok.}}",
Expand Down
1 change: 1 addition & 0 deletions assets/localization/app_pt.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"plansPageNoPlanYet": "Ainda não há um plano de leitura da Bíblia. Adicione um.",
"plansPageAddPlanTooltip": "Adicionar",
"plansPageCardRemainingDays": "{remainingDays}d",
"schedulePageContinueNotice": "Você criou com sucesso um novo plano de leitura da Bíblia! Para continuar com um plano que você já começou, basta selecionar a última seção que você leu.",
"schedulePageCardWeekday": "{date}",
"schedulePageJumpToBookmarkTooltip": "Ir para o marcador",
"schedulePageEventPrefixTerm": "{prefix, select, a{a.} b{d.} other{c.}}",
Expand Down
1 change: 1 addition & 0 deletions assets/localization/app_ro.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"plansPageNoPlanYet": "Încă nu există un plan de citire a Bibliei. Adaugă unul.",
"plansPageAddPlanTooltip": "Adaugă",
"plansPageCardRemainingDays": "{remainingDays}z",
"schedulePageContinueNotice": "Ai creat cu succes un nou plan de citire a Bibliei! Pentru a continua cu un plan pe care l-ai început deja, selectează pur și simplu ultima secțiune pe care ai citit-o.",
"schedulePageCardWeekday": "{date}",
"schedulePageJumpToBookmarkTooltip": "Sari la marcaj",
"schedulePageEventPrefixTerm": "{prefix, select, a{d.} b{î.} other{a.}}",
Expand Down
1 change: 1 addition & 0 deletions assets/localization/app_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"plansPageNoPlanYet": "План чтения Библии пока не добавлен. Добавь один.",
"plansPageAddPlanTooltip": "Добавить",
"plansPageCardRemainingDays": "{remainingDays}д",
"schedulePageContinueNotice": "Ты успешно создал новый план чтения Библии! Чтобы продолжить с планом, который ты уже начал, просто выбери последний прочитанный раздел.",
"schedulePageCardWeekday": "{date}",
"schedulePageJumpToBookmarkTooltip": "Перейти к закладке",
"schedulePageEventPrefixTerm": "{prefix, select, a{a.} b{b.} other{c.}}",
Expand Down
21 changes: 21 additions & 0 deletions integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,27 @@ void main() async {
expect(find.byType(DayCard), findsWidgets);
});

testWidgets('Show continue notice on new plan', (tester) async {
final providerContainer = await getDefaultProviderContainer(tester);
final secondPlanCardFinder = find.byKey(
Key('plan-${providerContainer.read(plansProvider).plans[1].id}'));
await tester.scrollUntilVisible(secondPlanCardFinder, 500.0);
await tester.pumpAndSettle();
await tester.tap(secondPlanCardFinder);
await tester.pumpAndSettle();

expect(find.byKey(const Key('continue-notice')), findsWidgets);

await tester.tap(find
.descendant(
of: find.byKey(const Key('day-2')),
matching: find.byType(IconButton))
.first);
await tester.pumpAndSettle();

expect(find.byKey(const Key('continue-notice')), findsNothing);
});

testWidgets('Return to plans page', (tester) async {
final providerContainer = await getDefaultProviderContainer(tester);
await tester.tap(find.byType(Card).first);
Expand Down
85 changes: 42 additions & 43 deletions lib/src/schedules/presentations/day_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,47 @@ class DayCard extends ConsumerWidget {
final int dayIndex;

@override
Widget build(BuildContext context, WidgetRef ref) {
return Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
children: [
...day.sections.asMap().entries.map((section) => SectionWidget(
key: Key('section-${section.key}'),
planId: planId,
section: section.value,
dayIndex: dayIndex,
sectionIndex: section.key)),
],
)),
Container(
padding: const EdgeInsets.fromLTRB(0, 0, 4, 0),
width: 40,
child: date == null
? Text((dayIndex + 1).toString(),
key: const Key('day-index'),
style: Theme.of(context).textTheme.bodySmall)
: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
date!.day.toString(),
key: const Key('date'),
style: Theme.of(context).textTheme.bodySmall,
),
Text(
context.loc.schedulePageCardWeekday(date!),
style: Theme.of(context).textTheme.bodySmall,
)
],
)),
],
Widget build(BuildContext context, WidgetRef ref) => Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
children: [
...day.sections.asMap().entries.map((section) =>
SectionWidget(
key: Key('section-${section.key}'),
planId: planId,
section: section.value,
dayIndex: dayIndex,
sectionIndex: section.key)),
],
)),
Container(
padding: const EdgeInsets.fromLTRB(0, 0, 4, 0),
width: 40,
child: date == null
? Text((dayIndex + 1).toString(),
key: const Key('day-index'),
style: Theme.of(context).textTheme.bodySmall)
: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
date!.day.toString(),
key: const Key('date'),
style: Theme.of(context).textTheme.bodySmall,
),
Text(
context.loc.schedulePageCardWeekday(date!),
style: Theme.of(context).textTheme.bodySmall,
)
],
)),
],
),
),
),
);
}
);
}
9 changes: 9 additions & 0 deletions lib/src/schedules/presentations/schedule_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ class _SchedulePageState extends ConsumerState<SchedulePage> {
AsyncValue(:final valueOrNull?) => Column(
children: [
LinearProgressIndicator(value: progress),
if (plan.lastDate == null)
Padding(
padding: const EdgeInsets.all(20.0),
child: Text(
context.loc.schedulePageContinueNotice,
key: const Key('continue-notice'),
style: TextStyle(color: Theme.of(context).primaryColor),
),
),
Flexible(
child: CustomScrollView(
controller: controller,
Expand Down

0 comments on commit d1611fe

Please sign in to comment.