mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-07-17 23:54:08 +00:00
fix aspect ratio
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
This commit is contained in:
parent
1126d4172b
commit
3cdbd69d88
2 changed files with 46 additions and 28 deletions
|
|
@ -667,6 +667,25 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
}
|
||||
}
|
||||
|
||||
Widget _buildScreenshotViewer() {
|
||||
return Screenshot(
|
||||
controller: screenshotController,
|
||||
child: LayersViewer(
|
||||
layers: layers.where((x) => !x.isDeleted).toList(),
|
||||
onUpdate: () {
|
||||
for (final layer in layers) {
|
||||
layer.isEditing = false;
|
||||
if (layer.isDeleted) {
|
||||
removedLayers.add(layer);
|
||||
}
|
||||
}
|
||||
layers = layers.where((x) => !x.isDeleted).toList();
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
pixelRatio = MediaQuery.of(context).devicePixelRatio;
|
||||
|
|
@ -784,26 +803,27 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
width: currentImage.width / pixelRatio,
|
||||
child: Stack(
|
||||
children: [
|
||||
if (videoController != null)
|
||||
if (videoController != null &&
|
||||
videoController!.value.isInitialized)
|
||||
Positioned.fill(
|
||||
child: VideoPlayer(videoController!),
|
||||
),
|
||||
Screenshot(
|
||||
controller: screenshotController,
|
||||
child: LayersViewer(
|
||||
layers: layers.where((x) => !x.isDeleted).toList(),
|
||||
onUpdate: () {
|
||||
for (final layer in layers) {
|
||||
layer.isEditing = false;
|
||||
if (layer.isDeleted) {
|
||||
removedLayers.add(layer);
|
||||
}
|
||||
}
|
||||
layers = layers.where((x) => !x.isDeleted).toList();
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: AspectRatio(
|
||||
aspectRatio: videoController!.value.aspectRatio,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: VideoPlayer(videoController!),
|
||||
),
|
||||
Positioned.fill(
|
||||
child: _buildScreenshotViewer(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
_buildScreenshotViewer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -21,16 +21,14 @@ class MediaContentRenderer extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
if (videoController != null)
|
||||
if (videoController != null && videoController!.value.isInitialized)
|
||||
Positioned.fill(
|
||||
child: PhotoView.customChild(
|
||||
initialScale: PhotoViewComputedScale.contained,
|
||||
minScale: PhotoViewComputedScale.contained,
|
||||
backgroundDecoration: const BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
child: VideoPlayer(
|
||||
videoController!,
|
||||
child: Center(
|
||||
child: AspectRatio(
|
||||
aspectRatio: videoController!.value.aspectRatio,
|
||||
child: VideoPlayer(
|
||||
videoController!,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue