Skip to content

Commit 49ea1ba

Browse files
authored
Mitigate images without background (#375)
1 parent f296fd5 commit 49ea1ba

File tree

7 files changed

+33
-28
lines changed

7 files changed

+33
-28
lines changed

lib/src/player/bottom_player_image.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:media_kit_video/media_kit_video.dart';
3+
14
import '../../build_context_x.dart';
25
import '../../common.dart';
6+
import '../../constants.dart';
37
import '../../data.dart';
4-
import 'package:flutter/material.dart';
5-
import 'package:media_kit_video/media_kit_video.dart';
8+
import '../../theme_data_x.dart';
69

710
class BottomPlayerImage extends StatelessWidget {
811
const BottomPlayerImage({
@@ -66,7 +69,8 @@ class BottomPlayerImage extends StatelessWidget {
6669
),
6770
);
6871
} else if (audio?.imageUrl != null || audio?.albumArtUrl != null) {
69-
return SizedBox(
72+
return Container(
73+
color: theme.isLight ? kCardColorLight : kCardColorDark,
7074
height: size,
7175
width: size,
7276
child: SafeNetworkImage(
@@ -77,7 +81,7 @@ class BottomPlayerImage extends StatelessWidget {
7781
),
7882
url: audio?.imageUrl ?? audio?.albumArtUrl,
7983
filterQuality: FilterQuality.medium,
80-
fit: BoxFit.cover,
84+
fit: BoxFit.scaleDown,
8185
),
8286
);
8387
} else {

lib/src/player/full_height_player_image.dart

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import '../../build_context_x.dart';
44
import '../../common.dart';
55
import '../../constants.dart';
66
import '../../data.dart';
7+
import '../../theme_data_x.dart';
78

89
class FullHeightPlayerImage extends StatelessWidget {
910
const FullHeightPlayerImage({
@@ -45,17 +46,22 @@ class FullHeightPlayerImage extends StatelessWidget {
4546
color: theme.hintColor,
4647
);
4748
} else if (audio?.imageUrl != null || audio?.albumArtUrl != null) {
48-
image = SafeNetworkImage(
49-
url: audio?.imageUrl ?? audio?.albumArtUrl,
50-
filterQuality: FilterQuality.medium,
51-
fit: BoxFit.cover,
52-
fallBackIcon: Icon(
53-
iconData,
54-
size: fullHeightPlayerImageSize * 0.7,
55-
color: theme.hintColor,
56-
),
49+
image = Container(
5750
height: size.width,
5851
width: size.width,
52+
color: theme.isLight ? kCardColorLight : kCardColorDark,
53+
child: SafeNetworkImage(
54+
url: audio?.imageUrl ?? audio?.albumArtUrl,
55+
filterQuality: FilterQuality.medium,
56+
fit: BoxFit.scaleDown,
57+
fallBackIcon: Icon(
58+
iconData,
59+
size: fullHeightPlayerImageSize * 0.7,
60+
color: theme.hintColor,
61+
),
62+
height: size.width,
63+
width: size.width,
64+
),
5965
);
6066
} else {
6167
image = Icon(

lib/src/player/player_track.dart

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class PlayerTrack extends StatelessWidget {
2222
final position = context.select((PlayerModel m) => m.position);
2323
final setPosition = playerModel.setPosition;
2424
final duration = context.select((PlayerModel m) => m.duration);
25-
final color = context.select((PlayerModel m) => m.color);
2625
final seek = playerModel.seek;
2726

2827
bool sliderActive = duration != null &&
@@ -42,15 +41,9 @@ class PlayerTrack extends StatelessWidget {
4241
minThumbSeparation: 0,
4342
trackShape: superNarrow ? const RectangularSliderTrackShape() : null,
4443
trackHeight: superNarrow ? 4 : 2,
45-
inactiveTrackColor: color != null
46-
? theme.colorScheme.onSurface.withOpacity(0.35)
47-
: theme.colorScheme.primary.withOpacity(0.5),
48-
activeTrackColor: color != null
49-
? theme.colorScheme.onSurface.withOpacity(0.8)
50-
: theme.colorScheme.primary,
51-
overlayColor: color != null
52-
? theme.colorScheme.onSurface
53-
: theme.colorScheme.primary,
44+
inactiveTrackColor: theme.colorScheme.onSurface.withOpacity(0.35),
45+
activeTrackColor: theme.colorScheme.onSurface.withOpacity(0.8),
46+
overlayColor: theme.colorScheme.onSurface,
5447
overlayShape: RoundSliderThumbShape(
5548
elevation: 3,
5649
enabledThumbRadius: superNarrow ? 0 : 5.0,

lib/src/radio/radio_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,11 @@ class RadioFallBackIcon extends StatelessWidget {
289289
getAlphabetColor(
290290
station?.title ?? station?.album ?? '',
291291
fallBackColor,
292-
).scale(lightness: light ? 0 : -0.4),
292+
).scale(lightness: light ? 0 : -0.4, saturation: -0.5),
293293
getAlphabetColor(
294294
station?.title ?? station?.album ?? '',
295295
fallBackColor,
296-
).scale(lightness: light ? -0.1 : -0.2),
296+
).scale(lightness: light ? -0.1 : -0.2, saturation: -0.5),
297297
],
298298
),
299299
),

lib/src/radio/station_page.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class StationPage extends StatelessWidget {
4848
);
4949
return ClipRRect(
5050
borderRadius: BorderRadius.circular(5),
51-
child: SizedBox(
51+
child: Container(
52+
color: context.t.isLight ? kCardColorLight : kCardColorDark,
5253
height: sideBarImageSize,
5354
width: sideBarImageSize,
5455
child: SafeNetworkImage(

lib/src/settings/about_tile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class AboutTile extends StatelessWidget {
4747
return SizedBox(
4848
height: 400,
4949
width: 300,
50-
child: MarkdownBody(
50+
child: Markdown(
5151
data: 'Contributors:\n ${snapshot.data!}',
5252
onTapLink: (text, href, title) =>
5353
href != null ? launchUrl(Uri.parse(href)) : null,

lib/src/theme.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,6 @@ const alphabetColors = {
148148
};
149149

150150
Color getAlphabetColor(String text, [Color fallBackColor = Colors.black]) {
151-
return alphabetColors[text[0].toUpperCase()] ?? fallBackColor;
151+
final letter = text.isEmpty ? null : text[0];
152+
return alphabetColors[letter] ?? fallBackColor;
152153
}

0 commit comments

Comments
 (0)