mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 09:28: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(
|
||||
child: MediaViewSizing(
|
||||
requiredHeight: 90,
|
||||
bottomNavigation: Container(),
|
||||
child: Screenshot(
|
||||
controller: screenshotController,
|
||||
child: AspectRatio(
|
||||
|
|
@ -58,6 +60,8 @@ class SendToCameraPreview extends StatelessWidget {
|
|||
}
|
||||
return Positioned.fill(
|
||||
child: MediaViewSizing(
|
||||
requiredHeight: 90,
|
||||
bottomNavigation: Container(),
|
||||
child: Screenshot(
|
||||
controller: screenshotController,
|
||||
child: AspectRatio(
|
||||
|
|
|
|||
|
|
@ -590,6 +590,8 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
|||
return Container();
|
||||
}
|
||||
return MediaViewSizing(
|
||||
requiredHeight: 90,
|
||||
bottomNavigation: Container(),
|
||||
child: GestureDetector(
|
||||
onPanStart: (details) async {
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
if (widget.layerData.isDeleted) return Container();
|
||||
|
|
@ -69,6 +90,16 @@ class _TextViewState extends State<TextLayer> {
|
|||
final bottom = MediaQuery.of(context).viewInsets.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) {
|
||||
return Positioned(
|
||||
bottom: bottom - localBottom,
|
||||
|
|
@ -83,20 +114,7 @@ class _TextViewState extends State<TextLayer> {
|
|||
autofocus: true,
|
||||
maxLines: null,
|
||||
minLines: 1,
|
||||
onEditingComplete: () async {
|
||||
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!();
|
||||
}
|
||||
},
|
||||
onEditingComplete: onEditionComplete,
|
||||
onTapOutside: (a) async {
|
||||
widget.layerData.text = textController.text;
|
||||
Future.delayed(const Duration(milliseconds: 100), () async {
|
||||
|
|
|
|||
|
|
@ -477,6 +477,7 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
setState(() {});
|
||||
},
|
||||
child: MediaViewSizing(
|
||||
requiredHeight: 90,
|
||||
bottomNavigation: ColoredBox(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Row(
|
||||
|
|
|
|||
|
|
@ -58,7 +58,10 @@ class _MediaViewSizingState extends State<MediaViewSizing> {
|
|||
if (widget.bottomNavigation != null) {
|
||||
if (needToDownSizeImage) {
|
||||
imageChild = Expanded(child: imageChild);
|
||||
bottomNavigation = widget.bottomNavigation!;
|
||||
bottomNavigation = SizedBox(
|
||||
height: widget.requiredHeight,
|
||||
child: widget.bottomNavigation,
|
||||
);
|
||||
} else {
|
||||
bottomNavigation = Expanded(child: widget.bottomNavigation!);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue