Minor change.
This commit is contained in:
parent
a70103c3eb
commit
36a23f2de5
|
@ -546,6 +546,7 @@ class __PlaylistButtonState extends State<_PlaylistButton> {
|
||||||
var audio = context.watch<AudioPlayerNotifier>();
|
var audio = context.watch<AudioPlayerNotifier>();
|
||||||
final s = context.s;
|
final s = context.s;
|
||||||
return Material(
|
return Material(
|
||||||
|
color: Colors.transparent,
|
||||||
child: MyPopupMenuButton<int>(
|
child: MyPopupMenuButton<int>(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(10))),
|
borderRadius: BorderRadius.all(Radius.circular(10))),
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:line_icons/line_icons.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../local_storage/key_value_storage.dart';
|
import '../local_storage/key_value_storage.dart';
|
||||||
|
@ -171,9 +172,49 @@ class DiscoveryPageState extends State<DiscoveryPage> {
|
||||||
future: _getHideDiscovery(),
|
future: _getHideDiscovery(),
|
||||||
initialData: true,
|
initialData: true,
|
||||||
builder: (context, snapshot) => snapshot.data
|
builder: (context, snapshot) => snapshot.data
|
||||||
? Column(
|
? SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [_historyList(), Spacer()],
|
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(
|
: PodcastSlideup(
|
||||||
searchEngine: SearchEngine.listenNotes,
|
searchEngine: SearchEngine.listenNotes,
|
||||||
|
|
|
@ -128,22 +128,13 @@ class MyHomePageDelegate extends SearchDelegate<int> {
|
||||||
shape:
|
shape:
|
||||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||||
elevation: 1,
|
elevation: 1,
|
||||||
icon: snapshot.data == SearchEngine.podcastIndex
|
icon: SizedBox(
|
||||||
? SizedBox(
|
|
||||||
height: 30,
|
height: 30,
|
||||||
width: 30,
|
width: 30,
|
||||||
child: CircleAvatar(
|
child: CircleAvatar(
|
||||||
backgroundImage: AssetImage('assets/podcastindex_logo.png'),
|
backgroundImage: snapshot.data == SearchEngine.podcastIndex
|
||||||
backgroundColor: Colors.redAccent[700].withAlpha(70),
|
? AssetImage('assets/podcastindex_logo.png')
|
||||||
maxRadius: 25,
|
: AssetImage('assets/listennotes_logo.png'),
|
||||||
),
|
|
||||||
)
|
|
||||||
: SizedBox(
|
|
||||||
height: 30,
|
|
||||||
width: 30,
|
|
||||||
child: CircleAvatar(
|
|
||||||
backgroundImage: AssetImage('assets/listennotes_logo.png'),
|
|
||||||
backgroundColor: Colors.red.withAlpha(70),
|
|
||||||
maxRadius: 25,
|
maxRadius: 25,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -175,7 +166,7 @@ class MyHomePageDelegate extends SearchDelegate<int> {
|
||||||
padding: EdgeInsets.only(left: 10),
|
padding: EdgeInsets.only(left: 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text('PodcastIndex'),
|
Text('Podcastindex'),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
if (_searchEngine == SearchEngine.podcastIndex)
|
if (_searchEngine == SearchEngine.podcastIndex)
|
||||||
DotIndicator()
|
DotIndicator()
|
||||||
|
@ -186,6 +177,7 @@ class MyHomePageDelegate extends SearchDelegate<int> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
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;
|
bool _loading;
|
||||||
Future _searchFuture;
|
Future _searchFuture;
|
||||||
List _podcastList = [];
|
List _podcastList = [];
|
||||||
|
final _searchEngine = PodcastsIndexSearch();
|
||||||
|
|
||||||
Future<void> _saveHistory(String query) async {
|
Future<void> _saveHistory(String query) async {
|
||||||
final storage = KeyValueStorage(searchHistoryKey);
|
final storage = KeyValueStorage(searchHistoryKey);
|
||||||
|
@ -554,10 +559,9 @@ class __PodcastIndexSearchState extends State<_PodcastIndexSearch> {
|
||||||
|
|
||||||
Future<List<OnlinePodcast>> _getPodcatsIndexList(String searchText,
|
Future<List<OnlinePodcast>> _getPodcatsIndexList(String searchText,
|
||||||
{int limit}) async {
|
{int limit}) async {
|
||||||
if (_limit == 20) _saveHistory(searchText);
|
if (_limit == 10) _saveHistory(searchText);
|
||||||
final searchEngine = PodcastsIndexSearch();
|
var searchResult = await _searchEngine.searchPodcasts(
|
||||||
var searchResult =
|
searchText: searchText, limit: limit);
|
||||||
await searchEngine.searchPodcasts(searchText: searchText, limit: limit);
|
|
||||||
var list = searchResult.feeds.cast();
|
var list = searchResult.feeds.cast();
|
||||||
_podcastList = <OnlinePodcast>[
|
_podcastList = <OnlinePodcast>[
|
||||||
for (var podcast in list) podcast.toOnlinePodcast
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
))
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -104,9 +104,9 @@ class PodcastsIndexSearch {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<PodcastIndexSearchResult<dynamic>> searchPodcasts(
|
Future<PodcastIndexSearchResult<dynamic>> searchPodcasts(
|
||||||
{String searchText, int limit}) async {
|
{String searchText, int limit = 99}) async {
|
||||||
final url = "$_baseUrl/api/1.0/search/byterm"
|
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 headers = _initSearch();
|
||||||
final response = await _dio.get(url, options: Options(headers: headers));
|
final response = await _dio.get(url, options: Options(headers: headers));
|
||||||
Map searchResultMap = jsonDecode(response.toString());
|
Map searchResultMap = jsonDecode(response.toString());
|
||||||
|
|
|
@ -57,6 +57,10 @@ class RefreshWorker extends ChangeNotifier {
|
||||||
|
|
||||||
Future<void> start(List<String> podcasts) async {
|
Future<void> start(List<String> podcasts) async {
|
||||||
if (!_created) {
|
if (!_created) {
|
||||||
|
if (podcasts.isEmpty) {
|
||||||
|
final refreshstorage = KeyValueStorage(refreshdateKey);
|
||||||
|
await refreshstorage.saveInt(DateTime.now().millisecondsSinceEpoch);
|
||||||
|
}
|
||||||
_complete = false;
|
_complete = false;
|
||||||
await _createIsolate();
|
await _createIsolate();
|
||||||
_listen(podcasts);
|
_listen(podcasts);
|
||||||
|
@ -79,8 +83,6 @@ Future<void> refreshIsolateEntryPoint(SendPort sendPort) async {
|
||||||
Future<void> _refreshAll(List<String> podcasts) async {
|
Future<void> _refreshAll(List<String> podcasts) async {
|
||||||
var podcastList;
|
var podcastList;
|
||||||
if (podcasts.isEmpty) {
|
if (podcasts.isEmpty) {
|
||||||
var refreshstorage = KeyValueStorage(refreshdateKey);
|
|
||||||
await refreshstorage.saveInt(DateTime.now().millisecondsSinceEpoch);
|
|
||||||
podcastList = await _dbHelper.getPodcastLocalAll(updateOnly: true);
|
podcastList = await _dbHelper.getPodcastLocalAll(updateOnly: true);
|
||||||
} else {
|
} else {
|
||||||
podcastList = await _dbHelper.getPodcastLocal(podcasts, updateOnly: true);
|
podcastList = await _dbHelper.getPodcastLocal(podcasts, updateOnly: true);
|
||||||
|
|
Loading…
Reference in New Issue