π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Align video editor UI with photo editor flow
Prateek Sunala18ed3222b58
diff --git a/mobile/apps/photos/l10n.yaml b/mobile/apps/photos/l10n.yamlindex d02a7daa89..0d369d1222 100644--- a/mobile/apps/photos/l10n.yaml+++ b/mobile/apps/photos/l10n.yaml@@ -4,3 +4,4 @@ template-arb-file: intl_en.arboutput-localization-file: app_localizations.dartnullable-getter: falseuse-named-parameters: true+suppress-warnings: truediff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/circular_icon_button.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/circular_icon_button.dartindex 07dbef9f2d..c8f2df181b 100644--- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/circular_icon_button.dart+++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/circular_icon_button.dart@@ -7,6 +7,8 @@ class CircularIconButton extends StatelessWidget {final String label;final VoidCallback onTap;final String? svgPath;+ final IconData? icon;+ final Widget? child;final double size;final bool isSelected;@@ -15,14 +17,34 @@ class CircularIconButton extends StatelessWidget {required this.label,required this.onTap,this.svgPath,+ this.icon,+ this.child,this.size = 60,this.isSelected = false,- });+ }) : assert(+ svgPath != null || icon != null || child != null,+ 'One of svgPath, icon or child must be provided',+ );@overrideWidget build(BuildContext context) {final textTheme = getEnteTextTheme(context);final colorScheme = getEnteColorScheme(context);+ final Widget iconContent;+ if (svgPath != null) {+ iconContent = SvgPicture.asset(+ svgPath!,+ width: 12,+ height: 12,+ fit: BoxFit.scaleDown,+ colorFilter: ColorFilter.mode(colorScheme.tabIcon, BlendMode.srcIn),+ );+ } else if (icon != null) {+ iconContent = Icon(icon, size: size * 0.4, color: colorScheme.tabIcon);+ } else {+ iconContent = child!;+ }+return SizedBox(width: 90,child: Column(@@ -49,26 +71,11 @@ class CircularIconButton extends StatelessWidget {width: 2,),),- child: svgPath != null- ? SvgPicture.asset(- svgPath!,- width: 12,- height: 12,- fit: BoxFit.scaleDown,- colorFilter: ColorFilter.mode(- colorScheme.tabIcon,- BlendMode.srcIn,- ),- )- : const SizedBox(),+ child: iconContent,),),const SizedBox(height: 6),- Text(- label,- style: textTheme.small,- textAlign: TextAlign.center,- ),+ Text(label, style: textTheme.small, textAlign: TextAlign.center),],),);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.dartindex bc83454111..07e8f901cc 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@@ -2,10 +2,11 @@ import 'package:flutter/material.dart';import "package:photos/ente_theme_data.dart";import "package:photos/generated/l10n.dart";import "package:photos/ui/tools/editor/video_editor/crop_value.dart";+import "package:photos/ui/tools/editor/video_editor/video_editor_app_bar.dart";import "package:photos/ui/tools/editor/video_editor/video_editor_bottom_action.dart";import "package:photos/ui/tools/editor/video_editor/video_editor_main_actions.dart";-import "package:photos/ui/tools/editor/video_editor/video_editor_navigation_options.dart";import "package:photos/ui/tools/editor/video_editor/video_editor_player_control.dart";+import "package:photos/theme/ente_theme.dart";import 'package:video_editor/video_editor.dart';class VideoCropPage extends StatefulWidget {@@ -25,87 +26,80 @@ class VideoCropPage extends StatefulWidget {class _VideoCropPageState extends State<VideoCropPage> {@overrideWidget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);return Scaffold(- appBar: AppBar(- elevation: 0,- toolbarHeight: 0,+ backgroundColor: colorScheme.backgroundBase,+ appBar: VideoEditorAppBar(+ onCancel: () => Navigator.pop(context),+ primaryActionLabel: AppLocalizations.of(context).done,+ onPrimaryAction: () {+ widget.controller.applyCacheCrop();+ Navigator.pop(context);+ },),body: SafeArea(- child: Column(- children: [- Expanded(- child: Hero(- tag: "video-editor-preview",- child: RotatedBox(- quarterTurns: widget.quarterTurnsForRotationCorrection,- child: CropGridViewer.edit(- controller: widget.controller,- rotateCropArea: false,- margin: const EdgeInsets.symmetric(horizontal: 20),- ),- ),- ),- ),- VideoEditorPlayerControl(- controller: widget.controller,- ),- Row(- crossAxisAlignment: CrossAxisAlignment.end,- children: [- Expanded(- flex: 4,- child: AnimatedBuilder(- animation: widget.controller,- builder: (_, __) => Column(- children: [- VideoEditorMainActions(- children: [- // _buildCropButton(context, CropValue.original),- // const SizedBox(width: 40),- _buildCropButton(context, CropValue.free),- const SizedBox(width: 40),- _buildCropButton(context, CropValue.ratio_1_1),- const SizedBox(width: 40),- _buildCropButton(- context,- CropValue.ratio_9_16,- ),- const SizedBox(width: 40),- _buildCropButton(- context,- CropValue.ratio_16_9,- ),- const SizedBox(width: 40),- _buildCropButton(- context,- CropValue.ratio_3_4,+ top: false,+ bottom: true,+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Expanded(+ child: ClipRRect(+ borderRadius: BorderRadius.circular(24),+ child: Stack(+ fit: StackFit.expand,+ children: [+ Positioned.fill(+ child: Hero(+ tag: "video-editor-preview",+ child: RotatedBox(+ quarterTurns:+ widget.quarterTurnsForRotationCorrection,+ child: CropGridViewer.edit(+ controller: widget.controller,+ rotateCropArea: false,+ margin: const EdgeInsets.symmetric(+ horizontal: 12,+ ),),- const SizedBox(width: 40),- _buildCropButton(- context,- CropValue.ratio_4_3,- ),- ],+ ),+ ),+ ),+ Align(+ alignment: Alignment.bottomCenter,+ child: Padding(+ padding: const EdgeInsets.only(bottom: 20),+ child: VideoEditorPlayerControl(+ controller: widget.controller,+ ),),- ],- ),+ ),+ ],),),- ],- ),- const SizedBox(height: 40),- VideoEditorNavigationOptions(- color: Theme.of(context).colorScheme.videoPlayerPrimaryColor,- secondaryText: AppLocalizations.of(context).done,- onSecondaryPressed: () {- // WAY 1: validate crop parameters set in the crop view- widget.controller.applyCacheCrop();- // WAY 2: update manually with Offset values- // controller.updateCrop(const Offset(0.2, 0.2), const Offset(0.8, 0.8));- Navigator.pop(context);- },- ),- ],+ ),+ AnimatedBuilder(+ animation: widget.controller,+ 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_app_bar.dart b/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_app_bar.dartnew file mode 100644index 0000000000..172a59eea0--- /dev/null+++ b/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_app_bar.dart@@ -0,0 +1,57 @@+import 'package:flutter/material.dart';+import "package:photos/ente_theme_data.dart";+import "package:photos/generated/l10n.dart";+import "package:photos/theme/ente_theme.dart";++class VideoEditorAppBar extends StatelessWidget implements PreferredSizeWidget {+ const VideoEditorAppBar({+ super.key,+ required this.onCancel,+ required this.primaryActionLabel,+ required this.onPrimaryAction,+ this.isPrimaryEnabled = true,+ });++ final VoidCallback onCancel;+ final String primaryActionLabel;+ final VoidCallback onPrimaryAction;+ final bool isPrimaryEnabled;++ @override+ Size get preferredSize => const Size.fromHeight(kToolbarHeight);++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);+ return AppBar(+ elevation: 0,+ backgroundColor: colorScheme.backgroundBase,+ automaticallyImplyLeading: false,+ titleSpacing: 0,+ title: Row(+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ children: [+ TextButton(+ onPressed: onCancel,+ child: Text(+ AppLocalizations.of(context).cancel,+ style: textTheme.body,+ ),+ ),+ TextButton(+ onPressed: isPrimaryEnabled ? onPrimaryAction : null,+ child: Text(+ primaryActionLabel,+ style: textTheme.body.copyWith(+ color: isPrimaryEnabled+ ? Theme.of(context).colorScheme.imageEditorPrimaryColor+ : colorScheme.textMuted,+ ),+ ),+ ),+ ],+ ),+ );+ }+}diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_bottom_action.dart b/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_bottom_action.dartindex d6c0f8aef6..91d49f7918 100644--- a/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_bottom_action.dart+++ b/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_bottom_action.dart@@ -1,6 +1,5 @@import "package:flutter/material.dart";-import "package:flutter_svg/flutter_svg.dart";-import "package:photos/ente_theme_data.dart";+import "package:photos/ui/tools/editor/image_editor/circular_icon_button.dart";class VideoEditorBottomAction extends StatelessWidget {const VideoEditorBottomAction({@@ -22,49 +21,14 @@ class VideoEditorBottomAction extends StatelessWidget {@overrideWidget build(BuildContext context) {- return GestureDetector(+ return CircularIconButton(+ label: label,onTap: onPressed,- behavior: HitTestBehavior.translucent,- child: Column(- children: [- Container(- height: 48,- width: 48,- decoration: BoxDecoration(- color: Theme.of(context).colorScheme.editorBackgroundColor,- shape: BoxShape.circle,- border: Border.all(- color: isSelected- ? Theme.of(context).colorScheme.videoPlayerBorderColor- : Colors.transparent,- width: 1,- ),- ),- child: icon != null- ? Icon(icon!)- : svgPath != null- ? SvgPicture.asset(- svgPath!,- colorFilter: ColorFilter.mode(- Theme.of(context).colorScheme.onSurface,- BlendMode.srcIn,- ),- )- : Padding(- padding: const EdgeInsets.all(2),- child: child!,- ),- ),- const SizedBox(height: 8),- Text(- label,- style: const TextStyle(- fontSize: 12,- fontWeight: FontWeight.w600,- ),- ),- ],- ),+ svgPath: svgPath,+ icon: icon,+ child: child,+ size: 60,+ isSelected: isSelected,);}}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.dartindex 57fc21780d..7dae1db9d7 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,23 +1,24 @@import "package:flutter/material.dart";class VideoEditorMainActions extends StatelessWidget {- const VideoEditorMainActions({- super.key,- required this.children,- });+ const VideoEditorMainActions({super.key, required this.children});final List<Widget> children;@overrideWidget build(BuildContext context) {- return Center(- child: SizedBox(- height: 76,- child: ListView(- padding: const EdgeInsets.symmetric(horizontal: 36),+ return Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),+ child: Align(+ alignment: Alignment.center,+ child: SingleChildScrollView(scrollDirection: Axis.horizontal,- shrinkWrap: true,- children: children,+ clipBehavior: Clip.none,+ child: Row(+ mainAxisSize: MainAxisSize.min,+ mainAxisAlignment: MainAxisAlignment.center,+ children: children,+ ),),),);diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_navigation_options.dart b/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_navigation_options.dartdeleted file mode 100644index 2e6c737069..0000000000--- a/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_navigation_options.dart+++ /dev/null@@ -1,50 +0,0 @@-import "package:flutter/material.dart";-import "package:photos/generated/l10n.dart";--class VideoEditorNavigationOptions extends StatelessWidget {- const VideoEditorNavigationOptions({- super.key,- this.primaryText,- this.onPrimaryPressed,- this.color,- required this.secondaryText,- required this.onSecondaryPressed,- });-- final String? primaryText;- final VoidCallback? onPrimaryPressed;- final String secondaryText;- final VoidCallback? onSecondaryPressed;- final Color? color;-- @override- Widget build(BuildContext context) {- return Hero(- tag: "video-editor-navigation-options",- child: Padding(- padding: const EdgeInsets.only(bottom: 12),- child: Row(- children: [- const SizedBox(width: 28),- TextButton(- onPressed: onPrimaryPressed?.call ?? Navigator.of(context).pop,- child: Text(primaryText ?? AppLocalizations.of(context).cancel),- ),- const Spacer(),- TextButton(- onPressed: onSecondaryPressed,- style: TextButton.styleFrom(- foregroundColor: color,- ),- child: Text(- secondaryText,- style: TextStyle(color: color),- ),- ),- const SizedBox(width: 28),- ],- ),- ),- );- }-}diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_player_control.dart b/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_player_control.dartindex b05fc13789..527a3c83d3 100644--- a/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_player_control.dart+++ b/mobile/apps/photos/lib/ui/tools/editor/video_editor/video_editor_player_control.dart@@ -36,29 +36,29 @@ class VideoEditorPlayerControl extends StatelessWidget {}},child: Container(- height: 28,margin: const EdgeInsets.only(top: 24, bottom: 28),padding: const EdgeInsets.symmetric(- horizontal: 10,- vertical: 4,+ horizontal: 14,+ vertical: 8,),+ constraints: const BoxConstraints(minHeight: 36),decoration: BoxDecoration(color: Theme.of(context).colorScheme.editorBackgroundColor,borderRadius: BorderRadius.circular(56),),child: Row(mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.center,children: [Icon(!isPlaying ? Icons.play_arrow : Icons.pause,- size: 21,+ size: 20,),- const SizedBox(width: 4),+ const SizedBox(width: 6),Text("${formatter(pos)} / ${formatter(duration)}",- // ignore: prefer_const_constructors- style: TextStyle(- fontSize: 12,+ style: const TextStyle(+ fontSize: 13,fontWeight: FontWeight.w500,),),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.dartindex 468cb7c141..1cc3672832 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@@ -14,13 +14,14 @@ import "package:photos/generated/l10n.dart";import "package:photos/models/file/file.dart";import "package:photos/models/location/location.dart";import "package:photos/services/sync/sync_service.dart";+import "package:photos/theme/ente_theme.dart";import "package:photos/ui/common/linear_progress_dialog.dart";import "package:photos/ui/notification/toast.dart";import "package:photos/ui/tools/editor/export_video_service.dart";import 'package:photos/ui/tools/editor/video_crop_page.dart';+import "package:photos/ui/tools/editor/video_editor/video_editor_app_bar.dart";import "package:photos/ui/tools/editor/video_editor/video_editor_bottom_action.dart";import "package:photos/ui/tools/editor/video_editor/video_editor_main_actions.dart";-import "package:photos/ui/tools/editor/video_editor/video_editor_navigation_options.dart";import "package:photos/ui/tools/editor/video_editor/video_editor_player_control.dart";import "package:photos/ui/tools/editor/video_rotate_page.dart";import "package:photos/ui/tools/editor/video_trim_page.dart";@@ -74,22 +75,21 @@ class _VideoEditorPageState extends State<VideoEditorPage> {onTrimmedColor: const ColorScheme.dark().videoPlayerPrimaryColor,onTrimmingColor: const ColorScheme.dark().videoPlayerPrimaryColor,background: Theme.of(context).colorScheme.editorBackgroundColor,- positionLineColor:- Theme.of(context).colorScheme.videoPlayerBorderColor,- lineColor: Theme.of(context)- .colorScheme- .videoPlayerBorderColor- .withValues(alpha: 0.6),+ positionLineColor: Theme.of(+ context,+ ).colorScheme.videoPlayerBorderColor,+ lineColor: Theme.of(+ context,+ ).colorScheme.videoPlayerBorderColor.withValues(alpha: 0.6),),);- _controller!.initialize().then((_) => setState(() {})).catchError(- (error) {- // handle minumum duration bigger than video duration error- Navigator.pop(context);- },- test: (e) => e is VideoMinDurationError,- );+ _controller!.initialize().then((_) => setState(() {})).catchError((+ error,+ ) {+ // handle minumum duration bigger than video duration error+ Navigator.pop(context);+ }, test: (e) => e is VideoMinDurationError);});_doRotationCorrectionIfAndroid();@@ -105,119 +105,123 @@ class _VideoEditorPageState extends State<VideoEditorPage> {@overrideWidget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);return PopScope(canPop: false,onPopInvokedWithResult: (didPop, _) {- if (!didPop) {- if (_isExporting.value) {- return;- } else {- replacePage(context, DetailPage(widget.detailPageConfig));- }+ if (didPop) return;+ if (_isExporting.value) {+ return;}+ replacePage(context, DetailPage(widget.detailPageConfig));},- child: Scaffold(- appBar: AppBar(- elevation: 0,- toolbarHeight: 0,- ),- body: _controller != null &&- _controller!.initialized &&- _quarterTurnsForRotationCorrection != null- ? SafeArea(- child: Stack(- children: [- Column(- children: [- Expanded(- child: Column(- children: [- Expanded(- child: Hero(- tag: "video-editor-preview",- child: RotatedBox(- quarterTurns:- _quarterTurnsForRotationCorrection!,- child: CropGridViewer.preview(- controller: _controller!,- ),- ),- ),- ),- VideoEditorPlayerControl(- controller: _controller!,- ),- VideoEditorMainActions(+ child: ValueListenableBuilder<bool>(+ valueListenable: _isExporting,+ builder: (context, isExporting, _) {+ final isReady = _controller != null &&+ _controller!.initialized &&+ _quarterTurnsForRotationCorrection != null;++ return Scaffold(+ backgroundColor: colorScheme.backgroundBase,+ appBar: VideoEditorAppBar(+ onCancel: () {+ if (isExporting) return;+ replacePage(context, DetailPage(widget.detailPageConfig));+ },+ primaryActionLabel: AppLocalizations.of(context).saveCopy,+ onPrimaryAction: exportVideo,+ isPrimaryEnabled: isReady && !isExporting,+ ),+ body: isReady+ ? SafeArea(+ top: false,+ bottom: true,+ child: Padding(+ padding: const EdgeInsets.symmetric(+ horizontal: 16,+ vertical: 12,+ ),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Expanded(+ child: ClipRRect(+ borderRadius: BorderRadius.circular(24),+ child: Stack(+ fit: StackFit.expand,children: [- VideoEditorBottomAction(- label: AppLocalizations.of(context).trim,- svgPath:- "assets/video-editor/video-editor-trim-action.svg",- onPressed: () => Navigator.push(- context,- MaterialPageRoute<void>(- builder: (context) => VideoTrimPage(- controller: _controller!,- quarterTurnsForRotationCorrection:- _quarterTurnsForRotationCorrection!,- ),- ),- ),- ),- const SizedBox(width: 40),- VideoEditorBottomAction(- label: AppLocalizations.of(context).crop,- svgPath:- "assets/video-editor/video-editor-crop-action.svg",- onPressed: () => Navigator.push(- context,- MaterialPageRoute<void>(- builder: (context) => VideoCropPage(+ Positioned.fill(+ child: Hero(+ tag: "video-editor-preview",+ child: RotatedBox(+ quarterTurns:+ _quarterTurnsForRotationCorrection!,+ child: CropGridViewer.preview(controller: _controller!,- quarterTurnsForRotationCorrection:- _quarterTurnsForRotationCorrection!,),),),),- const SizedBox(width: 40),- VideoEditorBottomAction(- label: AppLocalizations.of(context).rotate,- svgPath:- "assets/video-editor/video-editor-rotate-action.svg",- onPressed: () => Navigator.push(- context,- MaterialPageRoute<void>(- builder: (context) => VideoRotatePage(- controller: _controller!,- quarterTurnsForRotationCorrection:- _quarterTurnsForRotationCorrection!,- ),+ Align(+ alignment: Alignment.bottomCenter,+ child: Padding(+ padding:+ const EdgeInsets.only(bottom: 24),+ child: VideoEditorPlayerControl(+ controller: _controller!,),),),],),- const SizedBox(height: 40),- VideoEditorNavigationOptions(- color: Theme.of(context)- .colorScheme- .videoPlayerPrimaryColor,- secondaryText:- AppLocalizations.of(context).saveCopy,- onSecondaryPressed: () {- exportVideo();- },+ ),+ ),+ const SizedBox(height: 12),+ VideoEditorMainActions(+ children: [+ VideoEditorBottomAction(+ label: AppLocalizations.of(context).trim,+ svgPath:+ "assets/video-editor/video-editor-trim-action.svg",+ onPressed: () => _openSubEditor(VideoTrimPage(+ controller: _controller!,+ quarterTurnsForRotationCorrection:+ _quarterTurnsForRotationCorrection!,+ )),+ ),+ const SizedBox(width: 24),+ VideoEditorBottomAction(+ label: AppLocalizations.of(context).crop,+ svgPath:+ "assets/video-editor/video-editor-crop-action.svg",+ onPressed: () => _openSubEditor(VideoCropPage(+ controller: _controller!,+ quarterTurnsForRotationCorrection:+ _quarterTurnsForRotationCorrection!,+ )),+ ),+ const SizedBox(width: 24),+ VideoEditorBottomAction(+ label: AppLocalizations.of(context).rotate,+ svgPath:+ "assets/video-editor/video-editor-rotate-action.svg",+ onPressed: () => _openSubEditor(VideoRotatePage(+ controller: _controller!,+ quarterTurnsForRotationCorrection:+ _quarterTurnsForRotationCorrection!,+ )),),],),- ),- ],+ const SizedBox(height: 12),+ ],+ ),),- ],- ),- )- : const Center(child: CircularProgressIndicator()),+ )+ : const Center(child: CircularProgressIndicator()),+ );+ },),);}@@ -285,8 +289,10 @@ class _VideoEditorPageState extends State<VideoEditorPage> {await PhotoManager.stopChangeNotify();try {- final AssetEntity newAsset =- await (PhotoManager.editor.saveVideo(result, title: fileName));+ final AssetEntity newAsset = await (PhotoManager.editor.saveVideo(+ result,+ title: fileName,+ ));result.deleteSync();@@ -356,6 +362,10 @@ class _VideoEditorPageState extends State<VideoEditorPage> {}}+ Future<void> _openSubEditor(Widget child) {+ return Navigator.of(context).push(_VideoEditorSubPageRoute(child));+ }+void _doRotationCorrectionIfAndroid() {if (Platform.isAndroid) {getVideoPropsAsync(widget.ioFile).then((props) async {@@ -371,3 +381,25 @@ class _VideoEditorPageState extends State<VideoEditorPage> {}}}++class _VideoEditorSubPageRoute extends PageRouteBuilder<void> {+ _VideoEditorSubPageRoute(this.child)+ : super(+ fullscreenDialog: true,+ transitionDuration: const Duration(milliseconds: 220),+ reverseTransitionDuration: const Duration(milliseconds: 180),+ pageBuilder: (_, __, ___) => child,+ transitionsBuilder: (_, animation, __, child) {+ return FadeTransition(+ opacity: CurvedAnimation(+ parent: animation,+ curve: Curves.easeOutCubic,+ reverseCurve: Curves.easeInCubic,+ ),+ child: child,+ );+ },+ );++ final Widget child;+}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.dartindex a817424d50..fadd7991b2 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@@ -1,10 +1,11 @@import 'package:flutter/material.dart';import "package:photos/ente_theme_data.dart";import "package:photos/generated/l10n.dart";+import "package:photos/ui/tools/editor/video_editor/video_editor_app_bar.dart";import "package:photos/ui/tools/editor/video_editor/video_editor_bottom_action.dart";import "package:photos/ui/tools/editor/video_editor/video_editor_main_actions.dart";-import "package:photos/ui/tools/editor/video_editor/video_editor_navigation_options.dart";import "package:photos/ui/tools/editor/video_editor/video_editor_player_control.dart";+import "package:photos/theme/ente_theme.dart";import 'package:video_editor/video_editor.dart';class VideoRotatePage extends StatelessWidget {@@ -20,60 +21,78 @@ class VideoRotatePage extends StatelessWidget {@overrideWidget build(BuildContext context) {final rotation = controller.rotation;+ final colorScheme = getEnteColorScheme(context);return Scaffold(- appBar: AppBar(- elevation: 0,- toolbarHeight: 0,+ backgroundColor: colorScheme.backgroundBase,+ appBar: VideoEditorAppBar(+ onCancel: () {+ while (controller.rotation != rotation) {+ controller.rotate90Degrees(RotateDirection.left);+ }+ Navigator.pop(context);+ },+ primaryActionLabel: AppLocalizations.of(context).done,+ onPrimaryAction: () {+ Navigator.pop(context);+ },),body: SafeArea(- child: Column(- children: [- Expanded(- child: Hero(- tag: "video-editor-preview",- child: RotatedBox(- quarterTurns: quarterTurnsForRotationCorrection,- child: CropGridViewer.preview(- controller: controller,+ top: false,+ bottom: true,+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Expanded(+ child: ClipRRect(+ borderRadius: BorderRadius.circular(24),+ child: Stack(+ fit: StackFit.expand,+ children: [+ Positioned.fill(+ child: Hero(+ tag: "video-editor-preview",+ child: RotatedBox(+ quarterTurns: quarterTurnsForRotationCorrection,+ child: CropGridViewer.preview(+ controller: controller,+ ),+ ),+ ),+ ),+ Align(+ alignment: Alignment.bottomCenter,+ child: Padding(+ padding: const EdgeInsets.only(bottom: 20),+ child: VideoEditorPlayerControl(+ controller: controller,+ ),+ ),+ ),+ ],),),),- ),- VideoEditorPlayerControl(- controller: controller,- ),- VideoEditorMainActions(- children: [- VideoEditorBottomAction(- label: AppLocalizations.of(context).left,- onPressed: () =>- controller.rotate90Degrees(RotateDirection.left),- icon: Icons.rotate_left,- ),- const SizedBox(width: 40),- VideoEditorBottomAction(- label: AppLocalizations.of(context).right,- onPressed: () =>- controller.rotate90Degrees(RotateDirection.right),- icon: Icons.rotate_right,- ),- ],- ),- const SizedBox(height: 40),- VideoEditorNavigationOptions(- color: Theme.of(context).colorScheme.videoPlayerPrimaryColor,- secondaryText: AppLocalizations.of(context).done,- onPrimaryPressed: () {- while (controller.rotation != rotation) {- controller.rotate90Degrees(RotateDirection.left);- }- Navigator.pop(context);- },- onSecondaryPressed: () {- Navigator.pop(context);- },- ),- ],+ VideoEditorMainActions(+ children: [+ VideoEditorBottomAction(+ label: AppLocalizations.of(context).left,+ onPressed: () =>+ controller.rotate90Degrees(RotateDirection.left),+ icon: Icons.rotate_left,+ ),+ const SizedBox(width: 24),+ VideoEditorBottomAction(+ label: AppLocalizations.of(context).right,+ onPressed: () =>+ controller.rotate90Degrees(RotateDirection.right),+ icon: Icons.rotate_right,+ ),+ ],+ ),+ ],+ ),),),);diff --git a/mobile/apps/photos/lib/ui/tools/editor/video_trim_page.dart b/mobile/apps/photos/lib/ui/tools/editor/video_trim_page.dartindex 7461702da8..dec0e664a3 100644--- a/mobile/apps/photos/lib/ui/tools/editor/video_trim_page.dart+++ b/mobile/apps/photos/lib/ui/tools/editor/video_trim_page.dart@@ -1,8 +1,9 @@import 'package:flutter/material.dart';import "package:photos/ente_theme_data.dart";import "package:photos/generated/l10n.dart";-import "package:photos/ui/tools/editor/video_editor/video_editor_navigation_options.dart";+import "package:photos/ui/tools/editor/video_editor/video_editor_app_bar.dart";import "package:photos/ui/tools/editor/video_editor/video_editor_player_control.dart";+import "package:photos/theme/ente_theme.dart";import 'package:video_editor/video_editor.dart';class VideoTrimPage extends StatefulWidget {@@ -26,65 +27,77 @@ class _VideoTrimPageState extends State<VideoTrimPage> {Widget build(BuildContext context) {final minTrim = widget.controller.minTrim;final maxTrim = widget.controller.maxTrim;+ final colorScheme = getEnteColorScheme(context);return Scaffold(- appBar: AppBar(- elevation: 0,- toolbarHeight: 0,+ backgroundColor: colorScheme.backgroundBase,+ appBar: VideoEditorAppBar(+ onCancel: () {+ widget.controller.updateTrim(minTrim, maxTrim);+ Navigator.pop(context);+ },+ primaryActionLabel: AppLocalizations.of(context).done,+ onPrimaryAction: () {+ widget.controller.applyCacheCrop();+ Navigator.pop(context);+ },),body: SafeArea(- child: Column(- children: [- VideoEditorPlayerControl(- controller: widget.controller,- ),- Expanded(- child: Hero(- tag: "video-editor-preview",- child: RotatedBox(- quarterTurns: widget.quarterTurnsForRotationCorrection,- child: CropGridViewer.preview(- controller: widget.controller,+ top: false,+ bottom: true,+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Expanded(+ child: ClipRRect(+ borderRadius: BorderRadius.circular(24),+ child: Stack(+ fit: StackFit.expand,+ children: [+ Positioned.fill(+ child: Hero(+ tag: "video-editor-preview",+ child: RotatedBox(+ quarterTurns:+ widget.quarterTurnsForRotationCorrection,+ child: CropGridViewer.preview(+ controller: widget.controller,+ ),+ ),+ ),+ ),+ Align(+ alignment: Alignment.bottomCenter,+ child: Padding(+ padding: const EdgeInsets.only(bottom: 20),+ child: VideoEditorPlayerControl(+ controller: widget.controller,+ ),+ ),+ ),+ ],),),),- ),- ..._trimSlider(),- const SizedBox(height: 40),- VideoEditorNavigationOptions(- color: Theme.of(context).colorScheme.videoPlayerPrimaryColor,- secondaryText: AppLocalizations.of(context).done,- onPrimaryPressed: () {- // reset trim- widget.controller.updateTrim(minTrim, maxTrim);- Navigator.pop(context);- },- onSecondaryPressed: () {- // WAY 1: validate crop parameters set in the crop view- widget.controller.applyCacheCrop();- // WAY 2: update manually with Offset values- // controller.updateCrop(const Offset(0.2, 0.2), const Offset(0.8, 0.8));- Navigator.pop(context);- },- ),- ],+ _buildTrimSlider(context),+ ],+ ),),),);}- List<Widget> _trimSlider() {- return [- Container(- width: MediaQuery.of(context).size.width,- margin: EdgeInsets.symmetric(vertical: height / 4, horizontal: 20),- child: TrimSlider(- controller: widget.controller,- height: height,- horizontalMargin: height / 4,- ),+ Widget _buildTrimSlider(BuildContext context) {+ return Padding(+ padding: const EdgeInsets.only(top: 16),+ child: TrimSlider(+ controller: widget.controller,+ height: height,+ horizontalMargin: height / 4,),- ];+ );}String formatter(Duration duration) => [