fix(study): a map question names none of Japan's parts before it is answered

The chips above Japan's map (Hokkaidō, Tōhoku, Kantō …) showed while a
prefecture's question was answered: Hokkaidō's and Okinawa's chip was
the answer itself, and the others named the region the prefecture lies
in. A study card now offers them only once checked; tapping the map
still opens the part tapped. The world's continents keep their chips:
shortcuts no question asks for. Writing a question offers them all, as
before.

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-14 17:27:57 +02:00
commit 4eb2640be6
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -28,6 +28,7 @@ void main() {
String? right,
String? wrong,
bool readOnly = false,
bool namesCountryParts = true,
}) async {
tester.view
..physicalSize = const Size(400, 640)
@ -52,6 +53,7 @@ void main() {
selected: picked.lastOrNull,
right: right,
wrong: wrong,
namesCountryParts: namesCountryParts,
onRegionTapped: readOnly
? null
: (code) => setState(() => picked.add(code)),
@ -102,6 +104,35 @@ void main() {
const tokyo = (139.69, 35.69);
testWidgets("while answering, Japan's parts have no chips, which would "
"name the answer or where it lies; the map opens them at a tap, and the "
"world's continents keep theirs", (tester) async {
final picked = await show(
tester,
countryTaps: CountryTaps.open,
// The questions studied, all prefectures: on the whole of Japan.
around: {'JP-13', 'JP-27'},
namesCountryParts: false,
);
expect(back('East Asia'), findsOneWidget);
expect(chip('Hokkaidō'), findsNothing);
expect(chip('Kantō'), findsNothing);
await tapAt(tester, tokyo);
expect(find.text('Kantō'), findsOneWidget);
await tapAt(tester, tokyo);
expect(picked, ['JP-13']);
await tester.tap(back('Japan'));
await tester.pumpAndSettle();
expect(chip('Okinawa'), findsNothing);
await tester.tap(back('East Asia'));
await tester.pumpAndSettle();
await tester.tap(back('World'));
await tester.pumpAndSettle();
expect(chip('Europe'), findsOneWidget);
});
testWidgets('Japan is picked in East Asia, and once it is, a chip opens '
'its prefectures in layers; Back goes up one', (tester) async {
final picked = await show(tester);