mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-07-18 02:24:07 +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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
pixelRatio = MediaQuery.of(context).devicePixelRatio;
|
pixelRatio = MediaQuery.of(context).devicePixelRatio;
|
||||||
|
|
@ -784,26 +803,27 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
||||||
width: currentImage.width / pixelRatio,
|
width: currentImage.width / pixelRatio,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
if (videoController != null)
|
if (videoController != null &&
|
||||||
|
videoController!.value.isInitialized)
|
||||||
|
Positioned.fill(
|
||||||
|
child: Center(
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: videoController!.value.aspectRatio,
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: VideoPlayer(videoController!),
|
child: VideoPlayer(videoController!),
|
||||||
),
|
),
|
||||||
Screenshot(
|
Positioned.fill(
|
||||||
controller: screenshotController,
|
child: _buildScreenshotViewer(),
|
||||||
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(() {});
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
_buildScreenshotViewer(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -21,18 +21,16 @@ class MediaContentRenderer extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
if (videoController != null)
|
if (videoController != null && videoController!.value.isInitialized)
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: PhotoView.customChild(
|
child: Center(
|
||||||
initialScale: PhotoViewComputedScale.contained,
|
child: AspectRatio(
|
||||||
minScale: PhotoViewComputedScale.contained,
|
aspectRatio: videoController!.value.aspectRatio,
|
||||||
backgroundDecoration: const BoxDecoration(
|
|
||||||
color: Colors.transparent,
|
|
||||||
),
|
|
||||||
child: VideoPlayer(
|
child: VideoPlayer(
|
||||||
videoController!,
|
videoController!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
else if (currentMedia != null &&
|
else if (currentMedia != null &&
|
||||||
(currentMedia!.mediaFile.type == MediaType.image ||
|
(currentMedia!.mediaFile.type == MediaType.image ||
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue