This commit is contained in:
otsmr 2025-06-12 22:16:56 +02:00
parent b979f3c8d2
commit 27cd92f17f
3 changed files with 13 additions and 3 deletions

View file

@ -269,7 +269,8 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
}
Future<bool> pushMediaEditor(
Future<Uint8List?>? imageBytes, File? videoFilePath) async {
Future<Uint8List?>? imageBytes, File? videoFilePath,
{bool sharedFromGallery = false}) async {
bool? shouldReturn = await Navigator.push(
context,
PageRouteBuilder(
@ -277,6 +278,7 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
pageBuilder: (context, a1, a2) => ShareImageEditorView(
videoFilePath: videoFilePath,
imageBytes: imageBytes,
sharedFromGallery: sharedFromGallery,
sendTo: widget.sendTo,
mirrorVideo: isFront && Platform.isAndroid,
useHighQuality: useHighQuality,
@ -339,7 +341,11 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
if (pickedFile != null) {
File imageFile = File(pickedFile.path);
if (await pushMediaEditor(imageFile.readAsBytes(), null)) {
if (await pushMediaEditor(
imageFile.readAsBytes(),
null,
sharedFromGallery: true,
)) {
return;
}
}

View file

@ -41,12 +41,14 @@ class ShareImageEditorView extends StatefulWidget {
this.videoFilePath,
required this.mirrorVideo,
required this.useHighQuality,
required this.sharedFromGallery,
});
final Future<Uint8List?>? imageBytes;
final File? videoFilePath;
final Contact? sendTo;
final bool mirrorVideo;
final bool useHighQuality;
final bool sharedFromGallery;
@override
State<ShareImageEditorView> createState() => _ShareImageEditorView();
}
@ -453,7 +455,8 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
}
return Scaffold(
backgroundColor: Colors.white.withAlpha(0),
backgroundColor:
widget.sharedFromGallery ? null : Colors.white.withAlpha(0),
resizeToAvoidBottomInset: false,
body: Stack(
fit: StackFit.expand,

View file

@ -129,6 +129,7 @@ class _MemoriesPhotoSliderViewState extends State<MemoriesPhotoSliderView> {
.galleryItems[currentIndex].imagePath
?.readAsBytes(),
mirrorVideo: false,
sharedFromGallery: true,
useHighQuality: true,
),
),