Skip to content

Commit d6371b9

Browse files
committed
feat: compact list editor for anilist
1 parent 38323bb commit d6371b9

File tree

133 files changed

+958
-591
lines changed

Some content is hidden

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

133 files changed

+958
-591
lines changed

analysis_options.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ linter:
3131
# avoid_print: false # Uncomment to disable the `avoid_print` rule
3232
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
3333
non_constant_identifier_names: false
34+
prefer_const_constructors : true
35+
3436
# Additional information about this file can be found at
3537
# https://dart.dev/guides/language/analysis-options

lib/Adaptor/Chapter/ChapterAdaptor.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import 'package:flutter/material.dart';
44
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
55

66
import '../../Animation/ScaleAnimation.dart';
7+
import '../../Api/Sources/Model/Source.dart';
78
import '../../Api/Sources/Search/get_pages.dart';
89
import '../../DataClass/Chapter.dart';
910
import '../../DataClass/Media.dart';
10-
import '../../Api/Sources/Model/Source.dart';
1111
import '../../Widgets/CustomBottomDialog.dart';
1212
import 'ChapterCompactViewHolder.dart';
1313
import 'ChapterListViewHolder.dart';
@@ -160,7 +160,7 @@ Future<void> onChapterClick(
160160
) async {
161161
showCustomBottomDialog(
162162
context,
163-
CustomBottomDialog(
163+
const CustomBottomDialog(
164164
viewList: [
165165
Center(
166166
child: CircularProgressIndicator(),

lib/Adaptor/Chapter/ChapterListViewHolder.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class ChapterListView extends StatelessWidget {
6565
),
6666
if (chapter.mChapter?.scanlator != null &&
6767
chapter.mChapter?.scanlator != '')
68-
SizedBox(height: 4),
68+
const SizedBox(height: 4),
6969
_buildDescription(theme, context),
7070
],
7171
),
@@ -77,7 +77,7 @@ class ChapterListView extends StatelessWidget {
7777
color: theme.onSurface,
7878
size: 26,
7979
),
80-
SizedBox(width: 8),
80+
const SizedBox(width: 8),
8181
],
8282
);
8383
}
@@ -93,7 +93,7 @@ class ChapterListView extends StatelessWidget {
9393
}
9494
if (chapter.date != null && chapter.mChapter?.scanlator != null) {
9595
spans.add(
96-
TextSpan(
96+
const TextSpan(
9797
text: ' • ',
9898
),
9999
);

lib/Adaptor/Charactes/StaffViewHolder.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class StaffViewHolder extends StatelessWidget {
6060
);
6161
}
6262
}
63+
6364
class StudioViewHolder extends StatelessWidget {
6465
final studio studioInfo;
6566

@@ -99,4 +100,4 @@ class StudioViewHolder extends StatelessWidget {
99100
],
100101
);
101102
}
102-
}
103+
}

lib/Adaptor/Charactes/Widgets/EntitySection.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
23
import '../EntityAdaptor.dart';
34

