mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-09 07:28:14 -07:00
fix: Subtitle editor screens
This commit is contained in:
parent
0f4f829718
commit
ffac89899c
4 changed files with 36 additions and 25 deletions
|
|
@ -249,6 +249,21 @@ class _PlayerSettingsPageState extends ConsumerState<PlayerSettingsPage> {
|
||||||
onChanged: (value) => provider.setUseLibass(value),
|
onChanged: (value) => provider.setUseLibass(value),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (!videoSettings.useLibass)
|
||||||
|
SettingsListTile(
|
||||||
|
label: Text(context.localized.settingsPlayerCustomSubtitlesTitle),
|
||||||
|
subLabel: Text(context.localized.settingsPlayerCustomSubtitlesDesc),
|
||||||
|
onTap: videoSettings.useLibass
|
||||||
|
? null
|
||||||
|
: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: true,
|
||||||
|
useSafeArea: false,
|
||||||
|
builder: (context) => const SubtitleEditor(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
AnimatedFadeSize(
|
AnimatedFadeSize(
|
||||||
child: videoSettings.useLibass && videoSettings.hardwareAccel && Platform.isAndroid
|
child: videoSettings.useLibass && videoSettings.hardwareAccel && Platform.isAndroid
|
||||||
? SettingsMessageBox(
|
? SettingsMessageBox(
|
||||||
|
|
@ -272,20 +287,6 @@ class _PlayerSettingsPageState extends ConsumerState<PlayerSettingsPage> {
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
SettingsListTile(
|
|
||||||
label: Text(context.localized.settingsPlayerCustomSubtitlesTitle),
|
|
||||||
subLabel: Text(context.localized.settingsPlayerCustomSubtitlesDesc),
|
|
||||||
onTap: videoSettings.useLibass
|
|
||||||
? null
|
|
||||||
: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
barrierDismissible: false,
|
|
||||||
useSafeArea: false,
|
|
||||||
builder: (context) => const SubtitleEditor(),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
_ => SettingsMessageBox(
|
_ => SettingsMessageBox(
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,7 @@ import 'package:fladder/models/settings/subtitle_settings_model.dart';
|
||||||
import 'package:fladder/providers/settings/subtitle_settings_provider.dart';
|
import 'package:fladder/providers/settings/subtitle_settings_provider.dart';
|
||||||
import 'package:fladder/providers/settings/video_player_settings_provider.dart';
|
import 'package:fladder/providers/settings/video_player_settings_provider.dart';
|
||||||
import 'package:fladder/screens/video_player/components/video_subtitle_controls.dart';
|
import 'package:fladder/screens/video_player/components/video_subtitle_controls.dart';
|
||||||
import 'package:fladder/util/adaptive_layout/adaptive_layout.dart';
|
|
||||||
import 'package:fladder/util/localization_helper.dart';
|
import 'package:fladder/util/localization_helper.dart';
|
||||||
import 'package:fladder/widgets/navigation_scaffold/components/fladder_app_bar.dart';
|
|
||||||
|
|
||||||
class SubtitleEditor extends ConsumerStatefulWidget {
|
class SubtitleEditor extends ConsumerStatefulWidget {
|
||||||
const SubtitleEditor({super.key});
|
const SubtitleEditor({super.key});
|
||||||
|
|
@ -27,8 +25,9 @@ class _SubtitleEditorState extends ConsumerState<SubtitleEditor> {
|
||||||
final fakeText = context.localized.subtitleConfiguratorPlaceHolder;
|
final fakeText = context.localized.subtitleConfiguratorPlaceHolder;
|
||||||
double lastScale = 0.0;
|
double lastScale = 0.0;
|
||||||
|
|
||||||
return Scaffold(
|
return Padding(
|
||||||
body: Dialog.fullscreen(
|
padding: EdgeInsets.only(top: MediaQuery.paddingOf(context).top),
|
||||||
|
child: Dialog.fullscreen(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onScaleUpdate: (details) {
|
onScaleUpdate: (details) {
|
||||||
lastScale = details.scale;
|
lastScale = details.scale;
|
||||||
|
|
@ -73,7 +72,6 @@ class _SubtitleEditorState extends ConsumerState<SubtitleEditor> {
|
||||||
padding: MediaQuery.paddingOf(context),
|
padding: MediaQuery.paddingOf(context),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
if (AdaptiveLayout.of(context).isDesktop) const FladderAppBar(),
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
const BackButton(),
|
const BackButton(),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:iconsax_plus/iconsax_plus.dart';
|
||||||
|
|
||||||
import 'package:fladder/providers/settings/subtitle_settings_provider.dart';
|
import 'package:fladder/providers/settings/subtitle_settings_provider.dart';
|
||||||
import 'package:fladder/screens/shared/flat_button.dart';
|
import 'package:fladder/screens/shared/flat_button.dart';
|
||||||
|
|
@ -60,7 +62,8 @@ class _VideoSubtitleControlsState extends ConsumerState<VideoSubtitleControls> {
|
||||||
duration: const Duration(milliseconds: 250),
|
duration: const Duration(milliseconds: 250),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
color: controlsHidden ? DialogTheme.of(context).backgroundColor?.withValues(alpha: 0.75) : Colors.transparent,
|
color:
|
||||||
|
controlsHidden ? Theme.of(context).colorScheme.surfaceContainer.withValues(alpha: 0.8) : Colors.transparent,
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
|
|
@ -68,10 +71,19 @@ class _VideoSubtitleControlsState extends ConsumerState<VideoSubtitleControls> {
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
if (widget.label?.isNotEmpty == true)
|
if (widget.label?.isNotEmpty == true)
|
||||||
Text(
|
Row(
|
||||||
widget.label!,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
style: Theme.of(context).textTheme.headlineMedium,
|
children: [
|
||||||
),
|
Text(
|
||||||
|
widget.label!,
|
||||||
|
style: Theme.of(context).textTheme.headlineMedium,
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => context.maybePop(),
|
||||||
|
icon: const Icon(IconsaxPlusBold.close_circle),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
).addVisiblity(activeKey == null ? controlsHidden : activeKey == const Key('title')),
|
||||||
IconButton.filledTonal(
|
IconButton.filledTonal(
|
||||||
isSelected: !hideControls,
|
isSelected: !hideControls,
|
||||||
onPressed: () => setState(() => hideControls = !hideControls),
|
onPressed: () => setState(() => hideControls = !hideControls),
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,6 @@ extension WidgetExtensions on Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget addVisiblity(bool visible) {
|
Widget addVisiblity(bool visible) {
|
||||||
return AnimatedOpacity(duration: const Duration(milliseconds: 250), opacity: visible ? 1 : 0, child: this);
|
return AnimatedOpacity(duration: const Duration(milliseconds: 250), opacity: visible ? 1 : 0.10, child: this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue