Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos] Match video editor action spacing

r4khulac7f35d48925
diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_crop_page.dart b/mobile/apps/photos/lib/ui/tools/editor/video_crop_page.dart
index 0826fda8c9..3008c4ec8a 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/video_crop_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/video_crop_page.dart
@@ -53,15 +53,10 @@ class _VideoCropPageState extends State<VideoCropPage> {
builder: (_, _) => VideoEditorMainActions(
children: [
_buildCropButton(context, CropValue.free),
- const SizedBox(width: 24),
_buildCropButton(context, CropValue.ratio_1_1),
- const SizedBox(width: 24),
_buildCropButton(context, CropValue.ratio_9_16),
- const SizedBox(width: 24),
_buildCropButton(context, CropValue.ratio_16_9),
- const SizedBox(width: 24),
_buildCropButton(context, CropValue.ratio_3_4),
- const SizedBox(width: 24),
_buildCropButton(context, CropValue.ratio_4_3),
],
),
diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_main_actions.dart b/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_main_actions.dart
index 7dae1db9d7..6ff9b55996 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_main_actions.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_main_actions.dart
@@ -1,3 +1,5 @@
+import 'dart:math';
+
import "package:flutter/material.dart";
class VideoEditorMainActions extends StatelessWidget {
@@ -7,20 +9,30 @@ class VideoEditorMainActions extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
- child: Align(
- alignment: Alignment.center,
- child: SingleChildScrollView(
- scrollDirection: Axis.horizontal,
- clipBehavior: Clip.none,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.center,
- children: children,
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 12),
+ child: Align(
+ alignment: Alignment.center,
+ child: SingleChildScrollView(
+ scrollDirection: Axis.horizontal,
+ clipBehavior: Clip.none,
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ minWidth: min(constraints.maxWidth, 600),
+ maxWidth: 600,
+ ),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ mainAxisSize: MainAxisSize.min,
+ children: children,
+ ),
+ ),
+ ),
),
- ),
- ),
+ );
+ },
);
}
}
diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_editor_page.dart b/mobile/apps/photos/lib/ui/tools/editor/video_editor_page.dart
index 5d0b0f4277..293571c4bd 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/video_editor_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/video_editor_page.dart
@@ -206,7 +206,6 @@ class _VideoEditorPageState extends State<VideoEditorPage> {
VideoTrimPage(controller: _controller!),
),
),
- const SizedBox(width: 24),
VideoEditorBottomAction(
label: context.strings.crop,
svgPath:
@@ -215,7 +214,6 @@ class _VideoEditorPageState extends State<VideoEditorPage> {
VideoCropPage(controller: _controller!),
),
),
- const SizedBox(width: 24),
VideoEditorBottomAction(
label: context.strings.rotate,
svgPath:
@@ -224,7 +222,6 @@ class _VideoEditorPageState extends State<VideoEditorPage> {
VideoRotatePage(controller: _controller!),
),
),
- const SizedBox(width: 24),
VideoEditorBottomAction(
label: context.strings.speed,
hugeIcon:
diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_rotate_page.dart b/mobile/apps/photos/lib/ui/tools/editor/video_rotate_page.dart
index fe0999a254..96ba08a7c0 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/video_rotate_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/video_rotate_page.dart
@@ -23,7 +23,6 @@ class VideoRotatePage extends StatelessWidget {
controller.rotate90Degrees(VideoRotationDirection.left),
icon: Icons.rotate_left,
),
- const SizedBox(width: 24),
VideoEditorBottomAction(
label: context.strings.right,
onPressed: () =>
diff --git a/mobile/apps/photos/test/ui/tools/editor/video_editor_main_actions_test.dart b/mobile/apps/photos/test/ui/tools/editor/video_editor_main_actions_test.dart
new file mode 100644
index 0000000000..335337a2e8
--- /dev/null
+++ b/mobile/apps/photos/test/ui/tools/editor/video_editor_main_actions_test.dart
@@ -0,0 +1,37 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:photos/ui/tools/editor/video_editor/video_editor_main_actions.dart';
+
+void main() {
+ testWidgets('spaces actions across the available editor width', (
+ tester,
+ ) async {
+ const firstKey = Key('first');
+ const secondKey = Key('second');
+ const thirdKey = Key('third');
+ const fourthKey = Key('fourth');
+
+ await tester.pumpWidget(
+ const MaterialApp(
+ home: Scaffold(
+ body: SizedBox(
+ width: 600,
+ child: VideoEditorMainActions(
+ children: [
+ SizedBox(key: firstKey, width: 90, height: 60),
+ SizedBox(key: secondKey, width: 90, height: 60),
+ SizedBox(key: thirdKey, width: 90, height: 60),
+ SizedBox(key: fourthKey, width: 90, height: 60),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+
+ expect(tester.getTopLeft(find.byKey(firstKey)).dx, 0);
+ expect(tester.getTopLeft(find.byKey(secondKey)).dx, 170);
+ expect(tester.getTopLeft(find.byKey(thirdKey)).dx, 340);
+ expect(tester.getTopLeft(find.byKey(fourthKey)).dx, 510);
+ });
+}