feat(app): cite sources in APA, MLA or Chicago, and give studysets a bibliography

A source is now shared by learning paths and studysets (core/citation/):
authors as full names, year, title, what it is a part of, publisher,
ISBN, link, and a citation kept as a file brought it. formatCitation
cites it in APA 7, MLA 9 or Chicago 18: it inverts and abbreviates
names itself (particles, suffixes, names written as already cited stay),
sets a work of its own in italics and a part of something apart from
the whole, and writes a missing year as "n.d." in APA and Chicago.

- Settings: a Citations card per device, with a preview and a link to
  the style's own guide.
- Studysets: a Bibliography button opens the works cited, to read and,
  behind its pencil, to change (studyset schema 4).
- Steps: sources edited through the same sheet, opened from an
  "N sources" button in the runner (step schema 2; schema 1 reads on).
- Path import: steps' sources, text kept as written, the old format's
  "citation" read as what a source is part of.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-07 17:07:04 +02:00
commit 65976ae63a
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -1,4 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:halkyon_learn_flutter/src/core/citation/model/citation.dart';
import 'package:halkyon_learn_flutter/src/core/device_settings/model/device_settings.dart';
import 'package:halkyon_learn_flutter/src/core/router/route_paths.dart';
import 'package:halkyon_learn_flutter/src/core/version/app_version.dart';
@ -26,7 +27,7 @@ void main() {
await tester.tap(find.byTooltip('Settings'));
await tester.pumpAndSettle();
expect(find.text('Account'), findsOneWidget);
expect(find.text('Appearance'), findsOneWidget);
});
testWidgets('shows the version and build at the bottom', (tester) async {
@ -38,7 +39,12 @@ void main() {
location: RoutePaths.settings,
);
await tester.scrollUntilVisible(find.text('Version 1.2.3 (build 45)'), 200);
await tester.scrollUntilVisible(
find.text('Version 1.2.3 (build 45)'),
200,
// The preview's citation is selectable, a scroll view of its own.
scrollable: find.byType(Scrollable).first,
);
expect(find.text('Version 1.2.3 (build 45)'), findsOneWidget);
});
@ -77,6 +83,31 @@ void main() {
expect(brightnessAt(tester, find.text('Appearance')), Brightness.light);
});
testWidgets('the citation style chosen shows on a sample at once and is '
'kept', (tester) async {
final store = MemoryDeviceSettingsStore();
await pumpApp(
tester,
testDependencies(deviceSettingsStore: store),
location: RoutePaths.settings,
);
await tester.scrollUntilVisible(
find.text('Official guide'),
200,
scrollable: find.byType(Scrollable).first,
);
expect(find.textContaining('Brown, P. C., Roediger'), findsOneWidget);
await choose(tester, 'APA (7th edition)', 'MLA (9th edition)');
expect(find.textContaining('Brown, Peter C., et al.'), findsOneWidget);
expect(
store.writes.last,
const DeviceSettings(citationStyle: CitationStyle.mla),
);
});
testWidgets('starts with the appearance the device kept', (tester) async {
tester.platformDispatcher.platformBrightnessTestValue = Brightness.dark;
addTearDown(tester.platformDispatcher.clearPlatformBrightnessTestValue);