mirror of
https://github.com/stonega/tsacdop
synced 2025-02-10 16:40:44 +01:00
Fixed iamge load error.
This commit is contained in:
parent
1939d6581a
commit
18b2f7beff
@ -93,17 +93,11 @@ class _PodcastDetailState extends State<PodcastDetail> {
|
|||||||
Future _updateRssItem(BuildContext context, PodcastLocal podcastLocal) async {
|
Future _updateRssItem(BuildContext context, PodcastLocal podcastLocal) async {
|
||||||
var dbHelper = DBHelper();
|
var dbHelper = DBHelper();
|
||||||
final result = await dbHelper.updatePodcastRss(podcastLocal);
|
final result = await dbHelper.updatePodcastRss(podcastLocal);
|
||||||
if (result == 0) {
|
|
||||||
Fluttertoast.showToast(
|
|
||||||
msg: 'No Update',
|
|
||||||
gravity: ToastGravity.TOP,
|
|
||||||
);
|
|
||||||
} else if (result > 0) {
|
|
||||||
Fluttertoast.showToast(
|
Fluttertoast.showToast(
|
||||||
msg: context.s.updateEpisodesCount(result),
|
msg: context.s.updateEpisodesCount(result),
|
||||||
gravity: ToastGravity.TOP,
|
gravity: ToastGravity.TOP,
|
||||||
);
|
);
|
||||||
|
if (result > 0) {
|
||||||
var autoDownload = await dbHelper.getAutoDownload(podcastLocal.id);
|
var autoDownload = await dbHelper.getAutoDownload(podcastLocal.id);
|
||||||
if (autoDownload) {
|
if (autoDownload) {
|
||||||
var downloader = Provider.of<DownloadState>(context, listen: false);
|
var downloader = Provider.of<DownloadState>(context, listen: false);
|
||||||
@ -128,13 +122,13 @@ class _PodcastDetailState extends State<PodcastDetail> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (result != 0) {
|
||||||
Fluttertoast.showToast(
|
Fluttertoast.showToast(
|
||||||
msg: context.s.updateFailed,
|
msg: context.s.updateFailed,
|
||||||
gravity: ToastGravity.TOP,
|
gravity: ToastGravity.TOP,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (mounted) setState(() {});
|
if (mounted && result > 0) setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<EpisodeBrief>> _getRssItem(PodcastLocal podcastLocal,
|
Future<List<EpisodeBrief>> _getRssItem(PodcastLocal podcastLocal,
|
||||||
@ -214,12 +208,14 @@ class _PodcastDetailState extends State<PodcastDetail> {
|
|||||||
if (snapshot.hasData) {
|
if (snapshot.hasData) {
|
||||||
var hosts = snapshot.data.item2;
|
var hosts = snapshot.data.item2;
|
||||||
var backgroundImage = snapshot.data.item1;
|
var backgroundImage = snapshot.data.item1;
|
||||||
return Container(
|
return CachedNetworkImage(
|
||||||
|
imageUrl: backgroundImage,
|
||||||
|
errorWidget: (context, url, error) => Center(),
|
||||||
|
imageBuilder: (context, backgroundImageProvider) =>
|
||||||
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: CachedNetworkImageProvider(
|
image: backgroundImageProvider,
|
||||||
backgroundImage,
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover)),
|
fit: BoxFit.cover)),
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -240,20 +236,44 @@ class _PodcastDetailState extends State<PodcastDetail> {
|
|||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
CachedNetworkImage(
|
||||||
|
imageUrl: host.image,
|
||||||
|
progressIndicatorBuilder:
|
||||||
|
(context, url,
|
||||||
|
downloadProgress) =>
|
||||||
|
SizedBox(
|
||||||
|
width: 40,
|
||||||
|
height: 2,
|
||||||
|
child:
|
||||||
|
LinearProgressIndicator(
|
||||||
|
value:
|
||||||
|
downloadProgress
|
||||||
|
.progress),
|
||||||
|
),
|
||||||
|
errorWidget:
|
||||||
|
(context, url, error) =>
|
||||||
CircleAvatar(
|
CircleAvatar(
|
||||||
backgroundColor: Colors.grey[400],
|
backgroundColor:
|
||||||
|
Colors.grey[400],
|
||||||
|
backgroundImage: AssetImage(
|
||||||
|
'assets/fireside.jpg'),
|
||||||
|
),
|
||||||
|
imageBuilder: (context,
|
||||||
|
hostImage) =>
|
||||||
|
CircleAvatar(
|
||||||
|
backgroundColor:
|
||||||
|
Colors.grey[400],
|
||||||
backgroundImage:
|
backgroundImage:
|
||||||
CachedNetworkImageProvider(
|
hostImage),
|
||||||
host.image,
|
),
|
||||||
)),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.all(2),
|
padding: EdgeInsets.all(2),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
host.name,
|
host.name,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
backgroundColor:
|
backgroundColor: Colors.black
|
||||||
Colors.black.withOpacity(0.5),
|
.withOpacity(0.5),
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -266,7 +286,8 @@ class _PodcastDetailState extends State<PodcastDetail> {
|
|||||||
.cast<Widget>(),
|
.cast<Widget>(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
)),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return Center();
|
return Center();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,8 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:html/parser.dart';
|
import 'package:html/parser.dart';
|
||||||
import 'package:tsacdop/local_storage/sqflite_localpodcast.dart';
|
|
||||||
|
import '../local_storage/sqflite_localpodcast.dart';
|
||||||
|
|
||||||
class FiresideData {
|
class FiresideData {
|
||||||
final String id;
|
final String id;
|
||||||
@ -45,7 +46,8 @@ class FiresideData {
|
|||||||
host = PodcastHost(
|
host = PodcastHost(
|
||||||
name,
|
name,
|
||||||
reg.stringMatch(image) ??
|
reg.stringMatch(image) ??
|
||||||
'http://xuanmei.us/assets/default/avatar_small-170afdc2be97fc6148b283083942d82c101d4c1061f6b28f87c8958b52664af9.jpg');
|
'https://fireside.fm/assets/default/avatar_small'
|
||||||
|
'-170afdc2be97fc6148b283083942d82c101d4c1061f6b28f87c8958b52664af9.jpg');
|
||||||
|
|
||||||
hosts.add(host);
|
hosts.add(host);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user