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

@ -12,6 +12,7 @@ void main() {
required double width,
Widget body = const Text('Body'),
double statusBar = 0,
bool busy = false,
}) async {
tester.view.physicalSize = Size(width, 900);
tester.view.devicePixelRatio = 1;
@ -27,8 +28,10 @@ void main() {
builder: (context) => TextButton(
onPressed: () => showAdaptiveSheet<void>(
context,
swipeable: !busy,
builder: (context) => SheetScaffold(
title: 'New studyset',
busy: busy,
body: body,
footer: FilledButton(
onPressed: () {},
@ -105,6 +108,27 @@ void main() {
expect(find.text('New studyset'), findsNothing);
});
testWidgets('while busy, its close button is off and back keeps it open', (
tester,
) async {
await open(tester, width: 400, busy: true);
expect(
tester
.widget<IconButton>(
find.ancestor(
of: find.byTooltip('Close'),
matching: find.byType(IconButton),
),
)
.onPressed,
isNull,
);
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
expect(find.text('New studyset'), findsOneWidget);
});
group('a body longer than the sheet', () {
final tall = Column(
children: [for (var i = 0; i < 40; i++) const Text('Line')],