mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 09:28:41 +00:00
fix #85
This commit is contained in:
parent
6ec26c089f
commit
8c8445391c
3 changed files with 13 additions and 4 deletions
|
|
@ -53,8 +53,10 @@ class EmojiLayerData extends Layer {
|
|||
/// Attributes used by [TextLayer]
|
||||
class TextLayerData extends Layer {
|
||||
String text;
|
||||
int textLayersBefore;
|
||||
TextLayerData({
|
||||
this.text = "",
|
||||
required this.textLayersBefore,
|
||||
super.offset,
|
||||
super.opacity,
|
||||
super.rotation,
|
||||
|
|
|
|||
|
|
@ -33,8 +33,11 @@ class _TextViewState extends State<TextLayer> {
|
|||
// Set the initial offset to the center of the screen
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
setState(() {
|
||||
widget.layerData.offset =
|
||||
Offset(0, MediaQuery.of(context).size.height / 2 - 30);
|
||||
widget.layerData.offset = Offset(
|
||||
0,
|
||||
MediaQuery.of(context).size.height / 2 -
|
||||
150 +
|
||||
(widget.layerData.textLayersBefore * 40));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,9 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
if (layers.any((x) => x.isEditing)) return;
|
||||
undoLayers.clear();
|
||||
removedLayers.clear();
|
||||
layers.add(TextLayerData());
|
||||
layers.add(TextLayerData(
|
||||
textLayersBefore: layers.whereType<TextLayerData>().length,
|
||||
));
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
|
|
@ -278,7 +280,9 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
}
|
||||
undoLayers.clear();
|
||||
removedLayers.clear();
|
||||
layers.add(TextLayerData());
|
||||
layers.add(TextLayerData(
|
||||
textLayersBefore: layers.whereType<TextLayerData>().length,
|
||||
));
|
||||
setState(() {});
|
||||
},
|
||||
child: MediaViewSizing(
|
||||
|
|
|
|||
Loading…
Reference in a new issue