mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-09 07:28:14 -07:00
refactor: Improve subtitle positioning logic and remove outdated tests
This commit is contained in:
parent
2884a5fadc
commit
c446210e6a
4 changed files with 15 additions and 137 deletions
|
|
@ -168,13 +168,13 @@ class LibMPV extends BasePlayer {
|
|||
@override
|
||||
Widget? subtitles(
|
||||
bool showOverlay, {
|
||||
double? menuHeight,
|
||||
double? menuHeight, // Passed from video_player_controls.dart which owns the menu UI
|
||||
}) =>
|
||||
_controller != null
|
||||
? _VideoSubtitles(
|
||||
controller: _controller!,
|
||||
showOverlay: showOverlay,
|
||||
menuHeight: menuHeight,
|
||||
menuHeight: menuHeight, // Forward the measured height for accurate positioning
|
||||
)
|
||||
: null;
|
||||
|
||||
|
|
@ -198,12 +198,12 @@ class LibMPV extends BasePlayer {
|
|||
class _VideoSubtitles extends ConsumerStatefulWidget {
|
||||
final VideoController controller;
|
||||
final bool showOverlay;
|
||||
final double? menuHeight;
|
||||
final double? menuHeight; // Accurate measurement from controls, null triggers fallback positioning
|
||||
|
||||
const _VideoSubtitles({
|
||||
required this.controller,
|
||||
this.showOverlay = false,
|
||||
this.menuHeight,
|
||||
this.menuHeight, // Receives pre-measured height rather than measuring internally
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -257,7 +257,7 @@ class _VideoSubtitlesState extends ConsumerState<_VideoSubtitles> {
|
|||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
// Use the utility for offset calculation
|
||||
// Use the utility for offset calculation with passed menuHeight
|
||||
final offset = SubtitlePositionCalculator.calculateOffset(
|
||||
settings: settings,
|
||||
showOverlay: widget.showOverlay,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue