mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 13:08:42 +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]
|
/// Attributes used by [TextLayer]
|
||||||
class TextLayerData extends Layer {
|
class TextLayerData extends Layer {
|
||||||
String text;
|
String text;
|
||||||
|
int textLayersBefore;
|
||||||
TextLayerData({
|
TextLayerData({
|
||||||
this.text = "",
|
this.text = "",
|
||||||
|
required this.textLayersBefore,
|
||||||
super.offset,
|
super.offset,
|
||||||
super.opacity,
|
super.opacity,
|
||||||
super.rotation,
|
super.rotation,
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,11 @@ class _TextViewState extends State<TextLayer> {
|
||||||
// Set the initial offset to the center of the screen
|
// Set the initial offset to the center of the screen
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
widget.layerData.offset =
|
widget.layerData.offset = Offset(
|
||||||
Offset(0, MediaQuery.of(context).size.height / 2 - 30);
|
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;
|
if (layers.any((x) => x.isEditing)) return;
|
||||||
undoLayers.clear();
|
undoLayers.clear();
|
||||||
removedLayers.clear();
|
removedLayers.clear();
|
||||||
layers.add(TextLayerData());
|
layers.add(TextLayerData(
|
||||||
|
textLayersBefore: layers.whereType<TextLayerData>().length,
|
||||||
|
));
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
@ -278,7 +280,9 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
||||||
}
|
}
|
||||||
undoLayers.clear();
|
undoLayers.clear();
|
||||||
removedLayers.clear();
|
removedLayers.clear();
|
||||||
layers.add(TextLayerData());
|
layers.add(TextLayerData(
|
||||||
|
textLayersBefore: layers.whereType<TextLayerData>().length,
|
||||||
|
));
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
child: MediaViewSizing(
|
child: MediaViewSizing(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue