summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-22 10:28:17 +0300
committerPaul Buetow <paul@buetow.org>2026-05-22 10:28:17 +0300
commitee99ef26a45cbcf7595bf77bc315644d59473f30 (patch)
tree73aaeea43af9708abf8f0627318b4ef5a3a8426d
parentd9552904112d0ab86e961b6d8b0844619ce1005a (diff)
Fix gb final review: SizedBox.shrink footer and shares_no_more test
Replace Text('') with SizedBox.shrink() in _buildFooter so dead space and the premature episodes_no_more key are eliminated when more pages exist. Add testWidgets for the shares_no_more footer key. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rw-r--r--player-android/lib/screens/podcast_episodes_screen.dart13
-rw-r--r--player-android/test/screens/my_shares_screen_test.dart12
2 files changed, 22 insertions, 3 deletions
diff --git a/player-android/lib/screens/podcast_episodes_screen.dart b/player-android/lib/screens/podcast_episodes_screen.dart
index 67570b5..4b450fc 100644
--- a/player-android/lib/screens/podcast_episodes_screen.dart
+++ b/player-android/lib/screens/podcast_episodes_screen.dart
@@ -488,9 +488,16 @@ class _EpisodeList extends StatelessWidget {
/// Builds the footer widget appended after the last episode row.
///
- /// Shows a spinner while more pages are loading, or an "All episodes loaded"
- /// text once [hasMore] is false.
+ /// Returns [SizedBox.shrink] when no content is needed (more pages exist and
+ /// no load is in flight), so no dead space or phantom keys appear. Shows a
+ /// spinner while more pages are loading, or an "All episodes loaded" message
+ /// once [hasMore] is false.
Widget _buildFooter(BuildContext context) {
+ // Nothing to display: further pages exist and we are not currently loading.
+ // Return a zero-size widget so the footer slot takes no visual space and
+ // the 'episodes_no_more' key is never leaked into the tree prematurely.
+ if (!isLoadingMore && hasMore) return const SizedBox.shrink();
+
return Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: isLoadingMore
@@ -500,7 +507,7 @@ class _EpisodeList extends StatelessWidget {
)
: Center(
child: Text(
- hasMore ? '' : 'All episodes loaded',
+ 'All episodes loaded',
key: const Key('episodes_no_more'),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
diff --git a/player-android/test/screens/my_shares_screen_test.dart b/player-android/test/screens/my_shares_screen_test.dart
index 111a455..e1703ae 100644
--- a/player-android/test/screens/my_shares_screen_test.dart
+++ b/player-android/test/screens/my_shares_screen_test.dart
@@ -258,6 +258,18 @@ void main() {
// _kShareB.usedCount=0, maxUses=null → "0 uses".
expect(find.textContaining('0 uses'), findsOneWidget);
});
+
+ testWidgets('shows "All shares loaded" footer after a successful load',
+ (tester) async {
+ // The footer is always rendered (MySharesScreen has no pagination) once
+ // the list is non-empty. Verify the key is present in the widget tree.
+ final fakeClient = _FakeApiClient()..sharesResult = [_kShareA, _kShareB];
+
+ await _pumpMySharesScreen(tester, fakeClient);
+ await tester.pumpAndSettle();
+
+ expect(find.byKey(const Key('shares_no_more')), findsOneWidget);
+ });
});
// --------------------------------------------------------------------------