diff --git a/lib/src/reader_page.dart b/lib/src/reader_page.dart index 3e008d5..9e429e5 100644 --- a/lib/src/reader_page.dart +++ b/lib/src/reader_page.dart @@ -495,7 +495,8 @@ class _SurahReaderPageState extends State { child: Stack( children: [ SafeArea( - top: false, + left: false, + right: false, bottom: false, child: Padding( padding: const EdgeInsets.fromLTRB(8, 8, 8, 20), diff --git a/test/widget_test.dart b/test/widget_test.dart index c26e600..b912408 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -413,6 +413,53 @@ void main() { expect(find.text('The Cow'), findsOneWidget); }); + testWidgets( + 'reader swipe keeps the basmala below the toolbar without saved progress', + (tester) async { + tester.view.physicalSize = const Size(400, 700); + tester.view.devicePixelRatio = 1.0; + addTearDown(tester.view.resetPhysicalSize); + addTearDown(tester.view.resetDevicePixelRatio); + + final controller = QuranAppController( + catalogSource: _FakeCatalogSource(), + appStateStore: _MemoryStateStore(), + ); + await controller.load(); + + await tester.pumpWidget( + MaterialApp( + theme: ThemeData(useMaterial3: true), + home: MediaQuery( + data: const MediaQueryData( + padding: EdgeInsets.only(top: 32), + viewPadding: EdgeInsets.only(top: 32), + ), + child: SurahReaderPage( + controller: controller, + surahIndex: 1, + ), + ), + ), + ); + await tester.pumpAndSettle(); + + await tester.drag( + find.byKey(const Key('reader-swipe-area')), + const Offset(220, 0), + ); + await tester.pumpAndSettle(); + + final basmalaRect = tester.getRect( + find.byKey(const Key('reader-basmala-header')), + ); + final progressButtonRect = tester.getRect( + find.byKey(const Key('reader-progress-button')), + ); + + expect(basmalaRect.top, greaterThan(progressButtonRect.bottom)); + }); + testWidgets('reader swipe right to left opens the previous surah', (tester) async { tester.view.physicalSize = const Size(400, 700);