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(
|
||||||
Fluttertoast.showToast(
|
msg: context.s.updateEpisodesCount(result),
|
||||||
msg: 'No Update',
|
gravity: ToastGravity.TOP,
|
||||||
gravity: ToastGravity.TOP,
|
);
|
||||||
);
|
if (result > 0) {
|
||||||
} else if (result > 0) {
|
|
||||||
Fluttertoast.showToast(
|
|
||||||
msg: context.s.updateEpisodesCount(result),
|
|
||||||
gravity: ToastGravity.TOP,
|
|
||||||
);
|
|
||||||
|
|
||||||
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,59 +208,86 @@ 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(
|
||||||
decoration: BoxDecoration(
|
imageUrl: backgroundImage,
|
||||||
image: DecorationImage(
|
errorWidget: (context, url, error) => Center(),
|
||||||
image: CachedNetworkImageProvider(
|
imageBuilder: (context, backgroundImageProvider) =>
|
||||||
backgroundImage,
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
image: DecorationImage(
|
||||||
|
image: backgroundImageProvider,
|
||||||
|
fit: BoxFit.cover)),
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: Container(
|
||||||
|
color: Colors.black26,
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 5.0),
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: hosts
|
||||||
|
.map((host) => Container(
|
||||||
|
padding: EdgeInsets.all(5.0),
|
||||||
|
width: 80.0,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
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(
|
||||||
|
backgroundColor:
|
||||||
|
Colors.grey[400],
|
||||||
|
backgroundImage: AssetImage(
|
||||||
|
'assets/fireside.jpg'),
|
||||||
|
),
|
||||||
|
imageBuilder: (context,
|
||||||
|
hostImage) =>
|
||||||
|
CircleAvatar(
|
||||||
|
backgroundColor:
|
||||||
|
Colors.grey[400],
|
||||||
|
backgroundImage:
|
||||||
|
hostImage),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.all(2),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
host.name,
|
||||||
|
style: TextStyle(
|
||||||
|
backgroundColor: Colors.black
|
||||||
|
.withOpacity(0.5),
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.fade,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)))
|
||||||
|
.toList()
|
||||||
|
.cast<Widget>(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
fit: BoxFit.cover)),
|
)),
|
||||||
alignment: Alignment.centerRight,
|
);
|
||||||
child: Container(
|
|
||||||
color: Colors.black26,
|
|
||||||
padding: EdgeInsets.symmetric(vertical: 5.0),
|
|
||||||
width: MediaQuery.of(context).size.width,
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: hosts
|
|
||||||
.map((host) => Container(
|
|
||||||
padding: EdgeInsets.all(5.0),
|
|
||||||
width: 80.0,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.center,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: <Widget>[
|
|
||||||
CircleAvatar(
|
|
||||||
backgroundColor: Colors.grey[400],
|
|
||||||
backgroundImage:
|
|
||||||
CachedNetworkImageProvider(
|
|
||||||
host.image,
|
|
||||||
)),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.all(2),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
host.name,
|
|
||||||
style: TextStyle(
|
|
||||||
backgroundColor:
|
|
||||||
Colors.black.withOpacity(0.5),
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
maxLines: 2,
|
|
||||||
overflow: TextOverflow.fade,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)))
|
|
||||||
.toList()
|
|
||||||
.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