#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 const rename = Icons.abc_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 final unpin = MdiIcons.pinOffOutline;
|
||||
static const print = Icons.print_outlined;
|
||||
|
|
|
@ -48,7 +48,7 @@ extension ExtraEntryActionView on EntryAction {
|
|||
// external
|
||||
EntryAction.edit => l10n.entryActionEdit,
|
||||
EntryAction.open => l10n.entryActionOpen,
|
||||
EntryAction.openVideo => l10n.videoControlsPlayOutside,
|
||||
EntryAction.openVideoPlayer => l10n.videoControlsPlayOutside,
|
||||
EntryAction.openMap => l10n.entryActionOpenMap,
|
||||
EntryAction.setAs => l10n.entryActionSetAs,
|
||||
EntryAction.cast => l10n.entryActionCast,
|
||||
|
@ -125,7 +125,8 @@ extension ExtraEntryActionView on EntryAction {
|
|||
EntryAction.videoShowNextFrame => AIcons.nextFrame,
|
||||
// external
|
||||
EntryAction.edit => AIcons.edit,
|
||||
EntryAction.open || EntryAction.openVideo => AIcons.openOutside,
|
||||
EntryAction.open => AIcons.openOutside,
|
||||
EntryAction.openVideoPlayer => AIcons.openVideoPlayer,
|
||||
EntryAction.openMap => AIcons.map,
|
||||
EntryAction.setAs => AIcons.setAs,
|
||||
EntryAction.cast => AIcons.cast,
|
||||
|
@ -143,7 +144,7 @@ extension ExtraEntryActionView on EntryAction {
|
|||
EntryAction.showGeoTiffOnMap => AIcons.map,
|
||||
// metadata / motion photo
|
||||
EntryAction.convertMotionPhotoToStillImage => AIcons.convertToStillImage,
|
||||
EntryAction.viewMotionPhotoVideo => AIcons.openVideo,
|
||||
EntryAction.viewMotionPhotoVideo => AIcons.openVideoPart,
|
||||
// debug
|
||||
EntryAction.debug => AIcons.debug,
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ class VideoControlButtonsPage extends StatefulWidget {
|
|||
class _VideoControlButtonsPageState extends State<VideoControlButtonsPage> {
|
||||
late final Set<EntryAction> _selectedActions;
|
||||
|
||||
static const _availableActions = [...EntryActions.videoPlayback, EntryAction.openVideo];
|
||||
static const _availableActions = [...EntryActions.videoPlayback, EntryAction.openVideoPlayer];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
|
@ -104,7 +104,7 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
|
|||
case EntryAction.videoSkip10:
|
||||
case EntryAction.videoShowPreviousFrame:
|
||||
case EntryAction.videoShowNextFrame:
|
||||
case EntryAction.openVideo:
|
||||
case EntryAction.openVideoPlayer:
|
||||
return targetEntry.isPureVideo;
|
||||
case EntryAction.rotateScreen:
|
||||
return !settings.useTvLayout && settings.isRotationLocked;
|
||||
|
@ -246,7 +246,7 @@ class EntryActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
|
|||
case EntryAction.videoSkip10:
|
||||
case EntryAction.videoShowPreviousFrame:
|
||||
case EntryAction.videoShowNextFrame:
|
||||
case EntryAction.openVideo:
|
||||
case EntryAction.openVideoPlayer:
|
||||
final controller = context.read<VideoConductor>().getController(targetEntry);
|
||||
if (controller != null) {
|
||||
VideoActionNotification(
|
||||
|
|
|
@ -79,7 +79,7 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
|
|||
await controller.skipFrames(-1);
|
||||
case EntryAction.videoShowNextFrame:
|
||||
await controller.skipFrames(1);
|
||||
case EntryAction.openVideo:
|
||||
case EntryAction.openVideoPlayer:
|
||||
await appService.open(entry.uri, entry.mimeTypeAnySubtype, forceChooser: false).then((success) {
|
||||
if (!success) showNoMatchingAppDialog(context);
|
||||
});
|
||||
|
|
|
@ -39,7 +39,7 @@ class VideoControlRow extends StatelessWidget {
|
|||
final action = actions.first;
|
||||
return 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,
|
||||
textDirection: ViewerBottomOverlay.actionsDirection,
|
||||
children: actions.map((action) {
|
||||
var borderRadius = const BorderRadius.all(Radius.zero);
|
||||
var borderRadius = BorderRadius.zero;
|
||||
if (action == actions.first) {
|
||||
borderRadius = const BorderRadius.only(topLeft: radius, bottomLeft: radius);
|
||||
borderRadius = const BorderRadius.horizontal(left: radius);
|
||||
} 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(),
|
||||
),
|
||||
);
|
||||
|
@ -65,9 +65,9 @@ class VideoControlRow extends StatelessWidget {
|
|||
|
||||
Widget _buildOverlayButton(
|
||||
BuildContext context,
|
||||
EntryAction action, {
|
||||
BorderRadius? borderRadius,
|
||||
}) {
|
||||
EntryAction action,
|
||||
BorderRadius borderRadius,
|
||||
) {
|
||||
Widget child;
|
||||
if (action == EntryAction.videoTogglePlay) {
|
||||
child = PlayToggler(
|
||||
|
@ -75,7 +75,7 @@ class VideoControlRow extends StatelessWidget {
|
|||
onPressed: () => onActionSelected(action),
|
||||
);
|
||||
} else {
|
||||
final enabled = action == EntryAction.openVideo ? !entry.trashed : true;
|
||||
final enabled = action == EntryAction.openVideoPlayer ? !entry.trashed : true;
|
||||
child = IconButton(
|
||||
icon: action.getIcon(),
|
||||
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(
|
||||
scale: scale,
|
||||
borderRadius: borderRadius,
|
||||
|
|
|
@ -47,7 +47,7 @@ class _VideoControlOverlayState extends State<VideoControlOverlay> with SingleTi
|
|||
final status = controller?.status ?? VideoStatus.idle;
|
||||
|
||||
if (status == VideoStatus.error) {
|
||||
const action = EntryAction.openVideo;
|
||||
const action = EntryAction.openVideoPlayer;
|
||||
return Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: OverlayButton(
|
||||
|
|
|
@ -33,7 +33,7 @@ enum EntryAction {
|
|||
// external
|
||||
edit,
|
||||
open,
|
||||
openVideo,
|
||||
openVideoPlayer,
|
||||
openMap,
|
||||
setAs,
|
||||
cast,
|
||||
|
|
Loading…
Reference in a new issue