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