mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-01-11 22:40:36 +00:00
Merge pull request #469 from NBA2K1/main
Fix inspector/crash issues & improve UX in extension, player, and UI
This commit is contained in:
commit
714ee50b1c
5 changed files with 37 additions and 15 deletions
|
|
@ -176,8 +176,8 @@ class DartExtensionService implements ExtensionService {
|
|||
|
||||
@override
|
||||
List<SourcePreference> getSourcePreferences() {
|
||||
final interpreter = _executeLib();
|
||||
try {
|
||||
final interpreter = _executeLib();
|
||||
final result = interpreter.invoke('getSourcePreferences', []);
|
||||
return (result as List).cast();
|
||||
} catch (_) {
|
||||
|
|
|
|||
|
|
@ -266,13 +266,19 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage>
|
|||
_currentTotalDuration.value = duration;
|
||||
});
|
||||
|
||||
bool get hasNextEpisode => _streamController.getEpisodeIndex().$1 != 0;
|
||||
|
||||
late final StreamSubscription<bool> _completed = _player.stream.completed
|
||||
.listen((val) {
|
||||
if (_streamController.getEpisodeIndex().$1 != 0 && val == true) {
|
||||
if (hasNextEpisode && val) {
|
||||
if (mounted) {
|
||||
pushToNewEpisode(context, _streamController.getNextEpisode());
|
||||
}
|
||||
}
|
||||
// If the last episode of an Anime has ended, exit fullscreen mode
|
||||
if (!hasNextEpisode && val && _isDesktop && !_enterFullScreen.value) {
|
||||
setFullScreen(value: false);
|
||||
}
|
||||
});
|
||||
|
||||
void pushToNewEpisode(BuildContext context, Chapter episode) {
|
||||
|
|
@ -839,7 +845,6 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage>
|
|||
_streamController.getEpisodesLength(
|
||||
_streamController.getEpisodeIndex().$2,
|
||||
);
|
||||
bool hasNextEpisode = _streamController.getEpisodeIndex().$1 != 0;
|
||||
final skipDuration = ref.watch(defaultDoubleTapToSkipLengthStateProvider);
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ Widget _textEditing(
|
|||
return Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: TextFormField(
|
||||
keyboardType: TextInputType.number,
|
||||
keyboardType: label == "Page" ? TextInputType.number : TextInputType.text,
|
||||
onChanged: onChanged,
|
||||
decoration: InputDecoration(
|
||||
hintText: hintText,
|
||||
|
|
|
|||
|
|
@ -77,7 +77,10 @@ class AboutScreen extends ConsumerWidget {
|
|||
),
|
||||
);
|
||||
},
|
||||
icon: const Icon(FontAwesomeIcons.github),
|
||||
icon: const Padding(
|
||||
padding: EdgeInsets.only(left: 2.5, right: 2.5),
|
||||
child: Icon(FontAwesomeIcons.github),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
|
|
@ -87,7 +90,10 @@ class AboutScreen extends ConsumerWidget {
|
|||
),
|
||||
);
|
||||
},
|
||||
icon: const Icon(FontAwesomeIcons.discord),
|
||||
icon: const Padding(
|
||||
padding: EdgeInsets.only(right: 5),
|
||||
child: Icon(FontAwesomeIcons.discord),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -68,21 +68,32 @@ GoRouter router(Ref ref) {
|
|||
|
||||
@riverpod
|
||||
class RouterCurrentLocationState extends _$RouterCurrentLocationState {
|
||||
bool _didSubscribe = false;
|
||||
@override
|
||||
String? build(BuildContext context) {
|
||||
_listener();
|
||||
// Delay listener‐registration until after the first frame.
|
||||
if (!_didSubscribe) {
|
||||
_didSubscribe = true;
|
||||
// Schedule the registration to run after the first build/frame:
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_listener();
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
_listener() {
|
||||
final router = GoRouter.of(context);
|
||||
void _listener() {
|
||||
final router = ref.read(routerProvider);
|
||||
router.routerDelegate.addListener(() {
|
||||
final RouteMatch lastMatch =
|
||||
router.routerDelegate.currentConfiguration.last;
|
||||
final RouteMatchList matchList = lastMatch is ImperativeRouteMatch
|
||||
? lastMatch.matches
|
||||
: router.routerDelegate.currentConfiguration;
|
||||
state = matchList.uri.toString();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
final RouteMatchList matches =
|
||||
router.routerDelegate.currentConfiguration;
|
||||
final RouteMatch lastMatch = matches.last;
|
||||
final RouteMatchList matchList = lastMatch is ImperativeRouteMatch
|
||||
? lastMatch.matches
|
||||
: matches;
|
||||
state = matchList.uri.toString();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue