diff --git a/lib/home/home.dart b/lib/home/home.dart index eea1ca1..39bc5a3 100644 --- a/lib/home/home.dart +++ b/lib/home/home.dart @@ -546,6 +546,7 @@ class __PlaylistButtonState extends State<_PlaylistButton> { var audio = context.watch(); final s = context.s; return Material( + color: Colors.transparent, child: MyPopupMenuButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(10))), diff --git a/lib/home/pocast_discovery.dart b/lib/home/pocast_discovery.dart index 3099772..ca39b96 100644 --- a/lib/home/pocast_discovery.dart +++ b/lib/home/pocast_discovery.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:line_icons/line_icons.dart'; import 'package:provider/provider.dart'; import '../local_storage/key_value_storage.dart'; @@ -171,9 +172,49 @@ class DiscoveryPageState extends State { future: _getHideDiscovery(), initialData: true, builder: (context, snapshot) => snapshot.data - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [_historyList(), Spacer()], + ? SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _historyList(), + SizedBox(height: 100), + SizedBox( + height: 150, + child: Center( + child: Icon( + Icons.search, + size: 80, + color: Colors.grey[400], + ), + ), + ), + SizedBox( + height: 50, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + LineIcons.microphone_solid, + size: 30, + color: Colors.redAccent, + ), + SizedBox(width: 50), + Icon( + LineIcons.broadcast_tower_solid, + size: 30, + color: Colors.deepPurple, + ), + SizedBox(width: 50), + Icon( + LineIcons.rss_square_solid, + size: 30, + color: Colors.blueGrey, + ), + ], + ), + ), + ], + ), ) : PodcastSlideup( searchEngine: SearchEngine.listenNotes, diff --git a/lib/home/search_podcast.dart b/lib/home/search_podcast.dart index 523dfe8..ed2e356 100644 --- a/lib/home/search_podcast.dart +++ b/lib/home/search_podcast.dart @@ -128,25 +128,16 @@ class MyHomePageDelegate extends SearchDelegate { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), elevation: 1, - icon: snapshot.data == SearchEngine.podcastIndex - ? SizedBox( - height: 30, - width: 30, - child: CircleAvatar( - backgroundImage: AssetImage('assets/podcastindex_logo.png'), - backgroundColor: Colors.redAccent[700].withAlpha(70), - maxRadius: 25, - ), - ) - : SizedBox( - height: 30, - width: 30, - child: CircleAvatar( - backgroundImage: AssetImage('assets/listennotes_logo.png'), - backgroundColor: Colors.red.withAlpha(70), - maxRadius: 25, - ), - ), + icon: SizedBox( + height: 30, + width: 30, + child: CircleAvatar( + backgroundImage: snapshot.data == SearchEngine.podcastIndex + ? AssetImage('assets/podcastindex_logo.png') + : AssetImage('assets/listennotes_logo.png'), + maxRadius: 25, + ), + ), onSelected: (value) { _searchEngine = value; showSuggestions(context); @@ -175,7 +166,7 @@ class MyHomePageDelegate extends SearchDelegate { padding: EdgeInsets.only(left: 10), child: Row( children: [ - Text('PodcastIndex'), + Text('Podcastindex'), Spacer(), if (_searchEngine == SearchEngine.podcastIndex) DotIndicator() @@ -186,6 +177,7 @@ class MyHomePageDelegate extends SearchDelegate { ], ), ), + SizedBox(width: 10), ]; } @@ -509,7 +501,19 @@ class __ListenNotesSearchState extends State<_ListenNotesSearch> { ) ], ), - ) + ), + SliverToBoxAdapter( + child: SizedBox( + height: 20, + child: Center( + child: Image( + image: context.brightness == Brightness.light + ? AssetImage('assets/listennotes.png') + : AssetImage('assets/listennotes_light.png'), + height: 15, + ), + ), + )) ], ); }, @@ -531,6 +535,7 @@ class __PodcastIndexSearchState extends State<_PodcastIndexSearch> { bool _loading; Future _searchFuture; List _podcastList = []; + final _searchEngine = PodcastsIndexSearch(); Future _saveHistory(String query) async { final storage = KeyValueStorage(searchHistoryKey); @@ -554,10 +559,9 @@ class __PodcastIndexSearchState extends State<_PodcastIndexSearch> { Future> _getPodcatsIndexList(String searchText, {int limit}) async { - if (_limit == 20) _saveHistory(searchText); - final searchEngine = PodcastsIndexSearch(); - var searchResult = - await searchEngine.searchPodcasts(searchText: searchText, limit: limit); + if (_limit == 10) _saveHistory(searchText); + var searchResult = await _searchEngine.searchPodcasts( + searchText: searchText, limit: limit); var list = searchResult.feeds.cast(); _podcastList = [ for (var podcast in list) podcast.toOnlinePodcast @@ -626,7 +630,17 @@ class __PodcastIndexSearchState extends State<_PodcastIndexSearch> { ) ], ), - ) + ), + SliverToBoxAdapter( + child: SizedBox( + height: 20, + child: Center( + child: Image( + image: AssetImage('assets/podcastindex.png'), + height: 15, + ), + ), + )) ], ); }), diff --git a/lib/service/search_api.dart b/lib/service/search_api.dart index 4795abc..687d1f7 100644 --- a/lib/service/search_api.dart +++ b/lib/service/search_api.dart @@ -104,9 +104,9 @@ class PodcastsIndexSearch { } Future> searchPodcasts( - {String searchText, int limit}) async { + {String searchText, int limit = 99}) async { final url = "$_baseUrl/api/1.0/search/byterm" - "?q=${Uri.encodeComponent(searchText)}&max=$limit"; + "?q=${Uri.encodeComponent(searchText)}&max=$limit&fulltext=true"; final headers = _initSearch(); final response = await _dio.get(url, options: Options(headers: headers)); Map searchResultMap = jsonDecode(response.toString()); diff --git a/lib/state/refresh_podcast.dart b/lib/state/refresh_podcast.dart index 438cceb..7450c1a 100644 --- a/lib/state/refresh_podcast.dart +++ b/lib/state/refresh_podcast.dart @@ -57,6 +57,10 @@ class RefreshWorker extends ChangeNotifier { Future start(List podcasts) async { if (!_created) { + if (podcasts.isEmpty) { + final refreshstorage = KeyValueStorage(refreshdateKey); + await refreshstorage.saveInt(DateTime.now().millisecondsSinceEpoch); + } _complete = false; await _createIsolate(); _listen(podcasts); @@ -79,8 +83,6 @@ Future refreshIsolateEntryPoint(SendPort sendPort) async { Future _refreshAll(List podcasts) async { var podcastList; if (podcasts.isEmpty) { - var refreshstorage = KeyValueStorage(refreshdateKey); - await refreshstorage.saveInt(DateTime.now().millisecondsSinceEpoch); podcastList = await _dbHelper.getPodcastLocalAll(updateOnly: true); } else { podcastList = await _dbHelper.getPodcastLocal(podcasts, updateOnly: true);