mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-20 23:22:07 +00:00
-
This commit is contained in:
parent
f01de2c209
commit
ddc979ab75
11 changed files with 73 additions and 80 deletions
|
|
@ -170,12 +170,6 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
|
|||
_player.stream.position.listen(
|
||||
(position) async {
|
||||
if (_seekToCurrentPosition && _currentPosition.value != Duration.zero) {
|
||||
await _player.stream.buffer.first;
|
||||
_player.seek(_currentPosition.value);
|
||||
_isCompleted.value = _player.state.duration.inSeconds -
|
||||
_currentPosition.value.inSeconds <=
|
||||
10;
|
||||
_seekToCurrentPosition = false;
|
||||
} else {
|
||||
_currentPosition.value = position;
|
||||
}
|
||||
|
|
@ -204,6 +198,7 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
|
|||
final ValueNotifier<bool> _showAniSkipEndingButton = ValueNotifier(false);
|
||||
@override
|
||||
void initState() {
|
||||
_initToCurrentPosition();
|
||||
_setCurrentPosition(true);
|
||||
_currentPositionSub;
|
||||
_currentTotalDurationSub;
|
||||
|
|
@ -214,6 +209,20 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage> {
|
|||
super.initState();
|
||||
}
|
||||
|
||||
void _initToCurrentPosition() async {
|
||||
try {
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
await _player.stream.buffer.first;
|
||||
if (_seekToCurrentPosition && _currentPosition.value != Duration.zero) {
|
||||
_player.seek(_currentPosition.value);
|
||||
_isCompleted.value = _player.state.duration.inSeconds -
|
||||
_currentPosition.value.inSeconds <=
|
||||
10;
|
||||
_seekToCurrentPosition = false;
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
void _initAniSkip() async {
|
||||
await _player.stream.buffer.first;
|
||||
_streamController.getAniSkipResults((result) {
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ class _HistoryTabState extends ConsumerState<HistoryTab> {
|
|||
manga.imageUrl!),
|
||||
width: 60,
|
||||
height: 90,
|
||||
fit: BoxFit.cover),
|
||||
fit: BoxFit.fill),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1338,7 +1338,7 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
borderRadius: const BorderRadius.all(Radius.circular(5)),
|
||||
image: DecorationImage(
|
||||
image: imageProvider,
|
||||
fit: BoxFit.cover,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:mangayomi/eval/model/m_bridge.dart';
|
||||
// import 'package:mangayomi/eval/model/m_bridge.dart';
|
||||
import 'package:mangayomi/eval/model/m_chapter.dart';
|
||||
import 'package:mangayomi/eval/model/m_manga.dart';
|
||||
import 'package:mangayomi/main.dart';
|
||||
|
|
@ -22,7 +22,7 @@ Future<dynamic> updateMangaDetail(UpdateMangaDetailRef ref,
|
|||
getManga = await ref
|
||||
.watch(getDetailProvider(url: manga.link!, source: source!).future);
|
||||
} catch (e) {
|
||||
botToast(e.toString());
|
||||
// botToast(e.toString());
|
||||
return;
|
||||
}
|
||||
manga
|
||||
|
|
|
|||
|
|
@ -281,6 +281,7 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
|
|||
_selectedIndex = 2;
|
||||
_isFiltering = true;
|
||||
_page = 1;
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -296,6 +297,7 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
|
|||
_isFiltering = false;
|
||||
_isSearch = false;
|
||||
_page = 1;
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
@ -359,21 +361,19 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
|
|||
}
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(l10n.load_more),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const Icon(
|
||||
Icons.arrow_forward_outlined),
|
||||
const Icon(Icons.arrow_forward_outlined),
|
||||
],
|
||||
)),
|
||||
)
|
||||
: Container();
|
||||
}
|
||||
|
||||
|
||||
if (data!.list.isEmpty) {
|
||||
return Center(child: Text(l10n.no_result));
|
||||
}
|
||||
|
|
@ -400,10 +400,9 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
_length = widget.source.isFullData!
|
||||
? _fullDataLength
|
||||
: _mangaList.length;
|
||||
|
||||
_length =
|
||||
widget.source.isFullData! ? _fullDataLength : _mangaList.length;
|
||||
_length =
|
||||
(_mangaList.length < _length ? _mangaList.length : _length);
|
||||
return Padding(
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class BottomTextWidget extends StatelessWidget {
|
|||
final double? fontSize;
|
||||
final int? maxLines;
|
||||
final Color? textColor;
|
||||
final bool? isTorrent;
|
||||
const BottomTextWidget(
|
||||
{super.key,
|
||||
required this.text,
|
||||
|
|
@ -15,7 +16,8 @@ class BottomTextWidget extends StatelessWidget {
|
|||
this.isComfortableGrid = false,
|
||||
this.fontSize = 12.0,
|
||||
this.maxLines = 2,
|
||||
this.textColor});
|
||||
this.textColor,
|
||||
this.isTorrent = false});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -32,7 +34,7 @@ class BottomTextWidget extends StatelessWidget {
|
|||
fontWeight: FontWeight.w600,
|
||||
color: textColor ?? context.primaryColor,
|
||||
),
|
||||
maxLines: maxLines,
|
||||
maxLines: isTorrent! ? 8 : maxLines,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
|
|
@ -60,7 +62,7 @@ class BottomTextWidget extends StatelessWidget {
|
|||
Shadow(offset: Offset(0.5, 0.9), blurRadius: 3.0)
|
||||
],
|
||||
),
|
||||
maxLines: maxLines,
|
||||
maxLines: isTorrent! ? 8 : maxLines,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
|
|
@ -68,7 +70,7 @@ class BottomTextWidget extends StatelessWidget {
|
|||
],
|
||||
)
|
||||
: Container(
|
||||
height: 70,
|
||||
height: isTorrent! ? 200 : 70,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
gradient: LinearGradient(
|
||||
|
|
@ -97,7 +99,7 @@ class BottomTextWidget extends StatelessWidget {
|
|||
offset: Offset(0.5, 0.9), blurRadius: 3.0)
|
||||
],
|
||||
),
|
||||
maxLines: maxLines,
|
||||
maxLines: isTorrent! ? 8 : maxLines,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class CoverViewWidget extends StatelessWidget {
|
|||
)
|
||||
: Ink.image(
|
||||
height: 200,
|
||||
fit: BoxFit.cover,
|
||||
fit: BoxFit.fill,
|
||||
image: image!,
|
||||
child: Stack(
|
||||
children: children,
|
||||
|
|
|
|||
|
|
@ -77,7 +77,8 @@ class MangaImageCardWidget extends ConsumerWidget {
|
|||
child: Icon(Icons.collections_bookmark,
|
||||
color: context.primaryColor),
|
||||
)),
|
||||
BottomTextWidget(text: getMangaDetail!.name!)
|
||||
BottomTextWidget(
|
||||
isTorrent: source.isTorrent, text: getMangaDetail!.name!)
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
import 'dart:async';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:mangayomi/eval/model/m_pages.dart';
|
||||
import 'package:mangayomi/eval/compiler/compiler.dart';
|
||||
import 'package:mangayomi/eval/model/m_provider.dart';
|
||||
import 'package:mangayomi/models/source.dart';
|
||||
import 'package:mangayomi/eval/runtime/runtime.dart';
|
||||
import 'package:mangayomi/services/isolate.dart';
|
||||
import 'package:mangayomi/sources/source_test.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
part 'get_latest_updates.g.dart';
|
||||
|
|
@ -17,23 +14,20 @@ Future<MPages?> getLatestUpdates(
|
|||
required Source source,
|
||||
required int page,
|
||||
}) async {
|
||||
return await compute<RootIsolateToken, MPages?>((token) async {
|
||||
await initInIsolate(token);
|
||||
MPages? latestUpdatesManga;
|
||||
MPages? latestUpdatesManga;
|
||||
|
||||
try {
|
||||
final bytecode =
|
||||
compilerEval(useTestSourceCode ? testSourceCode : source.sourceCode!);
|
||||
try {
|
||||
final bytecode =
|
||||
compilerEval(useTestSourceCode ? testSourceCode : source.sourceCode!);
|
||||
|
||||
final runtime = runtimeEval(bytecode);
|
||||
final runtime = runtimeEval(bytecode);
|
||||
|
||||
var res = await runtime.executeLib('package:mangayomi/main.dart', 'main');
|
||||
latestUpdatesManga =
|
||||
await (res as MProvider).getLatestUpdates(source.toMSource(), page);
|
||||
} catch (e) {
|
||||
throw Exception(e);
|
||||
}
|
||||
var res = await runtime.executeLib('package:mangayomi/main.dart', 'main');
|
||||
latestUpdatesManga =
|
||||
await (res as MProvider).getLatestUpdates(source.toMSource(), page);
|
||||
} catch (e) {
|
||||
throw Exception(e);
|
||||
}
|
||||
|
||||
return latestUpdatesManga;
|
||||
}, RootIsolateToken.instance!);
|
||||
return latestUpdatesManga;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
import 'dart:async';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:mangayomi/eval/model/m_pages.dart';
|
||||
import 'package:mangayomi/eval/compiler/compiler.dart';
|
||||
import 'package:mangayomi/eval/model/m_provider.dart';
|
||||
import 'package:mangayomi/models/source.dart';
|
||||
import 'package:mangayomi/eval/runtime/runtime.dart';
|
||||
import 'package:mangayomi/services/isolate.dart';
|
||||
import 'package:mangayomi/sources/source_test.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
part 'get_popular.g.dart';
|
||||
|
|
@ -17,23 +14,20 @@ Future<MPages?> getPopular(
|
|||
required Source source,
|
||||
required int page,
|
||||
}) async {
|
||||
return await compute<RootIsolateToken, MPages?>((token) async {
|
||||
await initInIsolate(token);
|
||||
MPages? popularManga;
|
||||
MPages? popularManga;
|
||||
|
||||
try {
|
||||
final bytecode =
|
||||
compilerEval(useTestSourceCode ? testSourceCode : source.sourceCode!);
|
||||
try {
|
||||
final bytecode =
|
||||
compilerEval(useTestSourceCode ? testSourceCode : source.sourceCode!);
|
||||
|
||||
final runtime = runtimeEval(bytecode);
|
||||
final runtime = runtimeEval(bytecode);
|
||||
|
||||
var res = runtime.executeLib('package:mangayomi/main.dart', 'main');
|
||||
popularManga =
|
||||
await (res as MProvider).getPopular(source.toMSource(), page);
|
||||
} catch (e) {
|
||||
throw Exception(e);
|
||||
}
|
||||
var res = runtime.executeLib('package:mangayomi/main.dart', 'main');
|
||||
popularManga =
|
||||
await (res as MProvider).getPopular(source.toMSource(), page);
|
||||
} catch (e) {
|
||||
throw Exception(e);
|
||||
}
|
||||
|
||||
return popularManga;
|
||||
}, RootIsolateToken.instance!);
|
||||
return popularManga;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:mangayomi/eval/model/filter.dart';
|
||||
import 'package:mangayomi/eval/model/m_pages.dart';
|
||||
import 'package:mangayomi/eval/compiler/compiler.dart';
|
||||
import 'package:mangayomi/eval/model/m_provider.dart';
|
||||
import 'package:mangayomi/models/source.dart';
|
||||
import 'package:mangayomi/eval/runtime/runtime.dart';
|
||||
import 'package:mangayomi/services/isolate.dart';
|
||||
import 'package:mangayomi/sources/source_test.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
part 'search.g.dart';
|
||||
|
|
@ -17,19 +14,16 @@ Future<MPages?> search(SearchRef ref,
|
|||
required String query,
|
||||
required int page,
|
||||
required List<dynamic> filterList}) async {
|
||||
return await compute<RootIsolateToken, MPages?>((token) async {
|
||||
await initInIsolate(token);
|
||||
MPages? manga;
|
||||
final bytecode =
|
||||
compilerEval(useTestSourceCode ? testSourceCode : source.sourceCode!);
|
||||
final runtime = runtimeEval(bytecode);
|
||||
var res = runtime.executeLib('package:mangayomi/main.dart', 'main');
|
||||
try {
|
||||
manga = await (res as MProvider)
|
||||
.search(source.toMSource(), query, page, FilterList(filterList));
|
||||
} catch (e) {
|
||||
throw Exception(e);
|
||||
}
|
||||
return manga;
|
||||
}, RootIsolateToken.instance!);
|
||||
MPages? manga;
|
||||
final bytecode =
|
||||
compilerEval(useTestSourceCode ? testSourceCode : source.sourceCode!);
|
||||
final runtime = runtimeEval(bytecode);
|
||||
var res = runtime.executeLib('package:mangayomi/main.dart', 'main');
|
||||
try {
|
||||
manga = await (res as MProvider)
|
||||
.search(source.toMSource(), query, page, FilterList(filterList));
|
||||
} catch (e) {
|
||||
throw Exception(e);
|
||||
}
|
||||
return manga;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue