viewer: keep controls in the lower right corner even with RTL locales

This commit is contained in:
Thibault Deckers 2023-12-24 16:48:19 +01:00
parent b17bfd196d
commit 1984e601b0
4 changed files with 79 additions and 70 deletions

View file

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
## <a id="unreleased"></a>[Unreleased]
### Changed
- Viewer: keep controls in the lower right corner even with RTL locales
### Fixed
- crash when loading SVG defined with large dimensions

View file

@ -186,41 +186,45 @@ class _BottomOverlayContentState extends State<_BottomOverlayContent> {
builder: (context, child) {
final viewInsetsPadding = (widget.viewInsets ?? EdgeInsets.zero) + (widget.viewPadding ?? EdgeInsets.zero);
final selection = context.read<Selection<AvesEntry>?>();
final viewerButtonRow = (selection?.isSelecting ?? false)
? SelectionButton(
mainEntry: mainEntry,
scale: _buttonScale,
)
: FocusableActionDetector(
focusNode: _buttonRowFocusScopeNode,
shortcuts: settings.useTvLayout
? const {
SingleActivator(LogicalKeyboardKey.arrowUp): TvShowLessInfoIntent(),
}
: null,
actions: {
TvShowLessInfoIntent: CallbackAction<Intent>(onInvoke: (intent) => TvShowLessInfoNotification().dispatch(context)),
},
child: SafeArea(
top: false,
bottom: false,
minimum: EdgeInsets.only(
left: viewInsetsPadding.left,
right: viewInsetsPadding.right,
final viewerButtonRow = Directionality(
// always keep action buttons in the lower right corner, even with RTL locales
textDirection: TextDirection.ltr,
child: (selection?.isSelecting ?? false)
? SelectionButton(
mainEntry: mainEntry,
scale: _buttonScale,
)
: FocusableActionDetector(
focusNode: _buttonRowFocusScopeNode,
shortcuts: settings.useTvLayout
? const {
SingleActivator(LogicalKeyboardKey.arrowUp): TvShowLessInfoIntent(),
}
: null,
actions: {
TvShowLessInfoIntent: CallbackAction<Intent>(onInvoke: (intent) => TvShowLessInfoNotification().dispatch(context)),
},
child: SafeArea(
top: false,
bottom: false,
minimum: EdgeInsets.only(
left: viewInsetsPadding.left,
right: viewInsetsPadding.right,
),
child: isWallpaperMode
? WallpaperButtons(
entry: pageEntry,
scale: _buttonScale,
)
: ViewerButtons(
mainEntry: mainEntry,
pageEntry: pageEntry,
collection: widget.collection,
scale: _buttonScale,
),
),
child: isWallpaperMode
? WallpaperButtons(
entry: pageEntry,
scale: _buttonScale,
)
: ViewerButtons(
mainEntry: mainEntry,
pageEntry: pageEntry,
collection: widget.collection,
scale: _buttonScale,
),
),
);
);
final showMultiPageOverlay = mainEntry.isMultiPage && multiPageController != null;
final collapsedPageScroller = mainEntry.isMotionPhoto;
@ -247,6 +251,8 @@ class _BottomOverlayContentState extends State<_BottomOverlayContent> {
(showMultiPageOverlay && collapsedPageScroller)
? Row(
crossAxisAlignment: CrossAxisAlignment.center,
// always keep action buttons in the lower right corner, even with RTL locales
textDirection: TextDirection.ltr,
children: [
SafeArea(
top: false,

View file

@ -40,44 +40,48 @@ class _VideoControlOverlayState extends State<VideoControlOverlay> with SingleTi
@override
Widget build(BuildContext context) {
return StreamBuilder<VideoStatus>(
stream: statusStream,
builder: (context, snapshot) {
// do not use stream snapshot because it is obsolete when switching between videos
final status = controller?.status ?? VideoStatus.idle;
return Directionality(
// always keep action buttons in the lower right corner, even with RTL locales
textDirection: TextDirection.ltr,
child: StreamBuilder<VideoStatus>(
stream: statusStream,
builder: (context, snapshot) {
// do not use stream snapshot because it is obsolete when switching between videos
final status = controller?.status ?? VideoStatus.idle;
if (status == VideoStatus.error) {
const action = EntryAction.openVideo;
return Align(
alignment: AlignmentDirectional.centerEnd,
child: OverlayButton(
scale: scale,
child: IconButton(
icon: action.getIcon(),
onPressed: entry.trashed ? null : () => widget.onActionSelected(action),
tooltip: action.getText(context),
if (status == VideoStatus.error) {
const action = EntryAction.openVideo;
return Align(
alignment: AlignmentDirectional.centerEnd,
child: OverlayButton(
scale: scale,
child: IconButton(
icon: action.getIcon(),
onPressed: entry.trashed ? null : () => widget.onActionSelected(action),
tooltip: action.getText(context),
),
),
),
);
}
);
}
return Row(
children: [
Expanded(
child: VideoProgressBar(
return Row(
children: [
Expanded(
child: VideoProgressBar(
controller: controller,
scale: scale,
),
),
VideoControlRow(
entry: entry,
controller: controller,
scale: scale,
onActionSelected: widget.onActionSelected,
),
),
VideoControlRow(
entry: entry,
controller: controller,
scale: scale,
onActionSelected: widget.onActionSelected,
),
],
);
},
],
);
},
),
);
}
}

View file

@ -6457,11 +6457,6 @@
"filePickerUseThisFolder"
],
"pt": [
"entryActionCast",
"castDialogTitle"
],
"ro": [
"saveCopyButtonLabel",
"applyTooltip",