Skip to content

Commit 3d1357b

Browse files
committed
feat: other shit
1 parent 137ab67 commit 3d1357b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+720
-644
lines changed

lib/Adaptor/Episode/EpisodeAdaptor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class EpisodeAdaptorState extends State<EpisodeAdaptor> {
8383
const EdgeInsets.symmetric(horizontal: 18, vertical: 4),
8484
child: Opacity(
8585
opacity: isWatched ? 0.5 : 1.0,
86-
child: EpisodeListView(episode: episodeList[index]),
86+
child: EpisodeListView(episode: episodeList[index], isWatched: isWatched,),
8787
),
8888
),
8989
),

lib/Adaptor/Episode/EpisodeListViewHolder.dart

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@ import '../../DataClass/Episode.dart';
99

1010
class EpisodeListView extends StatelessWidget {
1111
final Episode episode;
12+
final bool isWatched;
1213

13-
const EpisodeListView({super.key, required this.episode});
14+
const EpisodeListView(
15+
{super.key, required this.episode, required this.isWatched});
1416

1517
@override
1618
Widget build(BuildContext context) {
1719
final theme = Theme.of(context).colorScheme;
1820
final themeManager = Provider.of<ThemeNotifier>(context);
1921
final isDark = themeManager.isDarkMode;
2022

21-
Color cardColor = (episode.filler ?? false) ?
22-
(isDark ? fillerDark : fillerLight) :
23-
theme.surfaceContainerLowest;
23+
Color cardColor = (episode.filler ?? false)
24+
? (isDark ? fillerDark : fillerLight)
25+
: theme.surfaceContainerHighest;
2426

2527
return Card(
2628
margin: const EdgeInsets.all(8),
@@ -44,7 +46,7 @@ class EpisodeListView extends StatelessWidget {
4446
return Row(
4547
crossAxisAlignment: CrossAxisAlignment.center,
4648
children: [
47-
_buildThumbnail(theme),
49+
_buildThumbnail(context, theme),
4850
Expanded(
4951
child: Padding(
5052
padding: const EdgeInsets.symmetric(vertical: 8),
@@ -76,7 +78,7 @@ class EpisodeListView extends StatelessWidget {
7678
);
7779
}
7880

79-
Widget _buildThumbnail(ColorScheme theme) {
81+
Widget _buildThumbnail(BuildContext context, ColorScheme theme) {
8082
return Card(
8183
margin: const EdgeInsets.all(8),
8284
shape: RoundedRectangleBorder(
@@ -85,9 +87,8 @@ class EpisodeListView extends StatelessWidget {
8587
elevation: 4,
8688
color: theme.surfaceContainerLowest,
8789
child: Stack(
88-
alignment: Alignment.center,
90+
alignment: Alignment.bottomCenter,
8991
children: [
90-
const CircularProgressIndicator(),
9192
ClipRRect(
9293
borderRadius: BorderRadius.circular(16.0),
9394
child: cachedNetworkImage(
@@ -99,6 +100,9 @@ class EpisodeListView extends StatelessWidget {
99100
color: Colors.white12,
100101
width: 164,
101102
height: 109,
103+
child: const Center(
104+
child: CircularProgressIndicator(),
105+
),
102106
),
103107
),
104108
),
@@ -116,7 +120,8 @@ class EpisodeListView extends StatelessWidget {
116120
),
117121
child: Padding(
118122
padding: const EdgeInsets.symmetric(
119-
horizontal: 6.0, vertical: 4.0,
123+
horizontal: 6.0,
124+
vertical: 4.0,
120125
),
121126
child: Text(
122127
episode.number,
@@ -130,6 +135,26 @@ class EpisodeListView extends StatelessWidget {
130135
),
131136
),
132137
),
138+
if (isWatched)
139+
Positioned(
140+
bottom: 6,
141+
left: 3,
142+
child: Icon(
143+
Icons.remove_red_eye,
144+
color: theme.onSurface,
145+
size: 26,
146+
),
147+
),
148+
SizedBox(
149+
width: 142,
150+
child: LinearProgressIndicator(
151+
value: 0.7,
152+
backgroundColor: Colors.grey,
153+
valueColor:
154+
AlwaysStoppedAnimation<Color>(Theme.of(context).primaryColor),
155+
minHeight: 3,
156+
),
157+
),
133158
],
134159
),
135160
);
@@ -146,8 +171,8 @@ class EpisodeListView extends StatelessWidget {
146171
fontWeight: FontWeight.w400,
147172
),
148173
maxLines: 3,
149-
expandText: 'show more',
150-
collapseText: 'show less',
174+
expandText: 'Show more',
175+
collapseText: 'Show less',
151176
),
152177
);
153178
}

lib/Adaptor/Media/MediaAdaptor.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import '../../Animation/ScaleAnimation.dart';
99
import '../../DataClass/Media.dart';
1010
import '../../Functions/Function.dart';
1111
import '../../Screens/Info/MediaScreen.dart';
12-
import '../../Screens/Settings/SettingsBottomSheet.dart';
1312
import '../../Widgets/ScrollConfig.dart';
1413
import 'MediaPageSmallViewHolder.dart';
1514
import 'MediaViewHolder.dart';
@@ -70,6 +69,7 @@ class MediaGridState extends State<MediaAdaptor> {
7069
}
7170

7271
Widget _buildStaggeredGrid() {
72+
var height = widget.isLarge ? 270.0 : 250.0;
7373
return LayoutBuilder(
7474
builder: (context, constraints) {
7575
final parentWidth = constraints.maxWidth;
@@ -91,10 +91,10 @@ class MediaGridState extends State<MediaAdaptor> {
9191
navigateToPage(context, MediaInfoPage(_mediaList[index]));
9292
}
9393
},
94-
onLongPress: () => settingsBottomSheet(context),
94+
onLongPress: () {},
9595
child: SizedBox(
9696
width: 108,
97-
height: 250,
97+
height: height,
9898
child: MediaViewHolder(
9999
mediaInfo: _mediaList[index],
100100
isLarge: widget.isLarge,
@@ -135,7 +135,7 @@ class MediaGridState extends State<MediaAdaptor> {
135135
navigateToPage(context, MediaInfoPage(_mediaList[index]));
136136
}
137137
},
138-
onLongPress: () => settingsBottomSheet(context),
138+
onLongPress:() {},
139139
child: Container(
140140
width: double.infinity,
141141
margin: const EdgeInsets.symmetric(horizontal: 18, vertical: 4),
@@ -183,7 +183,7 @@ class MediaGridState extends State<MediaAdaptor> {
183183
navigateToPage(context, MediaInfoPage(_mediaList[index]));
184184
}
185185
},
186-
onLongPress: () => settingsBottomSheet(context),
186+
onLongPress: () {},
187187
child: Container(
188188
width: 102,
189189
margin: margin,
@@ -262,7 +262,7 @@ class LargeViewState extends State<LargeView> {
262262
return GestureDetector(
263263
onTap: () => navigateToPage(
264264
context, MediaInfoPage(widget.mediaList[index])),
265-
onLongPress: () => settingsBottomSheet(context),
265+
onLongPress: () {},
266266
child: MediaPageSmallViewHolder(widget.mediaList[index]),
267267
);
268268
},

lib/Adaptor/Media/MediaViewHolder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class MediaViewHolder extends StatelessWidget {
7373
const SizedBox(width: 4),
7474
Flexible(
7575
child: Text(
76-
mediaInfo.relation ?? "",
76+
mediaInfo.relation?.replaceAll("_", " ") ?? "",
7777
style: TextStyle(
7878
fontFamily: 'Poppins',
7979
fontSize: 12,

lib/DataClass/Manga.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import 'Author.dart';
2+
import 'MangaChapter.dart';
23

34
class Manga {
45
int? totalChapters;
56
String? selectedChapter;
6-
//Map<String, MangaChapter>? chapters;
7+
Map<String, MangaChapter>? chapters;
78
String? slug;
89
author? mediaAuthor;
910

1011
Manga({
1112
this.totalChapters,
1213
this.selectedChapter,
13-
//this.chapters,
14+
this.chapters,
1415
this.slug,
1516
this.mediaAuthor,
1617
});

lib/DataClass/MangaChapter.dart

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import '../api/Mangayomi/Eval/dart/model/m_chapter.dart';
2+
3+
class MangaChapter {
4+
final String number;
5+
String link;
6+
String? title;
7+
String? description;
8+
final MChapter mChapter;
9+
String? scanlator;
10+
int? date;
11+
String? progress;
12+
13+
final List<MangaImage> _images = [];
14+
final List<MapEntry<MangaImage, MangaImage?>> _dualPages = [];
15+
16+
MangaChapter({
17+
required this.number,
18+
required this.link,
19+
this.title,
20+
this.description,
21+
required this.mChapter,
22+
this.scanlator,
23+
this.date,
24+
this.progress = '',
25+
});
26+
27+
MangaChapter.from(MangaChapter chapter)
28+
: this(
29+
number: chapter.number,
30+
link: chapter.link,
31+
title: chapter.title,
32+
description: chapter.description,
33+
mChapter: chapter.mChapter,
34+
scanlator: chapter.scanlator,
35+
date: chapter.date,
36+
progress: chapter.progress,
37+
);
38+
39+
List<MangaImage> get images => _images;
40+
41+
void addImages(List<MangaImage> images) {
42+
if (_images.isNotEmpty) return;
43+
_images.addAll(images);
44+
45+
for (int i = 0; i <= ((images.length - 1) / 2).floor(); i++) {
46+
final int index = i * 2;
47+
_dualPages.add(MapEntry(_images[index], index + 1 < _images.length ? _images[index + 1] : null));
48+
}
49+
}
50+
51+
List<MapEntry<MangaImage, MangaImage?>> get dualPages => _dualPages;
52+
}
53+
54+
class MangaImage {
55+
final String url;
56+
final bool useTransformation;
57+
//final Page? page;
58+
59+
MangaImage({
60+
required this.url,
61+
this.useTransformation = false,
62+
//this.page,
63+
});
64+
65+
// Constructor that accepts a String URL
66+
MangaImage.fromUrl(String url, {bool useTransformation = false,// Page? page
67+
})
68+
: this(
69+
url: url,
70+
useTransformation: useTransformation,
71+
//page: page,
72+
);
73+
}

lib/Network.dart

Lines changed: 0 additions & 64 deletions
This file was deleted.

lib/Screens/Extensions/ExtensionItem.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class _ExtensionListTileWidgetState
6363

6464
return Material(
6565
child: ListTile(
66+
tileColor: theme.surface,
6667
leading: Container(
6768
height: 37,
6869
width: 37,

lib/Screens/Extensions/ExtensionList.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ class _ExtensionScreenState extends ConsumerState<Extension> {
4747
}
4848
Future<void> _refreshData() async {
4949
if (widget.isManga) {
50-
await ref.watch(fetchMangaSourcesListProvider(id: null, reFresh: true).future);
50+
await ref.refresh(fetchMangaSourcesListProvider(id: null, reFresh: true).future);
5151
} else {
52-
await ref.watch(fetchAnimeSourcesListProvider(id: null, reFresh: true).future);
52+
await ref.refresh(fetchAnimeSourcesListProvider(id: null, reFresh: true).future);
5353
}
5454
}
5555
@override

lib/Screens/Home/HomeScreen.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import '../../DataClass/MediaSection.dart';
1717
import '../../Preferences/PrefManager.dart';
1818
import '../../Preferences/Preferences.dart';
1919
import '../../Widgets/CachedNetworkImage.dart';
20+
import '../../Widgets/CustomBottomDialog.dart';
2021
import '../../api/Anilist/Anilist.dart';
2122
import '../../api/Anilist/AnilistViewModel.dart';
2223
import '../BaseMediaScreen.dart';
@@ -218,7 +219,7 @@ class HomeScreenState extends BaseMediaScreen<HomeScreen> {
218219
child: Stack(
219220
children: [
220221
GestureDetector(
221-
onTap: () => settingsBottomSheet(context),
222+
onTap: () => showCustomBottomDialog(context, const SettingsBottomSheet()),
222223
child: const AvatarWidget(icon: Icons.settings),
223224
),
224225
if (Anilist.unreadNotificationCount > 0)
@@ -245,7 +246,7 @@ class HomeScreenState extends BaseMediaScreen<HomeScreen> {
245246
child: SlideUpAnimation(
246247
child: Row(children: [
247248
GestureDetector(
248-
onTap: () => settingsBottomSheet(context),
249+
onTap: () {},
249250
child: CircleAvatar(
250251
backgroundColor: Colors.transparent,
251252
radius: 26.0,

0 commit comments

Comments
 (0)