mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Changing pages in the notifications or devices list gave no cue that the next page was loading. Render an indeterminate progress bar at the shell level, pinned flush against the bottom of the page body (above the nav bar on phones, the screen bottom on wide layouts), driven by a shared paginationLoading notifier the lists set while fetching. The pagination bar keeps disabling its buttons during the fetch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
51 lines
1.5 KiB
Dart
51 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:frontend/theme/gruvbox_theme.dart';
|
|
import 'package:frontend/widgets/pagination_progress.dart';
|
|
|
|
void main() {
|
|
tearDown(() => paginationLoading.value = false);
|
|
|
|
testWidgets('shows the bar only while paginationLoading is set', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: gruvboxDarkTheme,
|
|
home: const Scaffold(
|
|
body: PaginationProgressOverlay(child: SizedBox.expand()),
|
|
),
|
|
),
|
|
);
|
|
|
|
expect(find.byType(LinearProgressIndicator), findsNothing);
|
|
|
|
paginationLoading.value = true;
|
|
await tester.pump();
|
|
expect(find.byType(LinearProgressIndicator), findsOneWidget);
|
|
|
|
paginationLoading.value = false;
|
|
await tester.pump();
|
|
expect(find.byType(LinearProgressIndicator), findsNothing);
|
|
});
|
|
|
|
testWidgets('pins the bar flush against the bottom edge', (tester) async {
|
|
paginationLoading.value = true;
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: gruvboxDarkTheme,
|
|
home: const Scaffold(
|
|
body: PaginationProgressOverlay(child: SizedBox.expand()),
|
|
),
|
|
),
|
|
);
|
|
await tester.pump();
|
|
|
|
final overlayRect = tester.getRect(find.byType(PaginationProgressOverlay));
|
|
final barRect = tester.getRect(find.byType(LinearProgressIndicator));
|
|
expect(barRect.bottom, overlayRect.bottom);
|
|
expect(barRect.left, overlayRect.left);
|
|
expect(barRect.right, overlayRect.right);
|
|
});
|
|
}
|