45
Widget entitySection({

lib/Adaptor/Episode/EpisodeAdaptor.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import 'package:dartotsu/Functions/Function.dart';
21
import 'package:dartotsu/Api/Sources/Eval/dart/model/video.dart';
32
import 'package:dartotsu/Api/Sources/Search/getVideo.dart';
3+
import 'package:dartotsu/Functions/Function.dart';
44
import 'package:flutter/material.dart';
55
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
66
import 'package:get/get.dart';
77

88
import '../../Animation/ScaleAnimation.dart';
9+
import '../../Api/Sources/Model/Source.dart';
910
import '../../DataClass/Episode.dart';
1011
import '../../DataClass/Media.dart';
1112
import '../../Screens/Anime/Player/Player.dart';
1213
import '../../Widgets/CustomBottomDialog.dart';
13-
import '../../Api/Sources/Model/Source.dart';
1414
import 'EpisodeCompactViewHolder.dart';
1515
import 'EpisodeGridViewHolder.dart';
1616
import 'EpisodeListViewHolder.dart';
@@ -254,7 +254,7 @@ void onEpisodeClick(
254254
}
255255
}
256256
return Card(
257-
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
257+
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
258258
shape: RoundedRectangleBorder(
259259
borderRadius: BorderRadius.circular(12),
260260
),
@@ -276,14 +276,14 @@ void onEpisodeClick(
276276
},
277277
borderRadius: BorderRadius.circular(12),
278278
child: Padding(
279-
padding: EdgeInsets.all(16),
279+
padding: const EdgeInsets.all(16),
280280
child: Row(
281281
mainAxisAlignment: MainAxisAlignment.spaceBetween,
282282
children: [
283283
Expanded(
284284
child: Text(
285285
item.quality,
286-
style: TextStyle(
286+
style: const TextStyle(
287287
fontSize: 16,
288288
fontWeight: FontWeight.bold,
289289
overflow: TextOverflow.ellipsis,

lib/Adaptor/Episode/EpisodeGridViewHolder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class EpisodeCardView extends StatelessWidget {
7474
return Align(
7575
alignment: Alignment.bottomRight,
7676
child: Transform.translate(
77-
offset: Offset(0, 6),
77+
offset: const Offset(0, 6),
7878
child: Padding(
7979
padding: const EdgeInsets.only(right: 8, bottom: 0),
8080
child: Text(

lib/Adaptor/Episode/Widget/HandleProgress.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ Widget handleProgress({
1212
}) {
1313
var sourceName =
1414
Provider.of<MediaServiceProvider>(context).currentService.getName;
15-
var currentProgress =
16-
loadCustomData<int>("$mediaId-$ep-$sourceName-current");
17-
var maxProgress =
18-
loadCustomData<int>("$mediaId-$ep-$sourceName-max");
15+
var currentProgress = loadCustomData<int>("$mediaId-$ep-$sourceName-current");
16+
var maxProgress = loadCustomData<int>("$mediaId-$ep-$sourceName-max");
1917
if (currentProgress == null || maxProgress == null || maxProgress == 0) {
2018
return const SizedBox.shrink();
2119
}

lib/Adaptor/Media/MediaAdaptor.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,15 @@ class MediaGridState extends State<MediaAdaptor> {
8282
if (widget.onMediaTap != null) {
8383
widget.onMediaTap!(index, media);
8484
} else {
85+
//context.currentService(listen: false).data.mutations?.editList(media);
8586
navigateToPage(context, MediaInfoPage(media, tag));
8687
}
8788
}
8889

90+
void _handleLongTap(BuildContext c, Media media) {
91+
c.currentService(listen: false).compactListEditor(c,media);
92+
}
93+
8994
Widget _buildAnimatedMediaItem({
9095
required Widget child,
9196
required String tag,
@@ -100,6 +105,7 @@ class MediaGridState extends State<MediaAdaptor> {
100105
duration: const Duration(milliseconds: 200),
101106
child: GestureDetector(
102107
onTap: () => _handleMediaTap(index, _mediaList[index], tag),
108+
onLongPress: () => _handleLongTap(context,_mediaList[index]),
103109
child: child,
104110
),
105111
);
@@ -119,7 +125,7 @@ class MediaGridState extends State<MediaAdaptor> {
119125
final tag = _generateTag(index);
120126
return Container(
121127
width: 250,
122-
margin: EdgeInsets.symmetric(horizontal: 6.5).copyWith(
128+
margin: const EdgeInsets.symmetric(horizontal: 6.5).copyWith(
123129
left: Directionality.of(context) == TextDirection.rtl
124130
? (index == _mediaList.length - 1 ? 24.0 : 6.5)
125131
: (index == 0 ? 24.0 : 6.5),
@@ -158,7 +164,7 @@ class MediaGridState extends State<MediaAdaptor> {
158164
final tag = _generateTag(index);
159165
return Container(
160166
width: 102,
161-
margin: EdgeInsets.symmetric(horizontal: 6.5).copyWith(
167+
margin: const EdgeInsets.symmetric(horizontal: 6.5).copyWith(
162168
left: Directionality.of(context) == TextDirection.rtl
163169
? (index == _mediaList.length - 1 ? 24.0 : 6.5)
164170
: (index == 0 ? 24.0 : 6.5),
@@ -194,6 +200,7 @@ class MediaGridState extends State<MediaAdaptor> {
194200
final tag = _generateTag(index);
195201
return GestureDetector(
196202
onTap: () => _handleMediaTap(index, _mediaList[index], tag),
203+
onLongPress: () => _handleLongTap(context,_mediaList[index]),
197204
child: MediaPageSmallViewHolder(_mediaList[index], tag),
198205
);
199206
},
@@ -252,7 +259,7 @@ class MediaGridState extends State<MediaAdaptor> {
252259
final tag = _generateTag(index);
253260
return GestureDetector(
254261
onTap: () => _handleMediaTap(index, _mediaList[index], tag),
255-
onLongPress: () {},
262+
onLongPress: () => _handleLongTap(context,_mediaList[index]),
256263
child: SizedBox(
257264
width: 108,
258265
height: height,

lib/Adaptor/Media/MediaLargeViewHolder.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ class MediaPageLargeViewHolder extends StatelessWidget {
163163

164164
Widget _buildAdditionalInfo(ColorScheme theme) {
165165
final isAnime = mediaInfo.anime != null;
166-
final mediaType = isAnime ? getString.episode(mediaInfo.anime?.totalEpisodes ?? 0) : getString.chapter(mediaInfo.manga?.totalChapters ?? 0);
166+
final mediaType = isAnime
167+
? getString.episode(mediaInfo.anime?.totalEpisodes ?? 0)
168+
: getString.chapter(mediaInfo.manga?.totalChapters ?? 0);
167169
final mediaCount = isAnime
168170
? formatMediaInfo(mediaInfo)
169171
: mediaInfo.manga?.totalChapters != 0

0 commit comments

Comments
 (0)