|
@@ -140,9 +140,14 @@ class _ToolbarWidgetState extends State<ToolbarWidget> {
|
140
|
140
|
'This is a variable element, the value shown in editor is a placeholder. The actual value will be generated when printing the label.',
|
141
|
141
|
)
|
142
|
142
|
),
|
|
143
|
+ _buildElementRotatorButton(),
|
143
|
144
|
|
144
|
145
|
// ? Font Resizer
|
145
|
|
- _buildFontResizer(element)
|
|
146
|
+ _buildFontResizerWidget(element),
|
|
147
|
+
|
|
148
|
+ _buildElementPositionLockerButton(),
|
|
149
|
+
|
|
150
|
+ _buildElementRemoverButton()
|
146
|
151
|
];
|
147
|
152
|
}
|
148
|
153
|
|
|
@@ -167,67 +172,24 @@ class _ToolbarWidgetState extends State<ToolbarWidget> {
|
167
|
172
|
},
|
168
|
173
|
),
|
169
|
174
|
|
170
|
|
- if (editorProvider.selectedElm!.type != ElementType.qr) ElevatedButton(
|
171
|
|
- onPressed: Provider.of<Editor>(context).rotate,
|
172
|
|
- child: Text('Rotate')
|
173
|
|
- ),
|
|
175
|
+ if (editorProvider.selectedElm!.type != ElementType.qr) _buildElementRotatorButton(),
|
174
|
176
|
|
175
|
177
|
// ? Font Resizer (Only show when selected element is [ElementType.text, ElementType.textbox])
|
176
|
|
- if (Provider.of<Editor>(context).shouldShowFontResizer) _buildFontResizer(element),
|
|
178
|
+ if (Provider.of<Editor>(context).shouldShowFontResizer) _buildFontResizerWidget(element),
|
177
|
179
|
|
178
|
180
|
// ? Qr Resizer (Only show when selected element is ElementType.qr)
|
179
|
|
- if (Provider.of<Editor>(context).shouldShowQrResizer) Row(
|
180
|
|
- children: [
|
181
|
|
- DropdownButton<int>(
|
182
|
|
- value: element?.qrScale,
|
183
|
|
- items: qrSizeDropdownItems,
|
184
|
|
- onChanged: (val) {
|
185
|
|
- print('dropdown value: $val');
|
186
|
|
- Provider.of<Editor>(context, listen: false).changeQrSize(val);
|
187
|
|
- }
|
188
|
|
- ),
|
189
|
|
- IconButton.filled(
|
190
|
|
- onPressed: Provider.of<Editor>(context, listen: false).incrementQrSize,
|
191
|
|
- icon: Icon(Icons.add)
|
192
|
|
- ),
|
193
|
|
- IconButton.filled(
|
194
|
|
- onPressed: Provider.of<Editor>(context, listen: false).decrementQrSize,
|
195
|
|
- icon: Icon(Icons.remove)
|
196
|
|
- ),
|
197
|
|
- ],
|
198
|
|
- ),
|
|
181
|
+ if (Provider.of<Editor>(context).shouldShowQrResizer) _buildQrResizerWidget(element),
|
199
|
182
|
|
200
|
183
|
// ? Lock Element
|
201
|
|
- ElevatedButton(
|
202
|
|
- style: ButtonStyle(
|
203
|
|
- // backgroundColor: WidgetStatePropertyAll(Theme.of(context).colorScheme.errorContainer)
|
204
|
|
- ),
|
205
|
|
- onPressed: () async {
|
206
|
|
- Provider.of<Editor>(context, listen: false).toggleLockElement();
|
207
|
|
- FocusScope.of(context).unfocus();
|
208
|
|
- },
|
209
|
|
- child: Text(
|
210
|
|
- Provider.of<Editor>(context).selectedElm!.isLocked ? 'Unlock Element' : 'Lock Element',
|
211
|
|
- // style: TextStyle(color: Theme.of(context).colorScheme.error),
|
212
|
|
- )
|
213
|
|
- ),
|
|
184
|
+ _buildElementPositionLockerButton(),
|
214
|
185
|
|
215
|
186
|
// ? Delete elm button (only show when type is not ElementType.qr)
|
216
|
|
- if (Provider.of<Editor>(context).shouldShowDeleteElementButton) ElevatedButton(
|
217
|
|
- style: ButtonStyle(
|
218
|
|
- backgroundColor: WidgetStatePropertyAll(Theme.of(context).colorScheme.errorContainer)
|
219
|
|
- ),
|
220
|
|
- onPressed: () async => Provider.of<Editor>(context, listen: false).deleteElement(context),
|
221
|
|
- child: Text(
|
222
|
|
- 'Delete Element',
|
223
|
|
- style: TextStyle(color: Theme.of(context).colorScheme.error),
|
224
|
|
- )
|
225
|
|
- ),
|
|
187
|
+ if (Provider.of<Editor>(context).shouldShowDeleteElementButton) _buildElementRemoverButton()
|
226
|
188
|
];
|
227
|
189
|
}
|
228
|
190
|
|
229
|
191
|
|
230
|
|
- Widget _buildFontResizer(ElementProperty? element) {
|
|
192
|
+ Widget _buildFontResizerWidget(ElementProperty? element) {
|
231
|
193
|
return Row(
|
232
|
194
|
children: [
|
233
|
195
|
DropdownButton<int>(
|
|
@@ -249,4 +211,59 @@ class _ToolbarWidgetState extends State<ToolbarWidget> {
|
249
|
211
|
],
|
250
|
212
|
);
|
251
|
213
|
}
|
|
214
|
+
|
|
215
|
+ Widget _buildQrResizerWidget(ElementProperty? element) {
|
|
216
|
+ return Row(
|
|
217
|
+ children: [
|
|
218
|
+ DropdownButton<int>(
|
|
219
|
+ value: element?.qrScale,
|
|
220
|
+ items: qrSizeDropdownItems,
|
|
221
|
+ onChanged: (val) {
|
|
222
|
+ print('dropdown value: $val');
|
|
223
|
+ Provider.of<Editor>(context, listen: false).changeQrSize(val);
|
|
224
|
+ }
|
|
225
|
+ ),
|
|
226
|
+ IconButton.filled(
|
|
227
|
+ onPressed: Provider.of<Editor>(context, listen: false).incrementQrSize,
|
|
228
|
+ icon: Icon(Icons.add)
|
|
229
|
+ ),
|
|
230
|
+ IconButton.filled(
|
|
231
|
+ onPressed: Provider.of<Editor>(context, listen: false).decrementQrSize,
|
|
232
|
+ icon: Icon(Icons.remove)
|
|
233
|
+ ),
|
|
234
|
+ ],
|
|
235
|
+ );
|
|
236
|
+ }
|
|
237
|
+
|
|
238
|
+ Widget _buildElementRotatorButton() {
|
|
239
|
+ return ElevatedButton(
|
|
240
|
+ onPressed: Provider.of<Editor>(context).rotate,
|
|
241
|
+ child: Text('Rotate')
|
|
242
|
+ );
|
|
243
|
+ }
|
|
244
|
+
|
|
245
|
+ Widget _buildElementRemoverButton() {
|
|
246
|
+ return ElevatedButton(
|
|
247
|
+ style: ButtonStyle(
|
|
248
|
+ backgroundColor: WidgetStatePropertyAll(Theme.of(context).colorScheme.errorContainer)
|
|
249
|
+ ),
|
|
250
|
+ onPressed: () async => Provider.of<Editor>(context, listen: false).deleteElement(context),
|
|
251
|
+ child: Text(
|
|
252
|
+ 'Delete Element',
|
|
253
|
+ style: TextStyle(color: Theme.of(context).colorScheme.error),
|
|
254
|
+ )
|
|
255
|
+ );
|
|
256
|
+ }
|
|
257
|
+
|
|
258
|
+ Widget _buildElementPositionLockerButton() {
|
|
259
|
+ return ElevatedButton(
|
|
260
|
+ onPressed: () async {
|
|
261
|
+ Provider.of<Editor>(context, listen: false).toggleLockElement();
|
|
262
|
+ FocusScope.of(context).unfocus();
|
|
263
|
+ },
|
|
264
|
+ child: Text(
|
|
265
|
+ Provider.of<Editor>(context).selectedElm!.isLocked ? 'Unlock Element' : 'Lock Element',
|
|
266
|
+ )
|
|
267
|
+ );
|
|
268
|
+ }
|
252
|
269
|
}
|