Skip to content

Commit

Permalink
fix: show radio searching page when searchQuery is null (#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier authored Aug 24, 2024
1 parent cd6b7ba commit f1292a1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/search/view/sliver_radio_search_results.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,14 @@ class _SliverRadioSearchResultsState extends State<SliverRadioSearchResults> {

@override
Widget build(BuildContext context) {
final isOnline = watchPropertyValue((ConnectivityModel m) => m.isOnline);
final connectedHost = watchPropertyValue((RadioModel m) => m.connectedHost);

if (!isOnline) {
if (!watchPropertyValue((ConnectivityModel m) => m.isOnline)) {
return const SliverFillRemaining(
hasScrollBody: false,
child: OfflineBody(),
);
}

if (connectedHost == null) {
if (watchPropertyValue((RadioModel m) => m.connectedHost) == null) {
return const SliverFillRemaining(
hasScrollBody: false,
);
Expand All @@ -73,15 +70,15 @@ class _SliverRadioSearchResultsState extends State<SliverRadioSearchResults> {
final searchType = watchPropertyValue((SearchModel m) => m.searchType);
final loading = watchPropertyValue((SearchModel m) => m.loading);

if (radioSearchResult == null ||
(searchQuery?.isEmpty == true && radioSearchResult.isEmpty == true)) {
if (searchQuery == null ||
radioSearchResult == null ||
(searchQuery.isEmpty == true && radioSearchResult.isEmpty == true)) {
return SliverFillNoSearchResultPage(
icon: const AnimatedEmoji(AnimatedEmojis.drum),
message:
Text('${context.l10n.search} ${searchType.localize(context.l10n)}'),
);
}

if (radioSearchResult.isEmpty && !loading) {
return SliverFillNoSearchResultPage(
icon: const AnimatedEmoji(AnimatedEmojis.rabbit),
Expand Down

0 comments on commit f1292a1

Please sign in to comment.