Skip to content

Commit

Permalink
Use adaptive progress indicator, remove text from MissionImage on error
Browse files Browse the repository at this point in the history
  • Loading branch information
ivirtex committed Oct 25, 2023
1 parent 98b7922 commit f235dbe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 30 deletions.
39 changes: 10 additions & 29 deletions lib/launches/widgets/mission_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';

// Project imports:
import 'package:starcat/constants.dart';

class MissionImage extends StatelessWidget {
const MissionImage({
required this.imageUrl,
Expand Down Expand Up @@ -50,38 +47,22 @@ class MissionImage extends StatelessWidget {
fit: fit,
cacheManager: cacheManager,
progressIndicatorBuilder: (context, child, _) {
return SizedBox(
height: 150,
child: ColoredBox(
color: Theme.of(context).colorScheme.surface,
child: const Center(
child: CircularProgressIndicator.adaptive(),
),
return ColoredBox(
color: Theme.of(context).colorScheme.surface,
child: const Center(
child: CircularProgressIndicator.adaptive(),
),
);
},
errorWidget: (context, error, stackTrace) {
log(error);

return SizedBox(
height: 150,
child: ColoredBox(
color: Theme.of(context).colorScheme.errorContainer,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.image_not_supported_rounded,
color: Theme.of(context).colorScheme.onErrorContainer,
),
Text(
kImageErrorText,
style: TextStyle(
color: Theme.of(context).colorScheme.onErrorContainer,
),
),
],
),
return ColoredBox(
color: Theme.of(context).colorScheme.errorContainer,
child: Icon(
Icons.image_not_supported_rounded,
color: Theme.of(context).colorScheme.onErrorContainer,
size: 32,
),
);
},
Expand Down
2 changes: 1 addition & 1 deletion lib/shared/status_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class StatusIndicator extends StatelessWidget {
width: 14,
height: 14,
child: sourcesRefreshing > 0
? const CircularProgressIndicator(strokeWidth: 2)
? const CircularProgressIndicator.adaptive(strokeWidth: 2)
: const Icon(Icons.check_rounded, size: 16),
),
const SizedBox(width: kListSpacing),
Expand Down

0 comments on commit f235dbe

Please sign in to comment.