mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
Fix invalid number of available source updates.
This commit is contained in:
@@ -605,6 +605,19 @@ class _ComicSourceWidgetState extends State<_ComicSourceWidget> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int get _availableUpdates {
|
||||||
|
int c = 0;
|
||||||
|
ComicSource.availableUpdates.forEach((key, version) {
|
||||||
|
var source = ComicSource.find(key);
|
||||||
|
if (source != null) {
|
||||||
|
if (compareSemVer(version, source.version)) {
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SliverToBoxAdapter(
|
return SliverToBoxAdapter(
|
||||||
@@ -668,7 +681,7 @@ class _ComicSourceWidgetState extends State<_ComicSourceWidget> {
|
|||||||
}).toList(),
|
}).toList(),
|
||||||
).paddingHorizontal(16).paddingBottom(16),
|
).paddingHorizontal(16).paddingBottom(16),
|
||||||
),
|
),
|
||||||
if (ComicSource.availableUpdates.isNotEmpty)
|
if (_availableUpdates > 0)
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 8,
|
horizontal: 8,
|
||||||
@@ -687,7 +700,7 @@ class _ComicSourceWidgetState extends State<_ComicSourceWidget> {
|
|||||||
Icon(Icons.update, color: context.colorScheme.primary, size: 20,),
|
Icon(Icons.update, color: context.colorScheme.primary, size: 20,),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Text("@c updates".tlParams({
|
Text("@c updates".tlParams({
|
||||||
'c': ComicSource.availableUpdates.length,
|
'c': _availableUpdates,
|
||||||
}), style: ts.withColor(context.colorScheme.primary),),
|
}), style: ts.withColor(context.colorScheme.primary),),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user