Skip to content

Commit d454b02

Browse files
committed
fix: small fix 👍
1 parent f6835a9 commit d454b02

File tree

203 files changed

+4875
-3621
lines changed

Some content is hidden

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

203 files changed

+4875
-3621
lines changed

lib/Adaptor/Chapter/ChapterAdaptor.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import 'package:flutter/material.dart';
32
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
43

@@ -90,7 +89,8 @@ class ChapterAdaptorState extends State<ChapterAdaptor> {
9089
),
9190
);
9291
}
93-
Widget _buildCompactView(){
92+
93+
Widget _buildCompactView() {
9494
return LayoutBuilder(
9595
builder: (context, constraints) {
9696
final parentWidth = constraints.maxWidth;
@@ -99,12 +99,13 @@ class ChapterAdaptorState extends State<ChapterAdaptor> {
9999
return AnimatedSwitcher(
100100
duration: const Duration(milliseconds: 500),
101101
child: Padding(
102-
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
102+
padding:
103+
const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
103104
child: StaggeredGrid.count(
104105
crossAxisCount: crossAxisCount,
105106
children: List.generate(
106107
chapterList.length,
107-
(index) {
108+
(index) {
108109
return SlideAndScaleAnimation(
109110
initialScale: 0.0,
110111
finalScale: 1.0,
@@ -133,5 +134,3 @@ class ChapterAdaptorState extends State<ChapterAdaptor> {
133134
);
134135
}
135136
}
136-
137-

lib/Adaptor/Chapter/ChapterListViewHolder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:dantotsu/Functions/string_extensions.dart';
22
import 'package:flutter/material.dart';
3+
34
import '../../DataClass/Chapter.dart';
45
import '../../DataClass/Media.dart';
56
import '../../Screens/Detail/Tabs/Watch/Manga/Widget/DateFormat.dart';
@@ -119,5 +120,4 @@ class ChapterListView extends StatelessWidget {
119120
),
120121
);
121122
}
122-
123123
}

lib/Adaptor/Episode/EpisodeAdaptor.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import '../../Screens/Player/Player.dart';
1212
import '../../Widgets/CustomBottomDialog.dart';
1313
import '../../api/Mangayomi/Model/Source.dart';
1414
import 'EpisodeCompactViewHolder.dart';
15-
import 'EpisodeListViewHolder.dart';
1615
import 'EpisodeGridViewHolder.dart';
16+
import 'EpisodeListViewHolder.dart';
1717

1818
class EpisodeAdaptor extends StatefulWidget {
1919
final int type;
@@ -114,7 +114,8 @@ class EpisodeAdaptorState extends State<EpisodeAdaptor> {
114114
return AnimatedSwitcher(
115115
duration: const Duration(milliseconds: 500),
116116
child: Padding(
117-
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
117+
padding:
118+
const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
118119
child: StaggeredGrid.count(
119120
crossAxisCount: crossAxisCount,
120121
children: List.generate(
@@ -153,7 +154,8 @@ class EpisodeAdaptorState extends State<EpisodeAdaptor> {
153154
},
154155
);
155156
}
156-
Widget _buildCompactView(){
157+
158+
Widget _buildCompactView() {
157159
return LayoutBuilder(
158160
builder: (context, constraints) {
159161
final parentWidth = constraints.maxWidth;
@@ -162,12 +164,13 @@ class EpisodeAdaptorState extends State<EpisodeAdaptor> {
162164
return AnimatedSwitcher(
163165
duration: const Duration(milliseconds: 500),
164166
child: Padding(
165-
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
167+
padding:
168+
const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
166169
child: StaggeredGrid.count(
167170
crossAxisCount: crossAxisCount,
168171
children: List.generate(
169172
episodeList.length,
170-
(index) {
173+
(index) {
171174
return SlideAndScaleAnimation(
172175
initialScale: 0.0,
173176
finalScale: 1.0,

lib/Adaptor/Episode/EpisodeGridViewHolder.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import 'package:dantotsu/Functions/string_extensions.dart';
2+
import 'package:dantotsu/Theme/ThemeProvider.dart';
3+
import 'package:dantotsu/Widgets/CachedNetworkImage.dart';
24
import 'package:flutter/material.dart';
35
import 'package:provider/provider.dart';
4-
import 'package:dantotsu/Widgets/CachedNetworkImage.dart';
5-
import 'package:dantotsu/Theme/ThemeProvider.dart';
6+
67
import '../../DataClass/Episode.dart';
78
import '../../DataClass/Media.dart';
89
import '../../Theme/Colors.dart';
@@ -42,7 +43,6 @@ class EpisodeCardView extends StatelessWidget {
4243
alignment: Alignment.bottomCenter,
4344
children: [
4445
_buildBackgroundImage(context),
45-
4646
_buildEpisodeInfo(context),
4747
if (isWatched) _buildWatchedOverlay(context),
4848
if (isWatched) _buildWatchedIcon(context),
@@ -58,15 +58,17 @@ class EpisodeCardView extends StatelessWidget {
5858
),
5959
);
6060
}
61+
6162
Widget _fillerColor(BuildContext context) {
6263
final themeManager = Provider.of<ThemeNotifier>(context);
6364
final isDark = themeManager.isDarkMode;
64-
return Positioned(
65+
return Positioned(
6566
child: Container(
6667
color: isDark ? fillerDark : fillerLight,
6768
),
6869
);
6970
}
71+
7072
Widget _buildNumber(BuildContext context) {
7173
var theme = Theme.of(context).colorScheme;
7274
return Align(

lib/Adaptor/Episode/Widget/HandleProgress.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ Widget handleProgress({
1010
required dynamic ep,
1111
required double width,
1212
}) {
13-
var sourceName= Provider
14-
.of<MediaServiceProvider>(context)
15-
.currentService.getName;
16-
var currentProgress = PrefManager.getCustomVal<int>("$mediaId-$ep-$sourceName-current");
17-
var maxProgress = PrefManager.getCustomVal<int>("$mediaId-$ep-$sourceName-max");
13+
var sourceName =
14+
Provider.of<MediaServiceProvider>(context).currentService.getName;
15+
var currentProgress =
16+
PrefManager.getCustomVal<int>("$mediaId-$ep-$sourceName-current");
17+
var maxProgress =
18+
PrefManager.getCustomVal<int>("$mediaId-$ep-$sourceName-max");
1819
if (currentProgress == null || maxProgress == null || maxProgress == 0) {
1920
return const SizedBox.shrink();
2021
}

lib/Adaptor/Media/MediaAdaptor.dart

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'dart:math';
2+
23
import 'package:carousel_slider/carousel_slider.dart';
34
import 'package:dantotsu/Functions/Extensions.dart';
45
import 'package:flutter/material.dart';
@@ -7,13 +8,13 @@ import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
78
import '../../Animation/ScaleAnimation.dart';
89
import '../../DataClass/Media.dart';
910
import '../../Functions/Function.dart';
10-
1111
import '../../Screens/Detail/MediaScreen.dart';
1212
import '../../Widgets/ScrollConfig.dart';
13+
import 'MediaExpandedViewHolder.dart';
1314
import 'MediaLargeViewHolder.dart';
1415
import 'MediaPageSmallViewHolder.dart';
1516
import 'MediaViewHolder.dart';
16-
import 'MediaExpandedViewHolder.dart';
17+
1718
class MediaAdaptor extends StatefulWidget {
1819
final int type;
1920
final List<Media> mediaList;
@@ -64,14 +65,15 @@ class MediaGridState extends State<MediaAdaptor> {
6465
return _buildVerticalList();
6566
case 3:
6667
return _buildStaggeredGrid();
67-
case 4 :
68+
case 4:
6869
return _buildExpandedHorizontalList();
6970
default:
7071
return const SizedBox();
7172
}
7273
}
7374

74-
String _generateTag(int index) => '${_mediaList[index].id}${Random().nextInt(100000)}';
75+
String _generateTag(int index) =>
76+
'${_mediaList[index].id}${Random().nextInt(100000)}';
7577

7678
void _handleMediaTap(int index, Media media, String tag) {
7779
if (widget.onMediaTap != null) {
@@ -81,7 +83,6 @@ class MediaGridState extends State<MediaAdaptor> {
8183
}
8284
}
8385

84-
8586
Widget _buildAnimatedMediaItem({
8687
required Widget child,
8788
required String tag,
@@ -100,6 +101,7 @@ class MediaGridState extends State<MediaAdaptor> {
100101
),
101102
);
102103
}
104+
103105
Widget _buildExpandedHorizontalList() {
104106
var height = widget.isLarge ? 270.0 : 250.0;
105107
return SizedBox(
@@ -138,6 +140,7 @@ class MediaGridState extends State<MediaAdaptor> {
138140
),
139141
);
140142
}
143+
141144
Widget _buildHorizontalList() {
142145
var height = widget.isLarge ? 270.0 : 250.0;
143146
return SizedBox(
@@ -227,6 +230,7 @@ class MediaGridState extends State<MediaAdaptor> {
227230
),
228231
);
229232
}
233+
230234
Widget _buildStaggeredGrid() {
231235
var height = widget.isLarge ? 270.0 : 250.0;
232236
return LayoutBuilder(
@@ -239,14 +243,17 @@ class MediaGridState extends State<MediaAdaptor> {
239243
child: StaggeredGrid.count(
240244
crossAxisSpacing: 16,
241245
crossAxisCount: crossAxisCount,
242-
children: List.generate(_mediaList.length, (index) {
246+
children: List.generate(
247+
_mediaList.length,
248+
(index) {
243249
final tag = _generateTag(index);
244250
return GestureDetector(
245251
onTap: () {
246252
if (widget.onMediaTap != null) {
247253
widget.onMediaTap!(index, _mediaList[index]);
248254
} else {
249-
navigateToPage(context, MediaInfoPage(_mediaList[index], tag));
255+
navigateToPage(
256+
context, MediaInfoPage(_mediaList[index], tag));
250257
}
251258
},
252259
onLongPress: () {},

lib/Adaptor/Media/MediaExpandedViewHolder.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class MediaExpandedViewHolder extends StatelessWidget {
2727
var key = '${context.currentService().getName}_thumbList';
2828
var data = loadCustomData<Map<dynamic, dynamic>>(key);
2929

30-
var list = data.map(
30+
var list = data?.map(
3131
(key, value) => MapEntry(
3232
key.toString(),
3333
(value as Map<dynamic, dynamic>).map(
@@ -39,7 +39,7 @@ class MediaExpandedViewHolder extends StatelessWidget {
3939
),
4040
);
4141

42-
thumb.value = list[mediaInfo.id.toString()]
42+
thumb.value = list?[mediaInfo.id.toString()]
4343
?[((mediaInfo.userProgress ?? 0) + 1).toString()] ??
4444
mediaInfo.cover ??
4545
'';

lib/Adaptor/Media/MediaLargeViewHolder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class MediaPageLargeViewHolder extends StatelessWidget {
208208

209209
String formatMediaInfo(Media media) {
210210
final nextAiringEpisode = media.anime?.nextAiringEpisode;
211-
final totalEpisodes = "${media.anime?.totalEpisodes ?? "??"}";
211+
final totalEpisodes = "${media.anime?.totalEpisodes ?? "??"}";
212212
return nextAiringEpisode != null && nextAiringEpisode != -1
213213
? "$nextAiringEpisode / $totalEpisodes"
214214
: totalEpisodes;

lib/Adaptor/Media/MediaPageSmallViewHolder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class MediaPageSmallViewHolder extends StatelessWidget {
208208

209209
String formatMediaInfo(Media media) {
210210
final nextAiringEpisode = media.anime?.nextAiringEpisode;
211-
final totalEpisodes = "${media.anime?.totalEpisodes ?? "??"}";
211+
final totalEpisodes = "${media.anime?.totalEpisodes ?? "??"}";
212212
return nextAiringEpisode != null && nextAiringEpisode != -1
213213
? "$nextAiringEpisode / $totalEpisodes"
214214
: totalEpisodes;

lib/Adaptor/Media/MediaViewHolder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class MediaViewHolder extends StatelessWidget {
150150

151151
String formatMediaInfo(Media media) {
152152
final nextAiringEpisode = media.anime?.nextAiringEpisode;
153-
final totalEpisodes = "${media.anime?.totalEpisodes ?? "~"}";
153+
final totalEpisodes = "${media.anime?.totalEpisodes ?? "~"}";
154154
return nextAiringEpisode != null && nextAiringEpisode != -1
155155
? "$nextAiringEpisode | $totalEpisodes"
156156
: totalEpisodes;

0 commit comments

Comments
 (0)