Minor change.
This commit is contained in:
parent
1e42cde733
commit
f801fb65f4
|
@ -242,7 +242,7 @@ class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Selector<AudioPlayerNotifier, bool>(
|
Selector<AudioPlayerNotifier, bool>(
|
||||||
selector: (_, audio) => audio.playerRunning,
|
selector: (_, audio) => audio?.playerRunning ?? false,
|
||||||
builder: (_, data, __) {
|
builder: (_, data, __) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: data ? 60.0 : 0),
|
padding: EdgeInsets.only(bottom: data ? 60.0 : 0),
|
||||||
|
|
|
@ -193,7 +193,7 @@ class _PodcastSettingState extends State<PodcastSetting> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final s = context.s;
|
final s = context.s;
|
||||||
final groupList = context.watch<GroupList>();
|
final groupList = context.watch<GroupList>();
|
||||||
final textStyle = context.textTheme.bodyText1;
|
final textStyle = context.textTheme.bodyText2;
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
|
|
@ -16,13 +16,15 @@ import '../type/search_api/searchpodcast.dart';
|
||||||
enum SearchEngine { podcastIndex, listenNotes }
|
enum SearchEngine { podcastIndex, listenNotes }
|
||||||
|
|
||||||
class ListenNotesSearch {
|
class ListenNotesSearch {
|
||||||
|
final _dio = Dio(BaseOptions(connectTimeout: 30000, receiveTimeout: 90000));
|
||||||
|
final _baseUrl = "https://listen-api.listennotes.com/api/v2/";
|
||||||
final _apiKey = environment['apiKey'];
|
final _apiKey = environment['apiKey'];
|
||||||
|
|
||||||
Future<SearchPodcast<dynamic>> searchPodcasts(
|
Future<SearchPodcast<dynamic>> searchPodcasts(
|
||||||
{String searchText, int nextOffset}) async {
|
{String searchText, int nextOffset}) async {
|
||||||
var url = "https://listen-api.listennotes.com/api/v2/search?q="
|
var url = "${_baseUrl}search?q="
|
||||||
"${Uri.encodeComponent(searchText)}${"&sort_by_date=0&type=podcast&offset=$nextOffset"}";
|
"${Uri.encodeComponent(searchText)}${"&sort_by_date=0&type=podcast&offset=$nextOffset"}";
|
||||||
var response = await Dio().get(url,
|
var response = await _dio.get(url,
|
||||||
options: Options(headers: {
|
options: Options(headers: {
|
||||||
'X-ListenAPI-Key': "$_apiKey",
|
'X-ListenAPI-Key': "$_apiKey",
|
||||||
'Accept': "application/json"
|
'Accept': "application/json"
|
||||||
|
@ -35,8 +37,8 @@ class ListenNotesSearch {
|
||||||
Future<SearchEpisodes<dynamic>> fetchEpisode(
|
Future<SearchEpisodes<dynamic>> fetchEpisode(
|
||||||
{String id, int nextEpisodeDate}) async {
|
{String id, int nextEpisodeDate}) async {
|
||||||
var url =
|
var url =
|
||||||
"https://listen-api.listennotes.com/api/v2/podcasts/$id?next_episode_pub_date=$nextEpisodeDate";
|
"${_baseUrl}podcasts/$id?next_episode_pub_date=$nextEpisodeDate";
|
||||||
var response = await Dio().get(url,
|
var response = await _dio.get(url,
|
||||||
options: Options(headers: {
|
options: Options(headers: {
|
||||||
'X-ListenAPI-Key': "$_apiKey",
|
'X-ListenAPI-Key': "$_apiKey",
|
||||||
'Accept': "application/json"
|
'Accept': "application/json"
|
||||||
|
@ -49,7 +51,7 @@ class ListenNotesSearch {
|
||||||
Future<SearchTopPodcast<dynamic>> fetchBestPodcast(
|
Future<SearchTopPodcast<dynamic>> fetchBestPodcast(
|
||||||
{String genre, int page, String region = 'us'}) async {
|
{String genre, int page, String region = 'us'}) async {
|
||||||
var url =
|
var url =
|
||||||
"https://listen-api.listennotes.com/api/v2/best_podcasts?genre_id=$genre&page=$page®ion=$region";
|
"${_baseUrl}best_podcasts?genre_id=$genre&page=$page®ion=$region";
|
||||||
var response = await Dio().get(url,
|
var response = await Dio().get(url,
|
||||||
options: Options(headers: {
|
options: Options(headers: {
|
||||||
'X-ListenAPI-Key': "$_apiKey",
|
'X-ListenAPI-Key': "$_apiKey",
|
||||||
|
|
|
@ -15,6 +15,12 @@ class LanguagesSetting extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LanguagesSettingState extends State<LanguagesSetting> {
|
class _LanguagesSettingState extends State<LanguagesSetting> {
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
findSystemLocale();
|
||||||
|
}
|
||||||
|
|
||||||
_setLocale(Locale locale, {bool systemDefault = false}) async {
|
_setLocale(Locale locale, {bool systemDefault = false}) async {
|
||||||
var localeStorage = KeyValueStorage(localeKey);
|
var localeStorage = KeyValueStorage(localeKey);
|
||||||
if (systemDefault) {
|
if (systemDefault) {
|
||||||
|
@ -43,15 +49,23 @@ class _LanguagesSettingState extends State<LanguagesSetting> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
Widget _langListTile(String lang, {Locale locale}) => ListTile(
|
||||||
void initState() {
|
title: Text(lang, style: context.textTheme.bodyText2),
|
||||||
super.initState();
|
onTap: () => _setLocale(locale),
|
||||||
findSystemLocale();
|
dense: true,
|
||||||
}
|
contentPadding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
|
trailing: Transform.scale(
|
||||||
|
scale: 0.8,
|
||||||
|
child: Radio<Locale>(
|
||||||
|
value: locale,
|
||||||
|
groupValue: Locale(Intl.getCurrentLocale()),
|
||||||
|
onChanged: _setLocale),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final textStyle = context.textTheme.bodyText1;
|
final textStyle = context.textTheme.bodyText2;
|
||||||
final s = context.s;
|
final s = context.s;
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
|
@ -63,75 +77,24 @@ class _LanguagesSettingState extends State<LanguagesSetting> {
|
||||||
? context.accentColor
|
? context.accentColor
|
||||||
: null),
|
: null),
|
||||||
),
|
),
|
||||||
|
dense: true,
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
_setLocale(Locale(Intl.systemLocale), systemDefault: true),
|
_setLocale(Locale(Intl.systemLocale), systemDefault: true),
|
||||||
contentPadding: const EdgeInsets.only(left: 20, right: 20),
|
contentPadding: const EdgeInsets.only(left: 20, right: 20),
|
||||||
),
|
),
|
||||||
Divider(height: 1),
|
_langListTile('English', locale: Locale('en')),
|
||||||
ListTile(
|
_langListTile('简体中文', locale: Locale('zh_Hans')),
|
||||||
title: Text('English',style: textStyle),
|
_langListTile('Français', locale: Locale('fr')),
|
||||||
onTap: () => _setLocale(Locale('en')),
|
_langListTile('Español', locale: Locale('es')),
|
||||||
contentPadding: const EdgeInsets.only(left: 20, right: 20),
|
_langListTile('Português', locale: Locale('pt')),
|
||||||
trailing: Radio<Locale>(
|
_langListTile('Italiano', locale: Locale('it')),
|
||||||
value: Locale('en'),
|
|
||||||
groupValue: Locale(Intl.getCurrentLocale()),
|
|
||||||
onChanged: _setLocale)),
|
|
||||||
Divider(height: 1),
|
|
||||||
ListTile(
|
|
||||||
title: Text('简体中文', style: textStyle),
|
|
||||||
onTap: () => _setLocale(Locale('zh_Hans')),
|
|
||||||
contentPadding: const EdgeInsets.only(left: 20, right: 20),
|
|
||||||
trailing: Radio<Locale>(
|
|
||||||
value: Locale('zh_Hans'),
|
|
||||||
groupValue: Locale(Intl.getCurrentLocale()),
|
|
||||||
onChanged: _setLocale,
|
|
||||||
)),
|
|
||||||
Divider(height: 1),
|
|
||||||
ListTile(
|
|
||||||
title: Text('Français', style: textStyle),
|
|
||||||
onTap: () => _setLocale(Locale('fr')),
|
|
||||||
contentPadding: const EdgeInsets.only(left: 20, right: 20),
|
|
||||||
trailing: Radio<Locale>(
|
|
||||||
value: Locale('fr'),
|
|
||||||
groupValue: Locale(Intl.getCurrentLocale()),
|
|
||||||
onChanged: _setLocale),
|
|
||||||
),
|
|
||||||
Divider(height: 1),
|
|
||||||
ListTile(
|
|
||||||
title: Text('Español',style: textStyle),
|
|
||||||
onTap: () => _setLocale(Locale('es')),
|
|
||||||
contentPadding: const EdgeInsets.only(left: 20, right: 20),
|
|
||||||
trailing: Radio<Locale>(
|
|
||||||
value: Locale('es'),
|
|
||||||
groupValue: Locale(Intl.getCurrentLocale()),
|
|
||||||
onChanged: _setLocale),
|
|
||||||
),
|
|
||||||
Divider(height: 1),
|
|
||||||
ListTile(
|
|
||||||
title: Text('Português',style: textStyle),
|
|
||||||
onTap: () => _setLocale(Locale('pt')),
|
|
||||||
contentPadding: const EdgeInsets.only(left: 20, right: 20),
|
|
||||||
trailing: Radio<Locale>(
|
|
||||||
value: Locale('pt'),
|
|
||||||
groupValue: Locale(Intl.getCurrentLocale()),
|
|
||||||
onChanged: _setLocale),
|
|
||||||
),
|
|
||||||
Divider(height: 1),
|
|
||||||
ListTile(
|
|
||||||
title: Text('Italiano', style: textStyle),
|
|
||||||
onTap: () => _setLocale(Locale('it')),
|
|
||||||
contentPadding: const EdgeInsets.only(left: 20, right: 20),
|
|
||||||
trailing: Radio<Locale>(
|
|
||||||
value: Locale('it'),
|
|
||||||
groupValue: Locale(Intl.getCurrentLocale()),
|
|
||||||
onChanged: _setLocale),
|
|
||||||
),
|
|
||||||
Divider(height: 1),
|
Divider(height: 1),
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
'mailto:<tsacdop.app@gmail.com>?subject=Tsacdop localization project'
|
'mailto:<tsacdop.app@gmail.com>?subject=Tsacdop localization project'
|
||||||
.launchUrl,
|
.launchUrl,
|
||||||
contentPadding: const EdgeInsets.only(left: 20, right: 20),
|
contentPadding: const EdgeInsets.only(left: 20, right: 20),
|
||||||
|
dense: true,
|
||||||
title: Align(
|
title: Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Image(
|
child: Image(
|
||||||
|
|
|
@ -30,6 +30,7 @@ class _SettingsState extends State<Settings> {
|
||||||
url.launchUrl;
|
url.launchUrl;
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
|
dense: true,
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
icon,
|
icon,
|
||||||
size: 20,
|
size: 20,
|
||||||
|
@ -37,6 +38,7 @@ class _SettingsState extends State<Settings> {
|
||||||
title: Text(
|
title: Text(
|
||||||
name,
|
name,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
|
style: context.textTheme.bodyText2,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -193,18 +195,14 @@ class _SettingsState extends State<Settings> {
|
||||||
children: [
|
children: [
|
||||||
_feedbackItem(LineIcons.github, s.feedbackGithub,
|
_feedbackItem(LineIcons.github, s.feedbackGithub,
|
||||||
'https://github.com/stonega/tsacdop/issues'),
|
'https://github.com/stonega/tsacdop/issues'),
|
||||||
Divider(height: 1),
|
|
||||||
_feedbackItem(LineIcons.telegram, s.feedbackTelegram,
|
_feedbackItem(LineIcons.telegram, s.feedbackTelegram,
|
||||||
'https://t.me/joinchat/Bk3LkRpTHy40QYC78PK7Qg'),
|
'https://t.me/joinchat/Bk3LkRpTHy40QYC78PK7Qg'),
|
||||||
Divider(height: 1),
|
|
||||||
_feedbackItem(
|
_feedbackItem(
|
||||||
LineIcons.envelope_open_text_solid,
|
LineIcons.envelope_open_text_solid,
|
||||||
s.feedbackEmail,
|
s.feedbackEmail,
|
||||||
'mailto:<tsacdop.app@gmail.com>?subject=Tsacdop Feedback'),
|
'mailto:<tsacdop.app@gmail.com>?subject=Tsacdop Feedback'),
|
||||||
Divider(height: 1),
|
|
||||||
_feedbackItem(LineIcons.google_play, s.feedbackPlay,
|
_feedbackItem(LineIcons.google_play, s.feedbackPlay,
|
||||||
'https://play.google.com/store/apps/details?id=com.stonegate.tsacdop'),
|
'https://play.google.com/store/apps/details?id=com.stonegate.tsacdop'),
|
||||||
Divider(height: 1),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue