Skip to content

Conversation

NBA2K1
Copy link
Contributor

@NBA2K1 NBA2K1 commented Jun 27, 2025

✨ Summary

This PR improves the anime player experience by:

  • Making fullscreen mode behavior consistent and predictable.
  • Reducing unnecessary rebuilds and listeners related to AniSkip.
  • Cleaning up redundant logic and nested widget trees.

âś… Changes

đź–Ą Fullscreen Mode

  • Fullscreen is now toggled only when the player starts playback, not during widget init.

 
⏩ AniSkip Logic

  • initAniSkip() only runs when the "Enable AniSkip" setting is true.
  • Skip UI is only built if AniSkip is enabled, reducing widget rebuilds.
  • Combined multiple ValueListenableBuilder widgets into a single one using _AniSkipPhase, reducing visual complexity and improving maintainability.
  • Collapsed multiple position stream listeners into one, centralizing logic for:
    • current position updates
    • AniSkip state
    • subtitle/audio init

 
đź§ą Code Cleanup

  • Removed redundant imports (2 commits).
  • Removed duplicated if conditions (_hasOpeningSkip || _hasEndingSkip).
  • Reorganized stream handling and widget building for better performance and readability.

 
đź§Ş Testing

  • Verified fullscreen toggle behavior across:
    • first-time episode load
    • mid-series episode switching
    • exiting playback
  • Confirmed AniSkip shows/hides appropriately depending on global setting.
  • No regressions in playback, controls, or skip behavior.

NBA2K1 added 14 commits June 26, 2025 19:23
The variables `enableAniSkip`, `enableAutoSkip`,
`aniSkipTimeoutLength` and `skipIntroLength` are global settings.
The user cannot change them inside the video player.
So there's no need to watch them inside the _currentPosition listener.
flatten builders into a single ValueListenableBuilder.
Collapse three `.position.listen` callbacks into a single
subscription to reduce per‑tick overhead and centralize all
position‑driven updates (current position, subtitle/audio init,
and skip‑phase logic) in one handler.
The import of 'package:hive/hive.dart' is unnecessary
because all of the used elements are also provided
by the import of 'package:hive_flutter/adapters.dart'.
Setting a `ValueNotifier` to the same value still triggers its listeners.
Only update `_skipPhase.value`, when it really changs.
- Remove the enableAniSkipStateProvider check, because it is already being checked by the caller (anime_player_view.dart, initState() line 353).

- Change ref.watch() to ref.read() as the user cannot change its value without exiting the video player. ref.watch() is meant to be used within reactive contexts.
@kodjodevf kodjodevf merged commit b4da640 into kodjodevf:main Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants