Skip to content

Commit ea01276

Browse files
committed
fix(manga page): two title bars
1 parent 28fa0ec commit ea01276

File tree

3 files changed

+86
-75
lines changed

3 files changed

+86
-75
lines changed

lib/Screens/Detail/Tabs/Watch/Anime/AnimeWatchScreen.dart

Lines changed: 83 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -46,79 +46,90 @@ class AnimeWatchScreenState extends BaseWatchScreen<AnimeWatchScreen> {
4646
get widgetList => [_buildEpisodeList()];
4747

4848
Widget _buildEpisodeList() {
49-
return Obx(() {
50-
var episodeList = _viewModel.episodeList.value;
51-
if (episodeList == null) {
52-
return const Center(child: CircularProgressIndicator());
53-
}
54-
55-
if (!_viewModel.episodeDataLoaded.value) {
56-
return const Center(child: CircularProgressIndicator());
57-
}
58-
if (episodeList.isEmpty) {
59-
return Column(
60-
children: [
61-
_buildTitle(),
62-
Center(
63-
child: Text(
64-
_viewModel.errorType.value == ErrorType.NotFound
65-
? 'Media not found'
66-
: 'No episodes found',
67-
style: TextStyle(
68-
color: Theme.of(context).colorScheme.onSurface,
69-
fontWeight: FontWeight.bold,
70-
),
71-
),
72-
),
73-
],
74-
);
75-
}
76-
updateEpisodeDetails(episodeList);
77-
78-
var (chunks, initChunkIndex) = buildChunks(
79-
context, episodeList, widget.mediaData.userProgress.toString());
80-
81-
var selectedEpisode = episodeList.values.firstWhereOrNull((element) =>
82-
element.number ==
83-
((widget.mediaData.userProgress ?? 0) + 1).toString());
84-
85-
RxInt selectedChunkIndex = (-1).obs;
86-
87-
selectedChunkIndex =
88-
selectedChunkIndex.value == -1 ? initChunkIndex : selectedChunkIndex;
89-
return Column(
90-
mainAxisSize: MainAxisSize.min,
91-
crossAxisAlignment: CrossAxisAlignment.start,
92-
children: [
93-
_buildTitle(),
94-
ContinueCard(
95-
mediaData: widget.mediaData,
96-
episode: selectedEpisode,
97-
source: _viewModel.source.value!,
98-
),
99-
ChunkSelector(
100-
context,
101-
chunks,
102-
selectedChunkIndex,
103-
_viewModel.reversed,
104-
),
105-
Container(
106-
margin: const EdgeInsets.symmetric(horizontal: 18),
107-
child: Obx(() {
108-
var reversed = _viewModel.reversed.value
109-
? chunks.map((element) => element.reversed.toList()).toList()
110-
: chunks;
111-
return EpisodeAdaptor(
112-
type: _viewModel.viewType.value,
113-
source: _viewModel.source.value!,
114-
episodeList: reversed[selectedChunkIndex.value],
115-
mediaData: widget.mediaData,
49+
return Column(
50+
mainAxisSize: MainAxisSize.min,
51+
crossAxisAlignment: CrossAxisAlignment.start,
52+
children: [
53+
_buildTitle(),
54+
Obx(
55+
() {
56+
var episodeList = _viewModel.episodeList.value;
57+
if (episodeList == null) {
58+
return const Center(child: CircularProgressIndicator());
59+
}
60+
61+
if (!_viewModel.episodeDataLoaded.value) {
62+
return const Center(child: CircularProgressIndicator());
63+
}
64+
if (episodeList.isEmpty) {
65+
return Column(
66+
children: [
67+
Center(
68+
child: Text(
69+
_viewModel.errorType.value == ErrorType.NotFound
70+
? 'Media not found'
71+
: 'No episodes found',
72+
style: TextStyle(
73+
color: Theme.of(context).colorScheme.onSurface,
74+
fontWeight: FontWeight.bold,
75+
),
76+
),
77+
),
78+
],
11679
);
117-
}),
118-
)
119-
],
120-
);
121-
});
80+
}
81+
updateEpisodeDetails(episodeList);
82+
83+
var (chunks, initChunkIndex) = buildChunks(
84+
context, episodeList, widget.mediaData.userProgress.toString());
85+
86+
var selectedEpisode = episodeList.values.firstWhereOrNull(
87+
(element) =>
88+
element.number ==
89+
((widget.mediaData.userProgress ?? 0) + 1).toString());
90+
91+
RxInt selectedChunkIndex = (-1).obs;
92+
93+
selectedChunkIndex = selectedChunkIndex.value == -1
94+
? initChunkIndex
95+
: selectedChunkIndex;
96+
return Column(
97+
mainAxisSize: MainAxisSize.min,
98+
crossAxisAlignment: CrossAxisAlignment.start,
99+
children: [
100+
ContinueCard(
101+
mediaData: widget.mediaData,
102+
episode: selectedEpisode,
103+
source: _viewModel.source.value!,
104+
),
105+
ChunkSelector(
106+
context,
107+
chunks,
108+
selectedChunkIndex,
109+
_viewModel.reversed,
110+
),
111+
Container(
112+
margin: const EdgeInsets.symmetric(horizontal: 18),
113+
child: Obx(() {
114+
var reversed = _viewModel.reversed.value
115+
? chunks
116+
.map((element) => element.reversed.toList())
117+
.toList()
118+
: chunks;
119+
return EpisodeAdaptor(
120+
type: _viewModel.viewType.value,
121+
source: _viewModel.source.value!,
122+
episodeList: reversed[selectedChunkIndex.value],
123+
mediaData: widget.mediaData,
124+
);
125+
}),
126+
)
127+
],
128+
);
129+
},
130+
),
131+
],
132+
);
122133
}
123134

124135
Widget _buildTitle() {

lib/Screens/Detail/Tabs/Watch/Manga/MangaParser.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:dartotsu/logger.dart';
12
import 'package:flutter/cupertino.dart';
23
import 'package:get/get_rx/src/rx_types/rx_types.dart';
34

@@ -95,9 +96,9 @@ class MangaParser extends BaseParser {
9596

9697
MManga? m;
9798
try {
98-
m = await getDetail(url: media.link!, source: source)
99-
.timeout(Duration(seconds: 5));
99+
m = await getDetail(url: media.link!, source: source);
100100
} catch (e) {
101+
Logger.log(e.toString());
101102
errorType.value = ErrorType.NoResult;
102103
m = null;
103104
return;

lib/Screens/Detail/Tabs/Watch/Manga/MangaWatchScreen.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class MangaWatchScreenState extends BaseWatchScreen<MangaWatchScreen> {
5656
if (chapterList.isEmpty) {
5757
return Column(
5858
children: [
59-
_buildTitle(),
6059
Center(
6160
child: Text(
6261
_viewModel.errorType.value == ErrorType.NotFound

0 commit comments

Comments
 (0)