feat: back is greyed while an import runs, so nothing cuts it off

A sheet can be busy (SheetScaffold.busy): its close button is off and
greyed, and back does nothing until it ends. The Anki import's sheet is
busy while it imports; before, its close button looked as always and
did nothing.

A studyset's screen, while it imports a PDF or a path, greys its back
button and the path's steps and ignores back: leaving would close the
lists' blocs and cut the import off. Importing a path now says so in its
state, as a PDF's did.

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-11 14:10:43 +02:00
commit 2283999ca9
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -0,0 +1,49 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:halkyon_learn_flutter/l10n/app_localizations.dart';
import 'package:halkyon_learn_flutter/src/feature/studyset/widget/studyset_navigation.dart';
import 'package:material_ui/material_ui.dart';
void main() {
Future<void> show(WidgetTester tester, {required bool enabled}) =>
tester.pumpWidget(
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: Scaffold(
body: StudysetBackButton(
ancestors: const [],
all: const [],
enabled: enabled,
),
),
),
);
IconButton button(WidgetTester tester) => tester.widget<IconButton>(
find.descendant(
of: find.byType(StudysetBackButton),
matching: find.byType(IconButton),
),
);
testWidgets('while something runs here, back is greyed and its levels '
'stay closed', (tester) async {
await show(tester, enabled: false);
expect(button(tester).onPressed, isNull);
await tester.longPress(find.byType(StudysetBackButton));
await tester.pumpAndSettle();
expect(find.text('Library'), findsNothing);
});
testWidgets('otherwise back works and holding it lists the levels', (
tester,
) async {
await show(tester, enabled: true);
expect(button(tester).onPressed, isNotNull);
await tester.longPress(find.byType(StudysetBackButton));
await tester.pumpAndSettle();
expect(find.text('Library'), findsOneWidget);
});
}