Minor change.

This commit is contained in:
stonegate 2020-10-12 17:31:35 +08:00
parent c251791b48
commit bc69276541
1 changed files with 19 additions and 5 deletions

View File

@ -471,19 +471,33 @@ class _ScrollPodcastsState extends State<ScrollPodcasts>
}
}
class PodcastPreview extends StatelessWidget {
class PodcastPreview extends StatefulWidget {
final PodcastLocal podcastLocal;
PodcastPreview({this.podcastLocal, Key key}) : super(key: key);
@override
_PodcastPreviewState createState() => _PodcastPreviewState();
}
class _PodcastPreviewState extends State<PodcastPreview> {
Future _getRssItem;
Future<List<EpisodeBrief>> _getRssItemTop(PodcastLocal podcastLocal) async {
var dbHelper = DBHelper();
var episodes = await dbHelper.getRssItemTop(podcastLocal.id);
return episodes;
}
@override
void initState() {
super.initState();
_getRssItem = _getRssItemTop(widget.podcastLocal);
}
@override
Widget build(BuildContext context) {
final c = podcastLocal.backgroudColor(context);
final c = widget.podcastLocal.backgroudColor(context);
return Column(
children: <Widget>[
Expanded(
@ -491,12 +505,12 @@ class PodcastPreview extends StatelessWidget {
selector: (_, worker) => worker.created,
builder: (context, created, child) {
return FutureBuilder<List<EpisodeBrief>>(
future: _getRssItemTop(podcastLocal),
future: _getRssItem,
builder: (context, snapshot) {
return (snapshot.hasData)
? ShowEpisode(
episodes: snapshot.data,
podcastLocal: podcastLocal,
podcastLocal: widget.podcastLocal,
)
: Padding(
padding: const EdgeInsets.all(5.0),
@ -514,7 +528,7 @@ class PodcastPreview extends StatelessWidget {
children: <Widget>[
Expanded(
flex: 4,
child: Text(podcastLocal.title,
child: Text(widget.podcastLocal.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontWeight: FontWeight.bold, color: c)),