Minor change.

This commit is contained in:
stonega 2020-12-28 22:05:37 +08:00
parent f029a849a2
commit 526eeb885b
1 changed files with 26 additions and 32 deletions

View File

@ -81,6 +81,26 @@ class _ScrollPodcastsState extends State<ScrollPodcasts>
BoxDecoration(shape: BoxShape.circle, color: context.primaryColor),
);
Widget _updateIndicator(PodcastLocal podcastLocal) => FutureBuilder<int>(
future: _getPodcastUpdateCounts(podcastLocal.id),
initialData: 0,
builder: (context, snapshot) {
return snapshot.data > 0
? Align(
alignment: Alignment.bottomRight,
child: Container(
alignment: Alignment.center,
height: 10,
width: 10,
decoration: BoxDecoration(
color: Colors.red,
border: Border.all(color: context.primaryColor, width: 2),
shape: BoxShape.circle),
),
)
: Center();
});
@override
Widget build(BuildContext context) {
final width = MediaQuery.of(context).size.width;
@ -379,38 +399,12 @@ class _ScrollPodcastsState extends State<ScrollPodcasts>
maxHeight: 50,
maxWidth: 50,
child: CircleAvatar(
backgroundColor:
color.withOpacity(0.5),
backgroundImage:
podcastLocal.avatarImage,
child: FutureBuilder<int>(
future: _getPodcastUpdateCounts(
podcastLocal.id),
initialData: 0,
builder: (context, snapshot) {
return snapshot.data > 0
? Align(
alignment: Alignment
.bottomRight,
child: Container(
alignment: Alignment
.center,
height: 10,
width: 10,
decoration: BoxDecoration(
color:
Colors.red,
border: Border.all(
color: context
.primaryColor,
width: 2),
shape: BoxShape
.circle),
),
)
: Center();
}),
),
backgroundColor:
color.withOpacity(0.5),
backgroundImage:
podcastLocal.avatarImage,
child: _updateIndicator(
podcastLocal)),
),
),
);