mirror of
https://github.com/stonega/tsacdop
synced 2025-02-26 16:27:39 +01:00
🎨 code format
This commit is contained in:
parent
94a93be490
commit
199f3e8a28
@ -25,17 +25,17 @@ import 'messages_ru.dart' as messages_ru;
|
||||
import 'messages_tr.dart' as messages_tr;
|
||||
import 'messages_zh-Hans.dart' as messages_zh_hans;
|
||||
|
||||
typedef Future<dynamic> LibraryLoader();
|
||||
typedef LibraryLoader = Future<dynamic> Function();
|
||||
Map<String, LibraryLoader> _deferredLibraries = {
|
||||
'el': () => new Future.value(null),
|
||||
'en': () => new Future.value(null),
|
||||
'es': () => new Future.value(null),
|
||||
'fr': () => new Future.value(null),
|
||||
'it': () => new Future.value(null),
|
||||
'pt': () => new Future.value(null),
|
||||
'ru': () => new Future.value(null),
|
||||
'tr': () => new Future.value(null),
|
||||
'zh_Hans': () => new Future.value(null),
|
||||
'el': () => Future.value(null),
|
||||
'en': () => Future.value(null),
|
||||
'es': () => Future.value(null),
|
||||
'fr': () => Future.value(null),
|
||||
'it': () => Future.value(null),
|
||||
'pt': () => Future.value(null),
|
||||
'ru': () => Future.value(null),
|
||||
'tr': () => Future.value(null),
|
||||
'zh_Hans': () => Future.value(null),
|
||||
};
|
||||
|
||||
MessageLookupByLibrary? _findExact(String localeName) {
|
||||
@ -69,13 +69,13 @@ Future<bool> initializeMessages(String localeName) async {
|
||||
localeName, (locale) => _deferredLibraries[locale] != null,
|
||||
onFailure: (_) => null);
|
||||
if (availableLocale == null) {
|
||||
return new Future.value(false);
|
||||
return Future.value(false);
|
||||
}
|
||||
var lib = _deferredLibraries[availableLocale];
|
||||
await (lib == null ? new Future.value(false) : lib());
|
||||
initializeInternalMessageLookup(() => new CompositeMessageLookup());
|
||||
await (lib == null ? Future.value(false) : lib());
|
||||
initializeInternalMessageLookup(() => CompositeMessageLookup());
|
||||
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
|
||||
return new Future.value(true);
|
||||
return Future.value(true);
|
||||
}
|
||||
|
||||
bool _messagesExistFor(String locale) {
|
||||
|
@ -13,9 +13,10 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
final messages = MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||
typedef MessageIfAbsent = String Function(
|
||||
String messageStr, List<dynamic> args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'el';
|
||||
|
@ -13,9 +13,10 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
final messages = MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||
typedef MessageIfAbsent = String Function(
|
||||
String messageStr, List<dynamic> args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'en';
|
||||
|
@ -13,9 +13,10 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
final messages = MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||
typedef MessageIfAbsent = String Function(
|
||||
String messageStr, List<dynamic> args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'es';
|
||||
|
@ -13,9 +13,10 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
final messages = MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||
typedef MessageIfAbsent = String Function(
|
||||
String messageStr, List<dynamic> args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'fr';
|
||||
|
@ -13,9 +13,10 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
final messages = MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||
typedef MessageIfAbsent = String Function(
|
||||
String messageStr, List<dynamic> args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'it';
|
||||
|
@ -13,9 +13,10 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
final messages = MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||
typedef MessageIfAbsent = String Function(
|
||||
String messageStr, List<dynamic> args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'pt';
|
||||
|
@ -13,9 +13,10 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
final messages = MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||
typedef MessageIfAbsent = String Function(
|
||||
String messageStr, List<dynamic> args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'ru';
|
||||
|
@ -13,9 +13,10 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
final messages = MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||
typedef MessageIfAbsent = String Function(
|
||||
String messageStr, List<dynamic> args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'tr';
|
||||
|
@ -13,9 +13,10 @@
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/message_lookup_by_library.dart';
|
||||
|
||||
final messages = new MessageLookup();
|
||||
final messages = MessageLookup();
|
||||
|
||||
typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
|
||||
typedef MessageIfAbsent = String Function(
|
||||
String messageStr, List<dynamic> args);
|
||||
|
||||
class MessageLookup extends MessageLookupByLibrary {
|
||||
String get localeName => 'zh_Hans';
|
||||
|
@ -15,6 +15,7 @@ import '../type/podcastlocal.dart';
|
||||
import '../type/sub_history.dart';
|
||||
|
||||
enum Filter { downloaded, liked, search, all }
|
||||
|
||||
const localFolderId = "46e48103-06c7-4fe1-a0b1-68aa7205b7f0";
|
||||
|
||||
class DBHelper {
|
||||
|
@ -964,7 +964,7 @@ class __NewPlaylistState extends State<_NewPlaylist> {
|
||||
final image = img.decodeImage(metadata.albumArt!)!;
|
||||
final thumbnail = img.copyResize(image, width: 300);
|
||||
var uuid = Uuid().v4();
|
||||
File("${dir.path}/$uuid.png")..writeAsBytesSync(img.encodePng(thumbnail));
|
||||
File("${dir.path}/$uuid.png").writeAsBytesSync(img.encodePng(thumbnail));
|
||||
imagePath = "${dir.path}/$uuid.png";
|
||||
primaryColor = await _getColor(File(imagePath));
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ class _PodcastSettingState extends State<PodcastSetting> {
|
||||
));
|
||||
var image = img.decodeImage(imageResponse.data!)!;
|
||||
thumbnail = img.copyResize(image, width: 300);
|
||||
File(filePath)..writeAsBytesSync(img.encodePng(thumbnail));
|
||||
File(filePath).writeAsBytesSync(img.encodePng(thumbnail));
|
||||
_dbHelper.updatePodcastImage(
|
||||
id: widget.podcastLocal!.id, filePath: filePath);
|
||||
print('saved image');
|
||||
|
@ -28,7 +28,7 @@ class ListenNotesSearch {
|
||||
|
||||
Future<SearchPodcast<dynamic>?> searchPodcasts(
|
||||
{String? searchText, int? nextOffset}) async {
|
||||
if(!_validApi) return null;
|
||||
if (!_validApi) return null;
|
||||
var url = "${_baseUrl}search?q="
|
||||
"${Uri.encodeComponent(searchText!)}${"&sort_by_date=0&type=podcast&offset=$nextOffset"}";
|
||||
var response = await _dio.get(url,
|
||||
@ -37,28 +37,29 @@ class ListenNotesSearch {
|
||||
'Accept': "application/json"
|
||||
}));
|
||||
Map searchResultMap = jsonDecode(response.toString());
|
||||
var searchResult = SearchPodcast.fromJson(searchResultMap as Map<String, dynamic>);
|
||||
var searchResult =
|
||||
SearchPodcast.fromJson(searchResultMap as Map<String, dynamic>);
|
||||
return searchResult;
|
||||
}
|
||||
|
||||
Future<SearchEpisodes<dynamic>?> fetchEpisode(
|
||||
{String? id, int? nextEpisodeDate}) async {
|
||||
if(!_validApi) return null;
|
||||
var url =
|
||||
"${_baseUrl}podcasts/$id?next_episode_pub_date=$nextEpisodeDate";
|
||||
if (!_validApi) return null;
|
||||
var url = "${_baseUrl}podcasts/$id?next_episode_pub_date=$nextEpisodeDate";
|
||||
var response = await _dio.get(url,
|
||||
options: Options(headers: {
|
||||
'X-ListenAPI-Key': "$_apiKey",
|
||||
'Accept': "application/json"
|
||||
}));
|
||||
Map searchResultMap = jsonDecode(response.toString());
|
||||
var searchResult = SearchEpisodes.fromJson(searchResultMap as Map<String, dynamic>);
|
||||
var searchResult =
|
||||
SearchEpisodes.fromJson(searchResultMap as Map<String, dynamic>);
|
||||
return searchResult;
|
||||
}
|
||||
|
||||
Future<SearchTopPodcast<dynamic>?> fetchBestPodcast(
|
||||
{String? genre, int? page, String region = 'us'}) async {
|
||||
if(!_validApi) return null;
|
||||
if (!_validApi) return null;
|
||||
var url =
|
||||
"${_baseUrl}best_podcasts?genre_id=$genre&page=$page®ion=$region";
|
||||
var response = await Dio().get(url,
|
||||
@ -67,7 +68,8 @@ class ListenNotesSearch {
|
||||
'Accept': "application/json"
|
||||
}));
|
||||
Map searchResultMap = jsonDecode(response.toString());
|
||||
var searchResult = SearchTopPodcast.fromJson(searchResultMap as Map<String, dynamic>);
|
||||
var searchResult =
|
||||
SearchTopPodcast.fromJson(searchResultMap as Map<String, dynamic>);
|
||||
return searchResult;
|
||||
}
|
||||
}
|
||||
@ -81,7 +83,8 @@ class ItunesSearch {
|
||||
.get(url, options: Options(headers: {'Accept': "application/json"}));
|
||||
print(response.toString());
|
||||
Map searchResultMap = jsonDecode(response.toString());
|
||||
final searchResult = ItunesSearchResult.fromJson(searchResultMap as Map<String, dynamic>);
|
||||
final searchResult =
|
||||
ItunesSearchResult.fromJson(searchResultMap as Map<String, dynamic>);
|
||||
return searchResult;
|
||||
}
|
||||
}
|
||||
@ -121,7 +124,8 @@ class PodcastsIndexSearch {
|
||||
final headers = _initSearch();
|
||||
final response = await _dio.get(url, options: Options(headers: headers));
|
||||
Map searchResultMap = jsonDecode(response.toString());
|
||||
final searchResult = PodcastIndexSearchResult.fromJson(searchResultMap as Map<String, dynamic>);
|
||||
final searchResult = PodcastIndexSearchResult.fromJson(
|
||||
searchResultMap as Map<String, dynamic>);
|
||||
return searchResult;
|
||||
}
|
||||
|
||||
@ -130,7 +134,8 @@ class PodcastsIndexSearch {
|
||||
final headers = _initSearch();
|
||||
final response = await _dio.get(url, options: Options(headers: headers));
|
||||
Map searchResultMap = jsonDecode(response.toString());
|
||||
final searchResult = IndexEpisodeResult.fromJson(searchResultMap as Map<String, dynamic>);
|
||||
final searchResult =
|
||||
IndexEpisodeResult.fromJson(searchResultMap as Map<String, dynamic>);
|
||||
return searchResult;
|
||||
}
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ Future<void> subIsolateEntryPoint(SendPort sendPort) async {
|
||||
}
|
||||
var uuid = Uuid().v4();
|
||||
File("${dir.path}/$uuid.png")
|
||||
..writeAsBytesSync(img.encodePng(thumbnail!));
|
||||
.writeAsBytesSync(img.encodePng(thumbnail!));
|
||||
var imagePath = "${dir.path}/$uuid.png";
|
||||
var primaryColor = await _getColor(File(imagePath));
|
||||
var author = p.itunes!.author ?? p.author ?? '';
|
||||
|
@ -22,7 +22,8 @@ class SearchState extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool isSubscribed(OnlinePodcast? podcast) => _subscribedList.contains(podcast);
|
||||
bool isSubscribed(OnlinePodcast? podcast) =>
|
||||
_subscribedList.contains(podcast);
|
||||
|
||||
void clearSelect() {
|
||||
_selectedPodcast = null;
|
||||
@ -33,7 +34,7 @@ class SearchState extends ChangeNotifier {
|
||||
_subscribedList.clear();
|
||||
}
|
||||
|
||||
void clearGenre(){
|
||||
void clearGenre() {
|
||||
_genre = null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
@ -56,7 +56,8 @@ class EpisodeBrief extends Equatable {
|
||||
artist: feedTitle,
|
||||
album: feedTitle,
|
||||
duration: Duration.zero,
|
||||
artUri: Uri.parse(imagePath == '' ? episodeImage! : 'file://$imagePath'),
|
||||
artUri:
|
||||
Uri.parse(imagePath == '' ? episodeImage! : 'file://$imagePath'),
|
||||
extras: {
|
||||
'skipSecondsStart': skipSecondsStart,
|
||||
'skipSecondsEnd': skipSecondsEnd
|
||||
@ -70,7 +71,8 @@ class EpisodeBrief extends Equatable {
|
||||
? FileImage(File(episodeImage!))
|
||||
: ((episodeImage != '')
|
||||
? CachedNetworkImageProvider(episodeImage!)
|
||||
: AssetImage('assets/avatar_backup.png')) as ImageProvider<Object>;
|
||||
: AssetImage('assets/avatar_backup.png'))
|
||||
as ImageProvider<Object>;
|
||||
}
|
||||
|
||||
Color backgroudColor(BuildContext context) {
|
||||
|
@ -14,7 +14,9 @@ class CustomCacheManager extends CacheManager with ImageCacheManager {
|
||||
|
||||
@override
|
||||
Future<FileInfo> downloadFile(String url,
|
||||
{String? key, Map<String, String>? authHeaders, bool force = false}) async {
|
||||
{String? key,
|
||||
Map<String, String>? authHeaders,
|
||||
bool force = false}) async {
|
||||
var file;
|
||||
try {
|
||||
file = await super
|
||||
@ -41,9 +43,7 @@ class CustomCacheManager extends CacheManager with ImageCacheManager {
|
||||
withProgress: withProgress,
|
||||
maxHeight: maxHeight,
|
||||
maxWidth: maxWidth);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
CustomCacheManager._() : super(Config(key));
|
||||
|
@ -7,7 +7,8 @@ import '../state/audio_state.dart';
|
||||
import '../util/extension_helper.dart';
|
||||
|
||||
class HidePlayerRoute extends ModalRoute<void> {
|
||||
HidePlayerRoute(this.openPage, this.transitionPage, {required Duration duration})
|
||||
HidePlayerRoute(this.openPage, this.transitionPage,
|
||||
{required Duration duration})
|
||||
: transitionDuration = duration;
|
||||
final openPage;
|
||||
final transitionPage;
|
||||
|
@ -31,7 +31,8 @@ Future generalDialog(BuildContext context,
|
||||
),
|
||||
);
|
||||
|
||||
Future generalSheet(BuildContext context, {Widget? child, String? title}) async =>
|
||||
Future generalSheet(BuildContext context,
|
||||
{Widget? child, String? title}) async =>
|
||||
await showModalBottomSheet(
|
||||
useRootNavigator: true,
|
||||
isScrollControlled: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user