mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 11:18:41 +00:00
fixing sizing of the share image screen
This commit is contained in:
parent
1cc19f7834
commit
bc2c998850
5 changed files with 43 additions and 15 deletions
|
|
@ -20,6 +20,8 @@ class HomeViewCameraPreview extends StatelessWidget {
|
||||||
}
|
}
|
||||||
return Positioned.fill(
|
return Positioned.fill(
|
||||||
child: MediaViewSizing(
|
child: MediaViewSizing(
|
||||||
|
requiredHeight: 90,
|
||||||
|
bottomNavigation: Container(),
|
||||||
child: Screenshot(
|
child: Screenshot(
|
||||||
controller: screenshotController,
|
controller: screenshotController,
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
|
|
@ -58,6 +60,8 @@ class SendToCameraPreview extends StatelessWidget {
|
||||||
}
|
}
|
||||||
return Positioned.fill(
|
return Positioned.fill(
|
||||||
child: MediaViewSizing(
|
child: MediaViewSizing(
|
||||||
|
requiredHeight: 90,
|
||||||
|
bottomNavigation: Container(),
|
||||||
child: Screenshot(
|
child: Screenshot(
|
||||||
controller: screenshotController,
|
controller: screenshotController,
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
|
|
|
||||||
|
|
@ -590,6 +590,8 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
return MediaViewSizing(
|
return MediaViewSizing(
|
||||||
|
requiredHeight: 90,
|
||||||
|
bottomNavigation: Container(),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onPanStart: (details) async {
|
onPanStart: (details) async {
|
||||||
if (isFront) {
|
if (isFront) {
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,27 @@ class _TextViewState extends State<TextLayer> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> onEditionComplete() async {
|
||||||
|
Future.delayed(const Duration(milliseconds: 10), () async {
|
||||||
|
setState(() {
|
||||||
|
widget.layerData.isDeleted = textController.text == '';
|
||||||
|
widget.layerData.isEditing = false;
|
||||||
|
widget.layerData.text = textController.text;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!mounted) return;
|
||||||
|
|
||||||
|
await context
|
||||||
|
.read<ImageEditorProvider>()
|
||||||
|
.updateSomeTextViewIsAlreadyEditing(false);
|
||||||
|
if (widget.onUpdate != null) {
|
||||||
|
widget.onUpdate!();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
double maxBottomInset = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (widget.layerData.isDeleted) return Container();
|
if (widget.layerData.isDeleted) return Container();
|
||||||
|
|
@ -69,6 +90,16 @@ class _TextViewState extends State<TextLayer> {
|
||||||
final bottom = MediaQuery.of(context).viewInsets.bottom +
|
final bottom = MediaQuery.of(context).viewInsets.bottom +
|
||||||
MediaQuery.of(context).viewPadding.bottom;
|
MediaQuery.of(context).viewPadding.bottom;
|
||||||
|
|
||||||
|
if (maxBottomInset > bottom) {
|
||||||
|
maxBottomInset = 0;
|
||||||
|
if (widget.layerData.isEditing) {
|
||||||
|
widget.layerData.isEditing = false;
|
||||||
|
onEditionComplete();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
maxBottomInset = bottom;
|
||||||
|
}
|
||||||
|
|
||||||
if (widget.layerData.isEditing) {
|
if (widget.layerData.isEditing) {
|
||||||
return Positioned(
|
return Positioned(
|
||||||
bottom: bottom - localBottom,
|
bottom: bottom - localBottom,
|
||||||
|
|
@ -83,20 +114,7 @@ class _TextViewState extends State<TextLayer> {
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
minLines: 1,
|
minLines: 1,
|
||||||
onEditingComplete: () async {
|
onEditingComplete: onEditionComplete,
|
||||||
setState(() {
|
|
||||||
widget.layerData.isDeleted = textController.text == '';
|
|
||||||
widget.layerData.isEditing = false;
|
|
||||||
widget.layerData.text = textController.text;
|
|
||||||
});
|
|
||||||
|
|
||||||
await context
|
|
||||||
.read<ImageEditorProvider>()
|
|
||||||
.updateSomeTextViewIsAlreadyEditing(false);
|
|
||||||
if (widget.onUpdate != null) {
|
|
||||||
widget.onUpdate!();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onTapOutside: (a) async {
|
onTapOutside: (a) async {
|
||||||
widget.layerData.text = textController.text;
|
widget.layerData.text = textController.text;
|
||||||
Future.delayed(const Duration(milliseconds: 100), () async {
|
Future.delayed(const Duration(milliseconds: 100), () async {
|
||||||
|
|
|
||||||
|
|
@ -477,6 +477,7 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
child: MediaViewSizing(
|
child: MediaViewSizing(
|
||||||
|
requiredHeight: 90,
|
||||||
bottomNavigation: ColoredBox(
|
bottomNavigation: ColoredBox(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,10 @@ class _MediaViewSizingState extends State<MediaViewSizing> {
|
||||||
if (widget.bottomNavigation != null) {
|
if (widget.bottomNavigation != null) {
|
||||||
if (needToDownSizeImage) {
|
if (needToDownSizeImage) {
|
||||||
imageChild = Expanded(child: imageChild);
|
imageChild = Expanded(child: imageChild);
|
||||||
bottomNavigation = widget.bottomNavigation!;
|
bottomNavigation = SizedBox(
|
||||||
|
height: widget.requiredHeight,
|
||||||
|
child: widget.bottomNavigation,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
bottomNavigation = Expanded(child: widget.bottomNavigation!);
|
bottomNavigation = Expanded(child: widget.bottomNavigation!);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue