mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
refactor: Simplify subtitle rendering logic with early return
This commit is contained in:
parent
ee824f5f16
commit
d60522b021
2 changed files with 4 additions and 9 deletions
|
|
@ -289,7 +289,7 @@ class _DesktopControlsState extends ConsumerState<DesktopControls> {
|
|||
}
|
||||
|
||||
Widget bottomButtons(BuildContext context) {
|
||||
return Container(child: Consumer(builder: (context, ref, child) {
|
||||
return Consumer(builder: (context, ref, child) {
|
||||
final mediaPlayback = ref.watch(mediaPlaybackProvider);
|
||||
final bitRateOptions = ref.watch(playBackModel.select((value) => value?.bitRateOptions));
|
||||
return Container(
|
||||
|
|
@ -430,7 +430,7 @@ class _DesktopControlsState extends ConsumerState<DesktopControls> {
|
|||
),
|
||||
),
|
||||
);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
Widget progressBar(MediaPlaybackModel mediaPlayback) {
|
||||
|
|
|
|||
|
|
@ -260,13 +260,8 @@ class _VideoSubtitlesState extends ConsumerState<_VideoSubtitles> {
|
|||
// Process subtitle text
|
||||
final text = subtitle.where((line) => line.trim().isNotEmpty).map((line) => line.trim()).join('\n');
|
||||
|
||||
// Return empty widget if libass is enabled (native subtitle rendering)
|
||||
if (widget.controller.player.platform?.configuration.libass ?? false) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
// Return empty widget if no subtitle text
|
||||
if (text.isEmpty) {
|
||||
// Early return for cases where subtitles shouldn't be rendered
|
||||
if ((widget.controller.player.platform?.configuration.libass ?? false) || text.isEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue