#1086 video: control buttons
This commit is contained in:
parent
ee6b34ad21
commit
e65f23d248
8 changed files with 29 additions and 19 deletions
|
@ -120,7 +120,8 @@ class AIcons {
|
||||||
static final move = MdiIcons.fileMoveOutline;
|
static final move = MdiIcons.fileMoveOutline;
|
||||||
static const rename = Icons.abc_outlined;
|
static const rename = Icons.abc_outlined;
|
||||||
static const openOutside = Icons.open_in_new_outlined;
|
static const openOutside = Icons.open_in_new_outlined;
|
||||||
static final openVideo = MdiIcons.moviePlayOutline;
|
static final openVideoPlayer = MdiIcons.openInApp;
|
||||||
|
static final openVideoPart = MdiIcons.moviePlayOutline;
|
||||||
static const pin = Icons.push_pin_outlined;
|
static const pin = Icons.push_pin_outlined;
|
||||||
static final unpin = MdiIcons.pinOffOutline;
|
static final unpin = MdiIcons.pinOffOutline;
|
||||||
static const print = Icons.print_outlined;
|
static const print = Icons.print_outlined;
|
||||||
|
|
|
@ -48,7 +48,7 @@ extension ExtraEntryActionView on EntryAction {
|
||||||
// external
|
// external
|
||||||
EntryAction.edit => l10n.entryActionEdit,
|
EntryAction.edit => l10n.entryActionEdit,
|
||||||
EntryAction.open => l10n.entryActionOpen,
|
EntryAction.open => l10n.entryActionOpen,
|
||||||
EntryAction.openVideo => l10n.videoControlsPlayOutside,
|
EntryAction.openVideoPlayer => l10n.videoControlsPlayOutside,
|
||||||
EntryAction.openMap => l10n.entryActionOpenMap,
|
EntryAction.openMap => l10n.entryActionOpenMap,
|
||||||
EntryAction.setAs => l10n.entryActionSetAs,
|
EntryAction.setAs => l10n.entryActionSetAs,
|
||||||
EntryAction.cast => l10n.entryActionCast,
|
EntryAction.cast => l10n.entryActionCast,
|
||||||
|
@ -125,7 +125,8 @@ extension ExtraEntryActionView on EntryAction {
|
||||||
EntryAction.videoShowNextFrame => AIcons.nextFrame,
|
EntryAction.videoShowNextFrame => AIcons.nextFrame,
|
||||||
// external
|
// external
|
||||||
EntryAction.edit => AIcons.edit,
|
EntryAction.edit => AIcons.edit,
|
||||||
EntryAction.open || EntryAction.openVideo => AIcons.openOutside,
|
EntryAction.open => AIcons.openOutside,
|
||||||
|
EntryAction.openVideoPlayer => AIcons.openVideoPlayer,
|
||||||
EntryAction.openMap => AIcons.map,
|
EntryAction.openMap => AIcons.map,
|
||||||
EntryAction.setAs => AIcons.setAs,
|
EntryAction.setAs => AIcons.setAs,
|
||||||
EntryAction.cast => AIcons.cast,
|
EntryAction.cast => AIcons.cast,
|
||||||
|
@ -143,7 +144,7 @@ extension ExtraEntryActionView on EntryAction {
|
||||||
EntryAction.showGeoTiffOnMap => AIcons.map,
|
EntryAction.showGeoTiffOnMap => AIcons.map,
|
||||||
// metadata / motion photo
|
// metadata / motion photo
|
||||||
EntryAction.convertMotionPhotoToStillImage => AIcons.convertToStillImage,
|
EntryAction.convertMotionPhotoToStillImage => AIcons.convertToStillImage,
|
||||||
EntryAction.viewMotionPhotoVideo => AIcons.openVideo,
|
EntryAction.viewMotionPhotoVideo => AIcons.openVideoPart,
|
||||||
// debug
|
// debug
|
||||||
EntryAction.debug => AIcons.debug,
|
EntryAction.debug => AIcons.debug,
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,7 +17,7 @@ class VideoControlButtonsPage extends StatefulWidget {
|
||||||
class _VideoControlButtonsPageState extends State<VideoControlButtonsPage> {
|
class _VideoControlButtonsPageState extends State<VideoControlButtonsPage> {
|
||||||
late final Set<EntryAction> _selectedActions;
|
late final Set<EntryAction> _selectedActions;
|
||||||
|
|
||||||
static const _availableActions = [...EntryActions.videoPlayback, EntryAction.openVideo];
|
static const _availableActions = [...EntryActions.videoPlayback, EntryAction.openVideoPlayer];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
|
@ -104,7 +104,7 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
|
||||||
case EntryAction.videoSkip10:
|
case EntryAction.videoSkip10:
|
||||||
case EntryAction.videoShowPreviousFrame:
|
case EntryAction.videoShowPreviousFrame:
|
||||||
case EntryAction.videoShowNextFrame:
|
case EntryAction.videoShowNextFrame:
|
||||||
case EntryAction.openVideo:
|
case EntryAction.openVideoPlayer:
|
||||||
return targetEntry.isPureVideo;
|
return targetEntry.isPureVideo;
|
||||||
case EntryAction.rotateScreen:
|
case EntryAction.rotateScreen:
|
||||||
return !settings.useTvLayout && settings.isRotationLocked;
|
return !settings.useTvLayout && settings.isRotationLocked;
|
||||||
|
@ -246,7 +246,7 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
|
||||||
case EntryAction.videoSkip10:
|
case EntryAction.videoSkip10:
|
||||||
case EntryAction.videoShowPreviousFrame:
|
case EntryAction.videoShowPreviousFrame:
|
||||||
case EntryAction.videoShowNextFrame:
|
case EntryAction.videoShowNextFrame:
|
||||||
case EntryAction.openVideo:
|
case EntryAction.openVideoPlayer:
|
||||||
final controller = context.read<VideoConductor>().getController(targetEntry);
|
final controller = context.read<VideoConductor>().getController(targetEntry);
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
VideoActionNotification(
|
VideoActionNotification(
|
||||||
|
|
|
@ -79,7 +79,7 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
|
||||||
await controller.skipFrames(-1);
|
await controller.skipFrames(-1);
|
||||||
case EntryAction.videoShowNextFrame:
|
case EntryAction.videoShowNextFrame:
|
||||||
await controller.skipFrames(1);
|
await controller.skipFrames(1);
|
||||||
case EntryAction.openVideo:
|
case EntryAction.openVideoPlayer:
|
||||||
await appService.open(entry.uri, entry.mimeTypeAnySubtype, forceChooser: false).then((success) {
|
await appService.open(entry.uri, entry.mimeTypeAnySubtype, forceChooser: false).then((success) {
|
||||||
if (!success) showNoMatchingAppDialog(context);
|
if (!success) showNoMatchingAppDialog(context);
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,7 +39,7 @@ class VideoControlRow extends StatelessWidget {
|
||||||
final action = actions.first;
|
final action = actions.first;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(left: padding),
|
padding: const EdgeInsets.only(left: padding),
|
||||||
child: _buildOverlayButton(context, action),
|
child: _buildOverlayButton(context, action, const BorderRadius.all(radius)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,13 +49,13 @@ class VideoControlRow extends StatelessWidget {
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
textDirection: ViewerBottomOverlay.actionsDirection,
|
textDirection: ViewerBottomOverlay.actionsDirection,
|
||||||
children: actions.map((action) {
|
children: actions.map((action) {
|
||||||
var borderRadius = const BorderRadius.all(Radius.zero);
|
var borderRadius = BorderRadius.zero;
|
||||||
if (action == actions.first) {
|
if (action == actions.first) {
|
||||||
borderRadius = const BorderRadius.only(topLeft: radius, bottomLeft: radius);
|
borderRadius = const BorderRadius.horizontal(left: radius);
|
||||||
} else if (action == actions.last) {
|
} else if (action == actions.last) {
|
||||||
borderRadius = const BorderRadius.only(topRight: radius, bottomRight: radius);
|
borderRadius = const BorderRadius.horizontal(right: radius);
|
||||||
}
|
}
|
||||||
return _buildOverlayButton(context, action, borderRadius: borderRadius);
|
return _buildOverlayButton(context, action, borderRadius);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -65,9 +65,9 @@ class VideoControlRow extends StatelessWidget {
|
||||||
|
|
||||||
Widget _buildOverlayButton(
|
Widget _buildOverlayButton(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
EntryAction action, {
|
EntryAction action,
|
||||||
BorderRadius? borderRadius,
|
BorderRadius borderRadius,
|
||||||
}) {
|
) {
|
||||||
Widget child;
|
Widget child;
|
||||||
if (action == EntryAction.videoTogglePlay) {
|
if (action == EntryAction.videoTogglePlay) {
|
||||||
child = PlayToggler(
|
child = PlayToggler(
|
||||||
|
@ -75,7 +75,7 @@ class VideoControlRow extends StatelessWidget {
|
||||||
onPressed: () => onActionSelected(action),
|
onPressed: () => onActionSelected(action),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
final enabled = action == EntryAction.openVideo ? !entry.trashed : true;
|
final enabled = action == EntryAction.openVideoPlayer ? !entry.trashed : true;
|
||||||
child = IconButton(
|
child = IconButton(
|
||||||
icon: action.getIcon(),
|
icon: action.getIcon(),
|
||||||
onPressed: enabled ? () => onActionSelected(action) : null,
|
onPressed: enabled ? () => onActionSelected(action) : null,
|
||||||
|
@ -83,6 +83,14 @@ class VideoControlRow extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
child = Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: borderRadius.topLeft.x > 0 ? padding / 3 : 0,
|
||||||
|
right: borderRadius.topRight.x > 0 ? padding / 3 : 0,
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
|
||||||
return OverlayButton(
|
return OverlayButton(
|
||||||
scale: scale,
|
scale: scale,
|
||||||
borderRadius: borderRadius,
|
borderRadius: borderRadius,
|
||||||
|
|
|
@ -47,7 +47,7 @@ class _VideoControlOverlayState extends State<VideoControlOverlay> with SingleTi
|
||||||
final status = controller?.status ?? VideoStatus.idle;
|
final status = controller?.status ?? VideoStatus.idle;
|
||||||
|
|
||||||
if (status == VideoStatus.error) {
|
if (status == VideoStatus.error) {
|
||||||
const action = EntryAction.openVideo;
|
const action = EntryAction.openVideoPlayer;
|
||||||
return Align(
|
return Align(
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: OverlayButton(
|
child: OverlayButton(
|
||||||
|
|
|
@ -33,7 +33,7 @@ enum EntryAction {
|
||||||
// external
|
// external
|
||||||
edit,
|
edit,
|
||||||
open,
|
open,
|
||||||
openVideo,
|
openVideoPlayer,
|
||||||
openMap,
|
openMap,
|
||||||
setAs,
|
setAs,
|
||||||
cast,
|
cast,
|
||||||
|
|
Loading…
Reference in a new issue