fix(map): a region is picked on a screen of its own, and a country's map offered once it is picked

The composer showed the map inside its scrolling page, so zooming and
scrolling fought over the wheel. A map question's answer is now a field
that opens the map in the whole window, as a studyset's description is
written, with Save in the app bar; nothing scrolls there, so the wheel
alone zooms. The Prefectures chip stood beside East Asia's countries
before Japan was picked; it now shows once Japan, or a prefecture, is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMm7usAo6q9ZZRoPkWjoxi
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-12 18:02:15 +02:00
commit 3181223940
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -19,7 +19,7 @@ void main() {
});
/// Shows the maps at a phone's size, anew unless [key] is the one shown;
/// what is picked lands in the list.
/// what is picked lands in the list, and shows as picked.
Future<List<String>> show(
WidgetTester tester, {
Key? key,
@ -34,6 +34,7 @@ void main() {
..devicePixelRatio = 1;
addTearDown(tester.view.reset);
final picked = <String>[];
final shown = key ?? UniqueKey();
await tester.pumpWidget(
MaterialApp(
theme: appTheme(Brightness.light),
@ -42,14 +43,19 @@ void main() {
home: Scaffold(
body: Padding(
padding: const EdgeInsets.all(16),
child: RegionMap(
key: key ?? UniqueKey(),
atlas: atlas,
countryTaps: countryTaps,
around: around,
right: right,
wrong: wrong,
onRegionTapped: readOnly ? null : picked.add,
child: StatefulBuilder(
builder: (context, setState) => RegionMap(
key: shown,
atlas: atlas,
countryTaps: countryTaps,
around: around,
selected: picked.lastOrNull,
right: right,
wrong: wrong,
onRegionTapped: readOnly
? null
: (code) => setState(() => picked.add(code)),
),
),
),
),
@ -96,11 +102,12 @@ void main() {
const tokyo = (139.69, 35.69);
testWidgets('Japan is picked in East Asia, and a chip opens its '
'prefectures in layers; Back goes up one', (tester) async {
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);
await choose(tester, 'East Asia');
expect(chip('Prefectures'), findsNothing);
await tapAt(tester, tokyo);
expect(picked, ['JP']);
@ -130,6 +137,11 @@ void main() {
await tester.tap(back('East Asia'));
await tester.pumpAndSettle();
expect(find.text('East Asia'), findsOneWidget);
// Osaka is within Japan; Seoul isn't.
expect(chip('Prefectures'), findsOneWidget);
await tapAt(tester, (126.98, 37.57));
expect(picked.last, 'KR');
expect(chip('Prefectures'), findsNothing);
await tester.tap(back('World'));
await tester.pumpAndSettle();
expect(chip('Europe'), findsOneWidget);