Minor change.

This commit is contained in:
stonegate 2020-08-19 18:10:08 +08:00
parent 5d940a6342
commit 5a533d951b
5 changed files with 22 additions and 20 deletions

View File

@ -366,6 +366,7 @@ class __DismissibleContainerState extends State<_DismissibleContainer> {
final c = widget.episode.backgroudColor(context);
return AnimatedContainer(
duration: Duration(milliseconds: 300),
curve: Curves.easeInSine,
alignment: Alignment.center,
height: _delete ? 0 : 90.0,
child: _delete
@ -413,6 +414,7 @@ class __DismissibleContainerState extends State<_DismissibleContainer> {
var index = await audio.delFromPlaylist(widget.episode);
widget.onRemove(true);
final episodeRemove = widget.episode;
Scaffold.of(context).removeCurrentSnackBar();
Scaffold.of(context).showSnackBar(SnackBar(
behavior: SnackBarBehavior.floating,
backgroundColor: Colors.grey[800],

View File

@ -336,7 +336,7 @@ class _PodcastDetailState extends State<PodcastDetail> {
context,
title: s.settings,
child: PodcastSetting(podcastLocal: widget.podcastLocal),
);
).then((value) => setState(() {}));
break;
}
},

View File

@ -96,17 +96,18 @@ class _PodcastSettingState extends State<PodcastSetting> {
Future<void> _refreshArtWork() async {
setState(() => _coverStatus = RefreshCoverStatus.start);
var options = BaseOptions(
connectTimeout: 20000,
receiveTimeout: 20000,
connectTimeout: 30000,
receiveTimeout: 90000,
);
var dio = Dio(options);
String imageUrl;
try {
var response = await Dio(options).get(widget.podcastLocal.rssUrl);
var response = await dio.get(widget.podcastLocal.rssUrl);
try {
RssFeed p;
p = RssFeed.parse(response.data);
imageUrl == p.itunes.image.href;
var p = RssFeed.parse(response.data);
imageUrl = p.itunes.image.href ?? p.image.url;
} catch (e) {
developer.log(e.toString());
if (mounted) setState(() => _coverStatus = RefreshCoverStatus.error);
@ -121,10 +122,9 @@ class _PodcastSettingState extends State<PodcastSetting> {
!File(widget.podcastLocal.imageUrl).existsSync())) {
try {
img.Image thumbnail;
var imageResponse = await Dio().get<List<int>>(imageUrl,
var imageResponse = await dio.get<List<int>>(imageUrl,
options: Options(
responseType: ResponseType.bytes,
receiveTimeout: 90000,
));
var image = img.decodeImage(imageResponse.data);
thumbnail = img.copyResize(image, width: 300);
@ -137,10 +137,10 @@ class _PodcastSettingState extends State<PodcastSetting> {
}
}
} catch (e) {
developer.log(e.toString());
if (mounted) setState(() => _coverStatus = RefreshCoverStatus.error);
}
}
if (mounted) {
} else if (_coverStatus == RefreshCoverStatus.start && mounted) {
setState(() => _coverStatus = RefreshCoverStatus.complete);
}
}
@ -181,7 +181,7 @@ class _PodcastSettingState extends State<PodcastSetting> {
case RefreshCoverStatus.complete:
return Icon(Icons.done);
break;
case RefreshCoverStatus.complete:
case RefreshCoverStatus.error:
return Icon(Icons.refresh, color: Colors.red);
break;
default:
@ -307,11 +307,11 @@ class _PodcastSettingState extends State<PodcastSetting> {
},
title: Text(s.refreshArtwork),
leading: Icon(Icons.refresh),
trailing: SizedBox(
trailing: Padding(
padding: const EdgeInsets.only(right: 15.0),
child: SizedBox(
height: 20,
width: 20,
child: Padding(
padding: const EdgeInsets.only(right: 10.0),
child: _getRefreshStatusIcon(_coverStatus)))),
Divider(height: 1),
]);

View File

@ -462,8 +462,8 @@ Future<void> subIsolateEntryPoint(SendPort sendPort) async {
var rss = item.url;
sendPort.send([item.title, item.url, 1]);
var options = BaseOptions(
connectTimeout: 20000,
receiveTimeout: 20000,
connectTimeout: 30000,
receiveTimeout: 90000,
);
try {

View File

@ -17,7 +17,7 @@ dependencies:
color_thief_flutter: ^1.0.2
cupertino_icons: ^0.1.3
connectivity: ^0.4.9
dio: ^3.0.9
dio: ^3.0.10
extended_nested_scroll_view: ^1.0.1
effective_dart: ^1.2.4
equatable: ^1.2.3