video: open settings action
This commit is contained in:
parent
48d90e071f
commit
a7b0ac8bb2
7 changed files with 110 additions and 39 deletions
|
@ -107,6 +107,8 @@
|
||||||
"@videoActionSelectStreams": {},
|
"@videoActionSelectStreams": {},
|
||||||
"videoActionSetSpeed": "Playback speed",
|
"videoActionSetSpeed": "Playback speed",
|
||||||
"@videoActionSetSpeed": {},
|
"@videoActionSetSpeed": {},
|
||||||
|
"videoActionSettings": "Settings",
|
||||||
|
"@videoActionSettings": {},
|
||||||
|
|
||||||
"filterFavouriteLabel": "Favourite",
|
"filterFavouriteLabel": "Favourite",
|
||||||
"@filterFavouriteLabel": {},
|
"@filterFavouriteLabel": {},
|
||||||
|
@ -582,6 +584,8 @@
|
||||||
"settingsViewerQuickActionEmpty": "No buttons",
|
"settingsViewerQuickActionEmpty": "No buttons",
|
||||||
"@settingsViewerQuickActionEmpty": {},
|
"@settingsViewerQuickActionEmpty": {},
|
||||||
|
|
||||||
|
"settingsVideoPageTitle": "Video Settings",
|
||||||
|
"@settingsVideoPageTitle": {},
|
||||||
"settingsSectionVideo": "Video",
|
"settingsSectionVideo": "Video",
|
||||||
"@settingsSectionVideo": {},
|
"@settingsSectionVideo": {},
|
||||||
"settingsVideoShowVideos": "Show videos",
|
"settingsVideoShowVideos": "Show videos",
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
"videoActionSkip10": "10초 앞으로 탐색",
|
"videoActionSkip10": "10초 앞으로 탐색",
|
||||||
"videoActionSelectStreams": "트랙 선택",
|
"videoActionSelectStreams": "트랙 선택",
|
||||||
"videoActionSetSpeed": "재생 배속",
|
"videoActionSetSpeed": "재생 배속",
|
||||||
|
"videoActionSettings": "설정",
|
||||||
|
|
||||||
"filterFavouriteLabel": "즐겨찾기",
|
"filterFavouriteLabel": "즐겨찾기",
|
||||||
"filterLocationEmptyLabel": "장소 없음",
|
"filterLocationEmptyLabel": "장소 없음",
|
||||||
|
@ -274,6 +275,7 @@
|
||||||
"settingsViewerQuickActionEditorAvailableButtons": "추가 가능한 버튼",
|
"settingsViewerQuickActionEditorAvailableButtons": "추가 가능한 버튼",
|
||||||
"settingsViewerQuickActionEmpty": "버튼이 없습니다",
|
"settingsViewerQuickActionEmpty": "버튼이 없습니다",
|
||||||
|
|
||||||
|
"settingsVideoPageTitle": "동영상 설정",
|
||||||
"settingsSectionVideo": "동영상",
|
"settingsSectionVideo": "동영상",
|
||||||
"settingsVideoShowVideos": "미디어에 동영상 표시",
|
"settingsVideoShowVideos": "미디어에 동영상 표시",
|
||||||
"settingsVideoEnableHardwareAcceleration": "하드웨어 가속",
|
"settingsVideoEnableHardwareAcceleration": "하드웨어 가속",
|
||||||
|
|
|
@ -8,6 +8,7 @@ enum VideoAction {
|
||||||
skip10,
|
skip10,
|
||||||
selectStreams,
|
selectStreams,
|
||||||
setSpeed,
|
setSpeed,
|
||||||
|
settings,
|
||||||
togglePlay,
|
togglePlay,
|
||||||
// TODO TLAD [video] toggle mute
|
// TODO TLAD [video] toggle mute
|
||||||
}
|
}
|
||||||
|
@ -20,6 +21,7 @@ class VideoActions {
|
||||||
VideoAction.selectStreams,
|
VideoAction.selectStreams,
|
||||||
VideoAction.replay10,
|
VideoAction.replay10,
|
||||||
VideoAction.skip10,
|
VideoAction.skip10,
|
||||||
|
VideoAction.settings,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +38,8 @@ extension ExtraVideoAction on VideoAction {
|
||||||
return context.l10n.videoActionSelectStreams;
|
return context.l10n.videoActionSelectStreams;
|
||||||
case VideoAction.setSpeed:
|
case VideoAction.setSpeed:
|
||||||
return context.l10n.videoActionSetSpeed;
|
return context.l10n.videoActionSetSpeed;
|
||||||
|
case VideoAction.settings:
|
||||||
|
return context.l10n.videoActionSettings;
|
||||||
case VideoAction.togglePlay:
|
case VideoAction.togglePlay:
|
||||||
// different data depending on toggle state
|
// different data depending on toggle state
|
||||||
return context.l10n.videoActionPlay;
|
return context.l10n.videoActionPlay;
|
||||||
|
@ -54,6 +58,8 @@ extension ExtraVideoAction on VideoAction {
|
||||||
return AIcons.streams;
|
return AIcons.streams;
|
||||||
case VideoAction.setSpeed:
|
case VideoAction.setSpeed:
|
||||||
return AIcons.speed;
|
return AIcons.speed;
|
||||||
|
case VideoAction.settings:
|
||||||
|
return AIcons.videoSettings;
|
||||||
case VideoAction.togglePlay:
|
case VideoAction.togglePlay:
|
||||||
// different data depending on toggle state
|
// different data depending on toggle state
|
||||||
return AIcons.play;
|
return AIcons.play;
|
||||||
|
|
|
@ -68,6 +68,7 @@ class AIcons {
|
||||||
static const IconData streamVideo = Icons.movie_outlined;
|
static const IconData streamVideo = Icons.movie_outlined;
|
||||||
static const IconData streamAudio = Icons.audiotrack_outlined;
|
static const IconData streamAudio = Icons.audiotrack_outlined;
|
||||||
static const IconData streamText = Icons.closed_caption_outlined;
|
static const IconData streamText = Icons.closed_caption_outlined;
|
||||||
|
static const IconData videoSettings = Icons.video_settings_outlined;
|
||||||
static const IconData zoomIn = Icons.add_outlined;
|
static const IconData zoomIn = Icons.add_outlined;
|
||||||
static const IconData zoomOut = Icons.remove_outlined;
|
static const IconData zoomOut = Icons.remove_outlined;
|
||||||
static const IconData collapse = Icons.expand_less_outlined;
|
static const IconData collapse = Icons.expand_less_outlined;
|
||||||
|
|
|
@ -7,6 +7,7 @@ import 'package:aves/theme/icons.dart';
|
||||||
import 'package:aves/utils/color_utils.dart';
|
import 'package:aves/utils/color_utils.dart';
|
||||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||||
import 'package:aves/widgets/common/identity/aves_expansion_tile.dart';
|
import 'package:aves/widgets/common/identity/aves_expansion_tile.dart';
|
||||||
|
import 'package:aves/widgets/common/providers/media_query_data_provider.dart';
|
||||||
import 'package:aves/widgets/dialogs/aves_selection_dialog.dart';
|
import 'package:aves/widgets/dialogs/aves_selection_dialog.dart';
|
||||||
import 'package:aves/widgets/settings/common/tile_leading.dart';
|
import 'package:aves/widgets/settings/common/tile_leading.dart';
|
||||||
import 'package:aves/widgets/settings/video/subtitle_theme.dart';
|
import 'package:aves/widgets/settings/video/subtitle_theme.dart';
|
||||||
|
@ -15,11 +16,13 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class VideoSection extends StatelessWidget {
|
class VideoSection extends StatelessWidget {
|
||||||
final ValueNotifier<String?> expandedNotifier;
|
final ValueNotifier<String?>? expandedNotifier;
|
||||||
|
final bool standalonePage;
|
||||||
|
|
||||||
const VideoSection({
|
const VideoSection({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.expandedNotifier,
|
this.expandedNotifier,
|
||||||
|
this.standalonePage = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -29,15 +32,8 @@ class VideoSection extends StatelessWidget {
|
||||||
final currentEnableVideoAutoPlay = context.select<Settings, bool>((s) => s.enableVideoAutoPlay);
|
final currentEnableVideoAutoPlay = context.select<Settings, bool>((s) => s.enableVideoAutoPlay);
|
||||||
final currentVideoLoopMode = context.select<Settings, VideoLoopMode>((s) => s.videoLoopMode);
|
final currentVideoLoopMode = context.select<Settings, VideoLoopMode>((s) => s.videoLoopMode);
|
||||||
|
|
||||||
return AvesExpansionTile(
|
final children = [
|
||||||
leading: SettingsTileLeading(
|
if (!standalonePage)
|
||||||
icon: AIcons.video,
|
|
||||||
color: stringToColor('Video'),
|
|
||||||
),
|
|
||||||
title: context.l10n.settingsSectionVideo,
|
|
||||||
expandedNotifier: expandedNotifier,
|
|
||||||
showHighlight: false,
|
|
||||||
children: [
|
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
value: currentShowVideos,
|
value: currentShowVideos,
|
||||||
onChanged: (v) => context.read<CollectionSource>().changeFilterVisibility(MimeFilter.video, v),
|
onChanged: (v) => context.read<CollectionSource>().changeFilterVisibility(MimeFilter.video, v),
|
||||||
|
@ -72,7 +68,52 @@ class VideoSection extends StatelessWidget {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SubtitleThemeTile(),
|
SubtitleThemeTile(),
|
||||||
],
|
];
|
||||||
|
|
||||||
|
return standalonePage
|
||||||
|
? ListView(
|
||||||
|
children: children,
|
||||||
|
)
|
||||||
|
: AvesExpansionTile(
|
||||||
|
leading: SettingsTileLeading(
|
||||||
|
icon: AIcons.video,
|
||||||
|
color: stringToColor('Video'),
|
||||||
|
),
|
||||||
|
title: context.l10n.settingsSectionVideo,
|
||||||
|
expandedNotifier: expandedNotifier,
|
||||||
|
showHighlight: false,
|
||||||
|
children: children,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class VideoSettingsPage extends StatelessWidget {
|
||||||
|
static const routeName = '/settings/video';
|
||||||
|
|
||||||
|
const VideoSettingsPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final theme = Theme.of(context);
|
||||||
|
return MediaQueryDataProvider(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(context.l10n.settingsVideoPageTitle),
|
||||||
|
),
|
||||||
|
body: Theme(
|
||||||
|
data: theme.copyWith(
|
||||||
|
textTheme: theme.textTheme.copyWith(
|
||||||
|
// dense style font for tile subtitles, without modifying title font
|
||||||
|
bodyText2: const TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: const SafeArea(
|
||||||
|
child: VideoSection(
|
||||||
|
standalonePage: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,6 +269,7 @@ class _ButtonRow extends StatelessWidget {
|
||||||
break;
|
break;
|
||||||
case VideoAction.replay10:
|
case VideoAction.replay10:
|
||||||
case VideoAction.skip10:
|
case VideoAction.skip10:
|
||||||
|
case VideoAction.settings:
|
||||||
child = IconButton(
|
child = IconButton(
|
||||||
icon: Icon(action.getIcon()),
|
icon: Icon(action.getIcon()),
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
|
@ -299,6 +300,7 @@ class _ButtonRow extends StatelessWidget {
|
||||||
break;
|
break;
|
||||||
case VideoAction.replay10:
|
case VideoAction.replay10:
|
||||||
case VideoAction.skip10:
|
case VideoAction.skip10:
|
||||||
|
case VideoAction.settings:
|
||||||
case VideoAction.togglePlay:
|
case VideoAction.togglePlay:
|
||||||
enabled = true;
|
enabled = true;
|
||||||
break;
|
break;
|
||||||
|
@ -317,6 +319,7 @@ class _ButtonRow extends StatelessWidget {
|
||||||
case VideoAction.skip10:
|
case VideoAction.skip10:
|
||||||
case VideoAction.selectStreams:
|
case VideoAction.selectStreams:
|
||||||
case VideoAction.setSpeed:
|
case VideoAction.setSpeed:
|
||||||
|
case VideoAction.settings:
|
||||||
child = MenuRow(text: action.getText(context), icon: action.getIcon());
|
child = MenuRow(text: action.getText(context), icon: action.getIcon());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import 'package:aves/widgets/common/action_mixins/size_aware.dart';
|
||||||
import 'package:aves/widgets/common/extensions/build_context.dart';
|
import 'package:aves/widgets/common/extensions/build_context.dart';
|
||||||
import 'package:aves/widgets/dialogs/video_speed_dialog.dart';
|
import 'package:aves/widgets/dialogs/video_speed_dialog.dart';
|
||||||
import 'package:aves/widgets/dialogs/video_stream_selection_dialog.dart';
|
import 'package:aves/widgets/dialogs/video_stream_selection_dialog.dart';
|
||||||
|
import 'package:aves/widgets/settings/video/video.dart';
|
||||||
import 'package:aves/widgets/viewer/video/controller.dart';
|
import 'package:aves/widgets/viewer/video/controller.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -44,6 +45,9 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
|
||||||
case VideoAction.setSpeed:
|
case VideoAction.setSpeed:
|
||||||
_showSpeedDialog(context, controller);
|
_showSpeedDialog(context, controller);
|
||||||
break;
|
break;
|
||||||
|
case VideoAction.settings:
|
||||||
|
_showSettings(context);
|
||||||
|
break;
|
||||||
case VideoAction.togglePlay:
|
case VideoAction.togglePlay:
|
||||||
_togglePlayPause(context, controller);
|
_togglePlayPause(context, controller);
|
||||||
break;
|
break;
|
||||||
|
@ -155,6 +159,16 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
|
||||||
controller.speed = newSpeed;
|
controller.speed = newSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showSettings(BuildContext context) {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
settings: const RouteSettings(name: VideoSettingsPage.routeName),
|
||||||
|
builder: (context) => const VideoSettingsPage(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _togglePlayPause(BuildContext context, AvesVideoController controller) async {
|
Future<void> _togglePlayPause(BuildContext context, AvesVideoController controller) async {
|
||||||
if (controller.isPlaying) {
|
if (controller.isPlaying) {
|
||||||
await controller.pause();
|
await controller.pause();
|
||||||
|
|
Loading…
Reference in a new issue