Skip to content

Commit

Permalink
fix(images): validate image availability before fading-in
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
JagandeepBrar committed Sep 8, 2022
1 parent c494535 commit 6f9e0e8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/modules/nzbget/routes/queue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ class _State extends State<NZBGetQueue>
});

Future<void> _fetchWithoutMessage() async {
_fetch().then((_) => {if (mounted) setState(() {})}).catchError((error) {
_fetch().then((_) {
if (mounted) setState(() {});
}).catchError((error) {
_queue = null;
});
}
Expand All @@ -76,7 +78,7 @@ class _State extends State<NZBGetQueue>
}).catchError((error) {
_queue = null;
_setError(true);
return Future.error(error);
throw error;
});
}

Expand Down
2 changes: 2 additions & 0 deletions lib/widgets/ui/block/block.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ class LunaBlock extends StatelessWidget {
}

Widget _fadeInBackground(BuildContext context, double _height) {
if (backgroundUrl == null) return const SizedBox();

final _percent = LunaSeaDatabase.THEME_IMAGE_BACKGROUND_OPACITY.read();
if (_percent == 0) return const SizedBox(height: 0, width: 0);

Expand Down
2 changes: 2 additions & 0 deletions lib/widgets/ui/block/grid_block.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class LunaGridBlock extends StatelessWidget {
}

Widget _fadeInBackground(BuildContext context) {
if (backgroundUrl == null) return const SizedBox();

final _percent = LunaSeaDatabase.THEME_IMAGE_BACKGROUND_OPACITY.read();
if (_percent == 0) return const SizedBox(height: 0, width: 0);

Expand Down

0 comments on commit 6f9e0e8

Please sign in to comment.