fix(Assets): Cleanup assets, add asset existence tests (#460)

* feat(packages): Add coverage script, update spider asset paths
* fix(Assets): Cleanup asset structure
* fix(Assets): Update asset paths within codebase
This commit is contained in:
Jagandeep Brar
2021-05-03 10:58:19 -05:00
committed by GitHub
parent b6b3964eef
commit 3e68fb3e97
52 changed files with 92 additions and 63 deletions

View File

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -33,7 +33,9 @@ cocoapods:
- cd ./macos && pod setup
- cd ./macos && pod install
coverage:
create: flutter test --coverage
upload: bash <(curl -s https://codecov.io/bash)
generate:
assets: spider build
runner: flutter packages pub run build_runner build --delete-conflicting-outputs
localization: dart ./scripts/generate/localization.dart

View File

@@ -1,22 +1,22 @@
class LunaAssets {
LunaAssets._();
static const String user = 'assets/images/blanks/user.png';
static const String platform = 'assets/images/blanks/platform.png';
static const String stream = 'assets/images/blanks/stream.png';
static const String video = 'assets/images/blanks/video.png';
static const String audio = 'assets/images/blanks/audio.png';
static const String icon = 'assets/images/branding/icon.png';
static const String iconDrawer = 'assets/images/branding/icon_drawer.png';
static const String iconAdaptive = 'assets/images/branding/icon_adaptive.png';
static const String splash = 'assets/images/branding/splash.png';
static const String trakt = 'assets/images/services/trakt.png';
static const String bandsintown = 'assets/images/services/bandsintown.png';
static const String lastfm = 'assets/images/services/lastfm.png';
static const String thetvdb = 'assets/images/services/thetvdb.png';
static const String imdb = 'assets/images/services/imdb.png';
static const String tvmaze = 'assets/images/services/tvmaze.png';
static const String discogs = 'assets/images/services/discogs.png';
static const String youtube = 'assets/images/services/youtube.png';
static const String themoviedb = 'assets/images/services/themoviedb.png';
static const String brandingFull = 'assets/images/branding_full.png';
static const String serviceTvmaze = 'assets/images/service_tvmaze.png';
static const String blankDevice = 'assets/images/blank_device.png';
static const String serviceThetvdb = 'assets/images/service_thetvdb.png';
static const String blankAudio = 'assets/images/blank_audio.png';
static const String brandingLogo = 'assets/images/branding_logo.png';
static const String blankUser = 'assets/images/blank_user.png';
static const String blankVideo = 'assets/images/blank_video.png';
static const String blankStream = 'assets/images/blank_stream.png';
static const String serviceBandsintown =
'assets/images/service_bandsintown.png';
static const String serviceThemoviedb =
'assets/images/service_themoviedb.png';
static const String serviceTrakt = 'assets/images/service_trakt.png';
static const String serviceDiscogs = 'assets/images/service_discogs.png';
static const String serviceLastfm = 'assets/images/service_lastfm.png';
static const String serviceYoutube = 'assets/images/service_youtube.png';
static const String serviceImdb = 'assets/images/service_imdb.png';
}

View File

@@ -60,7 +60,7 @@ class LunaDrawerHeader extends UserAccountsDrawerHeader {
decoration: BoxDecoration(
color: LunaColours.accent,
image: DecorationImage(
image: AssetImage(LunaAssets.iconDrawer),
image: AssetImage(LunaAssets.brandingLogo),
colorFilter: ColorFilter.mode(
LunaColours.primary.withOpacity(0.15), BlendMode.dstATop),
fit: BoxFit.cover,

View File

@@ -161,7 +161,7 @@ class _State extends State<LidarrAddDetails> with LunaScrollControllerMixin {
? 'No summary is available.'
: _arguments.data.overview,
uri: _arguments.data.posterURI ?? '',
fallbackImage: LunaAssets.user,
fallbackImage: LunaAssets.blankUser,
squareImage: true,
headers: Database.currentProfileObject.getLidarr()['headers'],
),

View File

@@ -30,7 +30,7 @@ class _State extends State<LidarrDetailsAlbumTile> {
widget.data.albumCoverURI() != ''
? LunaNetworkImage(
url: widget.data.albumCoverURI(),
placeholderAsset: LunaAssets.audio,
placeholderAsset: LunaAssets.blankAudio,
headers: ((Database.currentProfileObject
.getLidarr()['headers'] ??
{}) as Map)

View File

@@ -31,7 +31,7 @@ class _State extends State<LidarrDetailsOverview>
? 'No summary is available.'
: widget?.data?.overview,
uri: widget?.data?.posterURI() ?? '',
fallbackImage: LunaAssets.user,
fallbackImage: LunaAssets.blankUser,
squareImage: true,
headers: Database.currentProfileObject.getLidarr()['headers'],
),
@@ -43,7 +43,7 @@ class _State extends State<LidarrDetailsOverview>
context: context,
child: InkWell(
child: Padding(
child: Image.asset(LunaAssets.bandsintown),
child: Image.asset(LunaAssets.serviceBandsintown),
padding: EdgeInsets.all(12.0),
),
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),
@@ -59,7 +59,7 @@ class _State extends State<LidarrDetailsOverview>
context: context,
child: InkWell(
child: Padding(
child: Image.asset(LunaAssets.discogs),
child: Image.asset(LunaAssets.serviceDiscogs),
padding: EdgeInsets.all(12.0),
),
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),
@@ -75,7 +75,7 @@ class _State extends State<LidarrDetailsOverview>
context: context,
child: InkWell(
child: Padding(
child: Image.asset(LunaAssets.lastfm),
child: Image.asset(LunaAssets.serviceLastfm),
padding: EdgeInsets.all(12.0),
),
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),

View File

@@ -23,7 +23,7 @@ class _State extends State<RadarrAddMovieDiscoveryResultTile> {
backgroundUrl: widget.movie.remotePoster,
posterUrl: widget.movie.remotePoster,
posterHeaders: context.watch<RadarrState>().headers,
posterPlaceholder: LunaAssets.video,
posterPlaceholder: LunaAssets.blankVideo,
title: widget.movie.title,
subtitle1: _subtitle1(),
subtitle2: _subtitle2(),

View File

@@ -27,7 +27,7 @@ class _State extends State<RadarrAddMovieSearchResultTile> {
backgroundUrl: widget.movie.remotePoster,
posterUrl: widget.movie.remotePoster,
posterHeaders: context.watch<RadarrState>().headers,
posterPlaceholder: LunaAssets.video,
posterPlaceholder: LunaAssets.blankVideo,
title: widget.movie.title,
darken: widget.exists,
titleColor: widget.isExcluded ? LunaColours.red : Colors.white,

View File

@@ -26,7 +26,7 @@ class _State extends State<RadarrCatalogueTile> {
context.read<RadarrState>().getPosterURL(widget.movie.id),
posterUrl: context.read<RadarrState>().getPosterURL(widget.movie.id),
posterHeaders: context.read<RadarrState>().headers,
posterPlaceholder: LunaAssets.video,
posterPlaceholder: LunaAssets.blankVideo,
darken: !widget.movie.monitored,
title: widget.movie.title,
subtitle1: _subtitle1(),

View File

@@ -26,7 +26,7 @@ class _State extends State<RadarrMissingTile> {
context.read<RadarrState>().getPosterURL(widget.movie.id),
posterUrl: context.read<RadarrState>().getPosterURL(widget.movie.id),
posterHeaders: context.read<RadarrState>().headers,
posterPlaceholder: LunaAssets.video,
posterPlaceholder: LunaAssets.blankVideo,
darken: !widget.movie.monitored,
title: widget.movie.title,
subtitle1: _subtitle1(),

View File

@@ -27,7 +27,7 @@ class RadarrMovieDetailsCastCrewTile extends StatelessWidget {
}
return LunaTwoLineCardWithPoster(
title: credits.personName,
posterPlaceholder: LunaAssets.user,
posterPlaceholder: LunaAssets.blankUser,
posterUrl: credits.images.isEmpty ? null : credits.images[0].url,
posterHeaders: {},
subtitle1: TextSpan(text: position),

View File

@@ -12,7 +12,7 @@ class RadarrMovieDetailsOverviewDescriptionTile extends StatelessWidget {
Widget build(BuildContext context) {
return LunaFourLineCardWithPoster(
posterPlaceholder: LunaAssets.video,
posterPlaceholder: LunaAssets.blankVideo,
backgroundUrl: context.read<RadarrState>().getFanartURL(movie.id),
posterUrl: context.read<RadarrState>().getPosterURL(movie.id),
posterHeaders: context.read<RadarrState>().headers,

View File

@@ -19,7 +19,7 @@ class RadarrMovieDetailsOverviewLinksSection extends StatelessWidget {
context: context,
child: InkWell(
child: Padding(
child: Image.asset(LunaAssets.imdb),
child: Image.asset(LunaAssets.serviceImdb),
padding: EdgeInsets.all(12.0),
),
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),
@@ -33,7 +33,7 @@ class RadarrMovieDetailsOverviewLinksSection extends StatelessWidget {
context: context,
child: InkWell(
child: Padding(
child: Image.asset(LunaAssets.themoviedb),
child: Image.asset(LunaAssets.serviceThemoviedb),
padding: EdgeInsets.all(12.0),
),
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),
@@ -48,7 +48,7 @@ class RadarrMovieDetailsOverviewLinksSection extends StatelessWidget {
context: context,
child: InkWell(
child: Padding(
child: Image.asset(LunaAssets.trakt),
child: Image.asset('assets/images/services/trakt.png'),
padding: EdgeInsets.all(12.0),
),
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),
@@ -63,7 +63,7 @@ class RadarrMovieDetailsOverviewLinksSection extends StatelessWidget {
context: context,
child: InkWell(
child: Padding(
child: Image.asset(LunaAssets.youtube),
child: Image.asset(LunaAssets.serviceYoutube),
padding: EdgeInsets.all(12.0),
),
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),

View File

@@ -26,7 +26,7 @@ class _State extends State<RadarrUpcomingTile> {
context.read<RadarrState>().getPosterURL(widget.movie.id),
posterUrl: context.read<RadarrState>().getPosterURL(widget.movie.id),
posterHeaders: context.read<RadarrState>().headers,
posterPlaceholder: LunaAssets.video,
posterPlaceholder: LunaAssets.blankVideo,
darken: !widget.movie.monitored,
title: widget.movie.title,
subtitle1: _subtitle1(),

View File

@@ -57,7 +57,7 @@ class _State extends State<SettingsAccountSignedOutPage> {
Padding(
child: Center(
child: Image.asset(
LunaAssets.splash,
LunaAssets.brandingFull,
width: 200.0,
),
),

View File

@@ -52,14 +52,14 @@ class _State extends State<SonarrSeriesAddSearchResultTile> {
if (widget.series.remotePoster != null)
return LunaNetworkImage(
url: widget.series.remotePoster,
placeholderAsset: LunaAssets.video,
placeholderAsset: LunaAssets.blankVideo,
height: _height,
width: _width,
headers: context.read<SonarrState>().headers.cast<String, String>(),
);
return ClipRRect(
child: Image.asset(
LunaAssets.video,
LunaAssets.blankVideo,
width: _width,
height: _height,
),

View File

@@ -50,7 +50,7 @@ class _State extends State<SonarrMissingTile> {
Widget get _poster => LunaNetworkImage(
url: Provider.of<SonarrState>(context, listen: false)
.getPosterURL(widget.record.seriesId),
placeholderAsset: LunaAssets.video,
placeholderAsset: LunaAssets.blankVideo,
height: _height,
width: _width,
headers: Provider.of<SonarrState>(context, listen: false)

View File

@@ -52,7 +52,7 @@ class _State extends State<SonarrSeriesTile> {
Widget get _poster => LunaNetworkImage(
url: Provider.of<SonarrState>(context, listen: false)
.getPosterURL(widget.series.id),
placeholderAsset: LunaAssets.video,
placeholderAsset: LunaAssets.blankVideo,
height: _height,
width: _width,
headers: Provider.of<SonarrState>(context, listen: false)

View File

@@ -82,7 +82,7 @@ class SonarrSeriesDetailsOverview extends StatelessWidget {
headers: Provider.of<SonarrState>(context, listen: false)
.headers
.cast<String, String>(),
placeholderAsset: LunaAssets.video,
placeholderAsset: LunaAssets.blankVideo,
height: _height,
width: _width,
),
@@ -137,7 +137,7 @@ class SonarrSeriesDetailsOverview extends StatelessWidget {
context: context,
child: InkWell(
child: Padding(
child: Image.asset(LunaAssets.imdb),
child: Image.asset(LunaAssets.serviceImdb),
padding: EdgeInsets.all(12.0),
),
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),
@@ -151,7 +151,7 @@ class SonarrSeriesDetailsOverview extends StatelessWidget {
context: context,
child: InkWell(
child: Padding(
child: Image.asset(LunaAssets.trakt),
child: Image.asset(LunaAssets.serviceTrakt),
padding: EdgeInsets.all(12.0),
),
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),
@@ -166,7 +166,7 @@ class SonarrSeriesDetailsOverview extends StatelessWidget {
context: context,
child: InkWell(
child: Padding(
child: Image.asset(LunaAssets.thetvdb),
child: Image.asset(LunaAssets.serviceThetvdb),
padding: EdgeInsets.all(12.0),
),
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),
@@ -181,7 +181,7 @@ class SonarrSeriesDetailsOverview extends StatelessWidget {
context: context,
child: InkWell(
child: Padding(
child: Image.asset(LunaAssets.tvmaze),
child: Image.asset(LunaAssets.serviceTvmaze),
padding: EdgeInsets.all(12.0),
),
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),

View File

@@ -25,7 +25,7 @@ class _State extends State<SonarrUpcomingTile> {
posterUrl:
context.read<SonarrState>().getPosterURL(widget.record.seriesId),
posterHeaders: context.read<SonarrState>().headers,
posterPlaceholder: LunaAssets.video,
posterPlaceholder: LunaAssets.blankVideo,
title: widget.record.series.title,
subtitle1: _subtitle1(),
subtitle2: _subtitle2(),

View File

@@ -19,7 +19,7 @@ class TautulliActivityTile extends StatelessWidget {
title: session.lunaTitle,
posterUrl: session.lunaArtworkPath(context),
posterHeaders: context.read<TautulliState>().headers,
posterPlaceholder: LunaAssets.video,
posterPlaceholder: LunaAssets.blankVideo,
backgroundUrl: context.watch<TautulliState>().getImageURLFromPath(
session.art,
width: MediaQuery.of(context).size.width.truncate(),

View File

@@ -44,7 +44,7 @@ class TautulliHistoryTile extends StatelessWidget {
headers: context.watch<TautulliState>().headers.cast<String, String>(),
height: _imageDimension,
width: _imageDimension / 1.5,
placeholderAsset: LunaAssets.video,
placeholderAsset: LunaAssets.blankVideo,
);
Widget get _details => Expanded(

View File

@@ -17,7 +17,7 @@ class TautulliLibrariesDetailsUserStatsTile extends StatelessWidget {
context.watch<TautulliState>().getImageURLFromPath(user.userThumb),
posterHeaders:
context.watch<TautulliState>().headers.cast<String, String>(),
posterPlaceholder: LunaAssets.user,
posterPlaceholder: LunaAssets.blankUser,
title: user.friendlyName,
customSubtitle1: _subtitle1(),
customSubtitle2: _subtitle2(),

View File

@@ -64,7 +64,7 @@ class TautulliMediaDetailsMetadataHeaderTile extends StatelessWidget {
Widget _poster(BuildContext context) {
return LunaNetworkImage(
url: context.watch<TautulliState>().getImageURLFromPath(_posterLink),
placeholderAsset: LunaAssets.video,
placeholderAsset: LunaAssets.blankVideo,
height: _height,
width: _width,
headers: context.watch<TautulliState>().headers.cast<String, String>(),

View File

@@ -62,7 +62,7 @@ class TautulliRecentlyAddedContentTile extends StatelessWidget {
return LunaNetworkImage(
url: context.watch<TautulliState>().getImageURLFromPath(_posterLink),
headers: context.watch<TautulliState>().headers.cast<String, String>(),
placeholderAsset: LunaAssets.video,
placeholderAsset: LunaAssets.blankVideo,
height: _imageDimension,
width: _imageDimension / 1.5,
);

View File

@@ -43,7 +43,7 @@ class TautulliSearchResultTile extends StatelessWidget {
headers: context.watch<TautulliState>().headers.cast<String, String>(),
height: _imageDimension,
width: _imageDimension / 1.5,
placeholderAsset: LunaAssets.video,
placeholderAsset: LunaAssets.blankVideo,
);
Widget get _details => Expanded(

View File

@@ -44,7 +44,7 @@ class TautulliStatisticsMediaTile extends StatelessWidget {
Widget _poster(BuildContext context) => LunaNetworkImage(
url: context.watch<TautulliState>().getImageURLFromPath(data['thumb']),
headers: context.watch<TautulliState>().headers.cast<String, String>(),
placeholderAsset: LunaAssets.video,
placeholderAsset: LunaAssets.blankVideo,
height: _imageDimension,
width: _imageDimension / 1.5,
);

View File

@@ -29,7 +29,7 @@ class TautulliStatisticsPlatformTile extends StatelessWidget {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),
image: DecorationImage(
image: AssetImage(LunaAssets.platform),
image: AssetImage(LunaAssets.blankDevice),
fit: BoxFit.cover,
),
),

View File

@@ -42,7 +42,7 @@ class TautulliStatisticsRecentlyWatchedTile extends StatelessWidget {
Widget _poster(BuildContext context) => LunaNetworkImage(
url: context.watch<TautulliState>().getImageURLFromPath(data['thumb']),
headers: context.watch<TautulliState>().headers.cast<String, String>(),
placeholderAsset: LunaAssets.video,
placeholderAsset: LunaAssets.blankVideo,
height: _imageDimension,
width: _imageDimension / 1.5,
);

View File

@@ -29,7 +29,7 @@ class TautulliStatisticsStreamTile extends StatelessWidget {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(LunaUI.BORDER_RADIUS),
image: DecorationImage(
image: AssetImage(LunaAssets.stream),
image: AssetImage(LunaAssets.blankStream),
fit: BoxFit.cover,
),
),

View File

@@ -32,7 +32,7 @@ class TautulliStatisticsUserTile extends StatelessWidget {
.watch<TautulliState>()
.getImageURLFromPath(data['user_thumb']),
headers: context.watch<TautulliState>().headers.cast<String, String>(),
placeholderAsset: LunaAssets.user,
placeholderAsset: LunaAssets.blankUser,
height: _imageDimension,
width: _imageDimension / 1.5,
);

View File

@@ -43,7 +43,7 @@ class TautulliUserTile extends StatelessWidget {
Widget _userThumb(BuildContext context) => LunaNetworkImage(
url: user.userThumb,
placeholderAsset: LunaAssets.user,
placeholderAsset: LunaAssets.blankUser,
height: _imageDimension,
width: _imageDimension,
);

View File

@@ -16,10 +16,7 @@ use_part_of: false
package: core
groups:
- paths:
- assets/images/blanks
- assets/images/branding
- assets/images/services
- path: assets/images
class_name: LunaAssets
file_name: assets
types: [ .png, .jpg, .jpeg, .webp, .webm, .bmp ]

View File

@@ -0,0 +1,30 @@
import 'dart:io';
import 'package:lunasea/core/assets.dart';
import 'package:test/test.dart';
void main() {
group('LunaAssets', () {
test('Blanks: Assets Exist', () {
expect(File(LunaAssets.blankAudio).existsSync(), true);
expect(File(LunaAssets.blankDevice).existsSync(), true);
expect(File(LunaAssets.blankStream).existsSync(), true);
expect(File(LunaAssets.blankUser).existsSync(), true);
expect(File(LunaAssets.blankVideo).existsSync(), true);
});
test('Branding: Assets Exist', () {
expect(File(LunaAssets.brandingFull).existsSync(), true);
expect(File(LunaAssets.brandingLogo).existsSync(), true);
});
test('Services: Assets Exist', () {
expect(File(LunaAssets.serviceBandsintown).existsSync(), true);
expect(File(LunaAssets.serviceDiscogs).existsSync(), true);
expect(File(LunaAssets.serviceImdb).existsSync(), true);
expect(File(LunaAssets.serviceLastfm).existsSync(), true);
expect(File(LunaAssets.serviceThemoviedb).existsSync(), true);
expect(File(LunaAssets.serviceThetvdb).existsSync(), true);
expect(File(LunaAssets.serviceTrakt).existsSync(), true);
expect(File(LunaAssets.serviceTvmaze).existsSync(), true);
expect(File(LunaAssets.serviceYoutube).existsSync(), true);
});
});
}