Skip to content

Commit 7fcb3b9

Browse files
committed
feat: navbar revamp for desktop
1 parent cb05cc9 commit 7fcb3b9

35 files changed

+1729
-501
lines changed

lib/Adaptor/Media/MediaPageSmallViewHolder.dart

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,23 @@ class MediaPageSmallViewHolder extends StatelessWidget {
2222
final gradientColors = isDarkMode
2323
? [Colors.transparent, theme.surface]
2424
: [Colors.white.withValues(alpha: 0.2), theme.surface];
25-
return Scaffold(
26-
body: Stack(
27-
children: [
28-
Positioned.fill(
29-
child: _buildBackground(mediaInfo.banner ?? mediaInfo.cover),
30-
),
31-
_buildGradientOverlay(gradientColors),
32-
const Blur(
33-
colorOpacity: 0.0,
34-
blur: 10,
35-
blurColor: Colors.transparent,
36-
child: SizedBox.expand(),
37-
),
38-
Padding(
39-
padding: EdgeInsets.only(bottom: 24, top: 0.statusBar()),
40-
child: _buildContent(context, theme),
41-
),
42-
],
43-
),
25+
return Stack(
26+
children: [
27+
Positioned.fill(
28+
child: _buildBackground(mediaInfo.banner ?? mediaInfo.cover),
29+
),
30+
_buildGradientOverlay(gradientColors),
31+
const Blur(
32+
colorOpacity: 0.0,
33+
blur: 10,
34+
blurColor: Colors.transparent,
35+
child: SizedBox.expand(),
36+
),
37+
Padding(
38+
padding: EdgeInsets.only(bottom: 24, top: 0.statusBar()),
39+
child: _buildContent(context, theme),
40+
),
41+
],
4442
);
4543
}
4644

lib/Adaptor/Media/Widgets/MediaCard.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:get/get.dart';
23

34
import '../../../Widgets/CachedNetworkImage.dart';
45

@@ -10,7 +11,8 @@ Widget MediaCard(
1011
}) {
1112
double height = 72;
1213
final theme = Theme.of(context).colorScheme;
13-
var screenWidth = MediaQuery.of(context).size.width;
14+
var leftWidth = MediaQuery.of(context).size.width;
15+
var screenWidth = context.isPhone ? leftWidth : leftWidth - 100;
1416
double width = screenWidth * 0.4;
1517
if (width > 256) width = 256;
1618
double radius = 10;

lib/Api/Anilist/Anilist.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class AnilistController extends BaseServiceData {
154154
adult = false;
155155
userid = null;
156156
avatar.value = '';
157-
bg = null;
157+
bg.value = '';
158158
episodesWatched = null;
159159
chapterRead = null;
160160
unreadNotificationCount = 0;

lib/Api/Anilist/AnilistQueries/GetUserData.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extension on AnilistQueries {
1818

1919
Anilist.userid = user.id;
2020
Anilist.username.value = user.name ?? '';
21-
Anilist.bg = user.bannerImage;
21+
Anilist.bg.value = user.bannerImage ?? '';
2222
Anilist.avatar.value = user.avatar?.medium ?? '';
2323
Anilist.episodesWatched = user.statistics?.anime?.episodesWatched;
2424
Anilist.chapterRead = user.statistics?.manga?.chaptersRead;

lib/Api/EpisodeDetails/Aniskip/Aniskip.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,23 @@ class AniSkip {
1010
required int episodeLength,
1111
required bool useProxyForTimeStamps,
1212
}) async {
13-
if (malId == null) {
14-
return null;
15-
}
13+
if (malId == null) return null;
1614
final url =
1715
"https://api.aniskip.com/v2/skip-times/$malId/$episodeNumber?types[]=ed&types[]=mixed-ed&types[]=mixed-op&types[]=op&types[]=recap&episodeLength=$episodeLength";
1816

1917
try {
2018
final response = await http.get(
21-
Uri.parse(useProxyForTimeStamps
22-
? "https://corsproxy.io/?${Uri.encodeComponent(url)}"
23-
: url),
19+
Uri.parse(
20+
useProxyForTimeStamps
21+
? "https://corsproxy.io/?${Uri.encodeComponent(url)}"
22+
: url,
23+
),
2424
);
2525

2626
if (response.statusCode == 200) {
2727
final Map<String, dynamic> data = json.decode(response.body);
2828
final aniSkipResponse = AniSkipResponse.fromJson(data);
29+
debugPrint('AniSkip response: ${aniSkipResponse.results}');
2930
return aniSkipResponse.found ? aniSkipResponse.results : null;
3031
} else {
3132
debugPrint('Failed to fetch data with status: ${response.statusCode}');

lib/Api/EpisodeDetails/GetMediaIDs/GetMediaIDs.dart

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,7 @@ import 'package:json_annotation/json_annotation.dart';
88

99
part 'GetMediaIDs.g.dart';
1010

11-
enum AnimeIDType {
12-
anilistId,
13-
kitsuId,
14-
malId,
15-
animePlanetId,
16-
anisearchId,
17-
anidbId,
18-
notifyMoeId,
19-
imdbId,
20-
livechartId,
21-
thetvdbId,
22-
themoviedbId;
2311

24-
String get fieldName {
25-
switch (this) {
26-
case AnimeIDType.anilistId:
27-
return 'anilist_id';
28-
case AnimeIDType.kitsuId:
29-
return 'kitsu_id';
30-
case AnimeIDType.malId:
31-
return 'mal_id';
32-
case AnimeIDType.animePlanetId:
33-
return 'anime-planet_id';
34-
case AnimeIDType.anisearchId:
35-
return 'anisearch_id';
36-
case AnimeIDType.anidbId:
37-
return 'anidb_id';
38-
case AnimeIDType.notifyMoeId:
39-
return 'notify.moe_id';
40-
case AnimeIDType.imdbId:
41-
return 'imdb_id';
42-
case AnimeIDType.livechartId:
43-
return 'livechart_id';
44-
case AnimeIDType.thetvdbId:
45-
return 'thetvdb_id';
46-
case AnimeIDType.themoviedbId:
47-
return 'themoviedb_id';
48-
}
49-
}
50-
}
5112

5213
class GetMediaIDs {
5314
static List<AnimeID>? _animeListFuture;
@@ -118,7 +79,46 @@ class GetMediaIDs {
11879
}
11980
}
12081
}
82+
enum AnimeIDType {
83+
anilistId,
84+
kitsuId,
85+
malId,
86+
animePlanetId,
87+
anisearchId,
88+
anidbId,
89+
notifyMoeId,
90+
imdbId,
91+
livechartId,
92+
thetvdbId,
93+
themoviedbId;
12194

95+
String get fieldName {
96+
switch (this) {
97+
case AnimeIDType.anilistId:
98+
return 'anilist_id';
99+
case AnimeIDType.kitsuId:
100+
return 'kitsu_id';
101+
case AnimeIDType.malId:
102+
return 'mal_id';
103+
case AnimeIDType.animePlanetId:
104+
return 'anime-planet_id';
105+
case AnimeIDType.anisearchId:
106+
return 'anisearch_id';
107+
case AnimeIDType.anidbId:
108+
return 'anidb_id';
109+
case AnimeIDType.notifyMoeId:
110+
return 'notify.moe_id';
111+
case AnimeIDType.imdbId:
112+
return 'imdb_id';
113+
case AnimeIDType.livechartId:
114+
return 'livechart_id';
115+
case AnimeIDType.thetvdbId:
116+
return 'thetvdb_id';
117+
case AnimeIDType.themoviedbId:
118+
return 'themoviedb_id';
119+
}
120+
}
121+
}
122122
class AnimeID {
123123
@JsonKey(name: 'anime-planet_id')
124124
final String? animePlanetId;

lib/Api/EpisodeDetails/Kitsu/Kitsu.dart

Lines changed: 39 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -13,77 +13,58 @@ class Kitsu {
1313
static Future<Map<String, Episode>?> getKitsuEpisodesDetails(
1414
Media mediaData) async {
1515
if (mediaData.idAnilist == null && mediaData.idMAL == null) return {};
16-
final query = mediaData.idAnilist == null
17-
? '''
18-
query {
19-
lookupMapping(externalId: ${mediaData.idAnilist}, externalSite: ANILIST_ANIME) {
20-
__typename
21-
... on Anime {
22-
id
23-
episodes(first: 2000) {
24-
nodes {
25-
number
26-
titles {
27-
canonicalLocale
28-
}
29-
description
30-
thumbnail {
31-
original {
32-
url
16+
17+
final externalId = mediaData.idAnilist ?? mediaData.idMAL;
18+
final externalSite =
19+
mediaData.idAnilist != null ? 'ANILIST_ANIME' : 'MYANIMELIST_ANIME';
20+
21+
final query = '''
22+
query {
23+
lookupMapping(externalId: $externalId, externalSite: $externalSite) {
24+
__typename
25+
... on Anime {
26+
id
27+
episodes(first: 2000) {
28+
nodes {
29+
number
30+
titles {
31+
canonicalLocale
3332
}
34-
}
35-
}
36-
}
37-
}
38-
}
39-
}
40-
'''
41-
: '''
42-
query {
43-
lookupMapping(externalId: ${mediaData.idMAL}, externalSite: MYANIMELIST_ANIME) {
44-
__typename
45-
... on Anime {
46-
id
47-
episodes(first: 2000) {
48-
nodes {
49-
number
50-
titles {
51-
canonicalLocale
52-
}
53-
description
54-
thumbnail {
55-
original {
56-
url
33+
description
34+
thumbnail {
35+
original {
36+
url
37+
}
5738
}
5839
}
5940
}
6041
}
6142
}
6243
}
63-
}
6444
''';
6545

6646
final result = (await getKitsuData(query))?.data?.lookupMapping;
67-
if (result == null) {
68-
return null;
69-
}
47+
if (result == null) return null;
7048

7149
mediaData.idKitsu = result.id;
7250

73-
final episodesMap = result.episodes?.nodes?.asMap().map((_, ep) {
74-
return MapEntry(
75-
ep?.number?.toString() ?? '',
76-
Episode(
77-
number: ep?.number.toString() ?? '',
78-
title: ep?.titles?.canonical,
79-
desc: ep?.description?.en,
80-
thumb: ep?.thumbnail?.original?.url,
81-
),
82-
);
83-
}) ??
84-
{};
85-
86-
return episodesMap;
51+
final nodes = result.episodes?.nodes;
52+
if (nodes == null) return {};
53+
54+
return Map.fromEntries(
55+
nodes.map((ep) {
56+
final number = ep?.number?.toString() ?? '';
57+
return MapEntry(
58+
number,
59+
Episode(
60+
number: number,
61+
title: ep?.titles?.canonical,
62+
desc: ep?.description?.en,
63+
thumb: ep?.thumbnail?.original?.url,
64+
),
65+
);
66+
}),
67+
);
8768
}
8869

8970
static Future<String?> decodeToString(http.Response? res) async {

lib/Api/Extensions/ExtensionsQueries/GetUserData.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ extension on ExtensionsQueries {
1111
}
1212
return true;
1313
}
14+
await Future.delayed(const Duration(milliseconds: 800)); // let homepage build
1415
ExtensionsC.run.value = false;
1516
ExtensionsC.userid = 26;
1617
ExtensionsC.username.value = 'Dartotsu';
17-
ExtensionsC.bg =
18+
ExtensionsC.bg.value =
1819
'https://camo.githubusercontent.com/6c1f656dd81f1faf1d80ceb0885b68c2ec5b38d0d5b876bf812b37c76d348733/68747470733a2f2f66696c65732e636174626f782e6d6f652f746e6d3173722e706e67';
1920
ExtensionsC.avatar.value =
2021
'https://cdn.discordapp.com/emojis/1305525420938100787.gif?size=48&animated=true&name=dartotsu';

lib/Api/MyAnimeList/Mal.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class MalController extends BaseServiceData {
9898
adult = false;
9999
userid = null;
100100
avatar.value = '';
101-
bg = null;
101+
bg.value = '';
102102
episodesWatched = null;
103103
chapterRead = null;
104104
unreadNotificationCount = 0;

lib/Api/MyAnimeList/MalQueries/GetUserData.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extension on MalQueries {
2121
?.data;
2222
Mal.userid = user.id;
2323
Mal.username.value = user.name ?? '';
24-
Mal.bg = user.picture ?? '';
24+
Mal.bg.value = user.picture ?? '';
2525
Mal.avatar.value = user.picture ?? '';
2626
Mal.episodesWatched = res?.statistics?.anime?.episodesWatched;
2727
Mal.chapterRead = res?.statistics?.manga?.chaptersRead;

0 commit comments

Comments
 (0)