fix(#443): size channel empty-states to the viewport, not full screen (Gemini review)

Gemini pass 2 flagged that the banner shrinks the viewport while the "no
channels" / "no results" empty-states used a fixed MediaQuery.height - N
SizedBox, pushing the message below the fold. Replace both with
LayoutBuilder + SingleChildScrollView + ConstrainedBox(minHeight:
constraints.maxHeight) so they center in the actual available space (banner
or not) and stay pull-to-refresh scrollable. Removes the fragile -200/-300
magic numbers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pull/460/head
Strycher 2 months ago
parent 844cf69800
commit 51a20cbfcc

@ -157,10 +157,13 @@ class _ChannelsScreenState extends State<ChannelsScreen>
} }
if (channels.isEmpty) { if (channels.isEmpty) {
return ListView( return LayoutBuilder(
children: [ builder: (context, constraints) => SingleChildScrollView(
SizedBox( physics: const AlwaysScrollableScrollPhysics(),
height: MediaQuery.of(context).size.height - 200, child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.maxHeight,
),
child: EmptyState( child: EmptyState(
icon: Icons.tag, icon: Icons.tag,
title: context.l10n.channels_noChannelsConfigured, title: context.l10n.channels_noChannelsConfigured,
@ -171,7 +174,7 @@ class _ChannelsScreenState extends State<ChannelsScreen>
), ),
), ),
), ),
], ),
); );
} }
@ -232,32 +235,37 @@ class _ChannelsScreenState extends State<ChannelsScreen>
), ),
Expanded( Expanded(
child: filteredChannels.isEmpty child: filteredChannels.isEmpty
? ListView( ? LayoutBuilder(
children: [ builder: (context, constraints) =>
SizedBox( SingleChildScrollView(
height: MediaQuery.of(context).size.height - 300, physics: const AlwaysScrollableScrollPhysics(),
child: Center( child: ConstrainedBox(
child: Column( constraints: BoxConstraints(
mainAxisAlignment: MainAxisAlignment.center, minHeight: constraints.maxHeight,
children: [ ),
Icon( child: Center(
Icons.search_off, child: Column(
size: 64, mainAxisAlignment:
color: Colors.grey[400], MainAxisAlignment.center,
children: [
Icon(
Icons.search_off,
size: 64,
color: Colors.grey[400],
),
const SizedBox(height: 16),
Text(
context.l10n.channels_noChannelsFound,
style: TextStyle(
fontSize: 16,
color: Colors.grey[600],
),
),
],
), ),
const SizedBox(height: 16), ),
Text(
context.l10n.channels_noChannelsFound,
style: TextStyle(
fontSize: 16,
color: Colors.grey[600],
),
),
],
), ),
), ),
),
],
) )
: (viewState.channelsSortOption == : (viewState.channelsSortOption ==
ChannelSortOption.manual && ChannelSortOption.manual &&

Loading…
Cancel
Save

Powered by TurnKey Linux.