1
1
import 'package:flutter/material.dart' ;
2
2
import 'package:flutter_form_builder/flutter_form_builder.dart' ;
3
3
import 'package:lotti/classes/tag_type_definitions.dart' ;
4
+ import 'package:lotti/features/manual/widget/showcase_text_style.dart' ;
5
+ import 'package:lotti/features/manual/widget/showcase_with_widget.dart' ;
4
6
import 'package:lotti/features/tags/repository/tags_repository.dart' ;
5
7
import 'package:lotti/get_it.dart' ;
6
8
import 'package:lotti/l10n/app_localizations_context.dart' ;
@@ -14,6 +16,7 @@ import 'package:lotti/widgets/app_bar/title_app_bar.dart';
14
16
import 'package:lotti/widgets/settings/entity_detail_card.dart' ;
15
17
import 'package:lotti/widgets/settings/form/form_switch.dart' ;
16
18
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart' ;
19
+ import 'package:showcaseview/showcaseview.dart' ;
17
20
18
21
class TagEditPage extends StatefulWidget {
19
22
const TagEditPage ({
@@ -32,6 +35,11 @@ class TagEditPage extends StatefulWidget {
32
35
}
33
36
34
37
class _TagEditPageState extends State <TagEditPage > {
38
+ final _tagNameKey = GlobalKey ();
39
+ final _tagPrivateKey = GlobalKey ();
40
+ final _tagHideKey = GlobalKey ();
41
+ final _tagTypeTagKey = GlobalKey ();
42
+ final _tagDeleteKey = GlobalKey ();
35
43
final PersistenceLogic persistenceLogic = getIt <PersistenceLogic >();
36
44
final _formKey = GlobalKey <FormBuilderState >();
37
45
bool dirty = false ;
@@ -104,7 +112,9 @@ class _TagEditPageState extends State<TagEditPage> {
104
112
);
105
113
}
106
114
107
- await TagsRepository .upsertTagEntity (newTagEntity);
115
+ await TagsRepository .upsertTagEntity (
116
+ newTagEntity,
117
+ );
108
118
maybePop ();
109
119
110
120
setState (() {
@@ -117,18 +127,42 @@ class _TagEditPageState extends State<TagEditPage> {
117
127
final errorColor = context.colorScheme.error;
118
128
119
129
return Scaffold (
120
- appBar: TitleAppBar (
121
- title: '' ,
130
+ appBar: TitleWidgetAppBar (
131
+ title: Row (
132
+ children: [
133
+ const Text (
134
+ 'Tags Definition' ,
135
+ ),
136
+ IconButton (
137
+ onPressed: () {
138
+ ShowCaseWidget .of (context).startShowCase ([
139
+ _tagNameKey,
140
+ _tagPrivateKey,
141
+ _tagHideKey,
142
+ _tagTypeTagKey,
143
+ _tagDeleteKey,
144
+ ]);
145
+ },
146
+ icon: const Icon (
147
+ Icons .info_outline_rounded,
148
+ ),
149
+ ),
150
+ ],
151
+ ),
122
152
actions: [
123
153
if (dirty)
124
154
TextButton (
125
155
key: const Key ('tag_save' ),
126
156
onPressed: onSavePressed,
127
157
child: Padding (
128
- padding: const EdgeInsets .symmetric (horizontal: 12 ),
158
+ padding: const EdgeInsets .symmetric (
159
+ horizontal: 12 ,
160
+ ),
129
161
child: Text (
130
162
context.messages.settingsTagsSaveLabel,
131
- style: saveButtonStyle (Theme .of (context)),
163
+ style: saveButtonStyle (
164
+ Theme .of (context),
165
+ ),
132
166
),
133
167
),
134
168
),
@@ -147,60 +181,96 @@ class _TagEditPageState extends State<TagEditPage> {
147
181
},
148
182
child: Column (
149
183
children: < Widget > [
150
- FormTextField (
151
- initialValue: widget.tagEntity.tag,
152
- labelText: context.messages.settingsTagsTagName,
153
- name: 'tag' ,
154
- key: const Key ('tag_name_field' ),
155
- large: true ,
184
+ ShowcaseWithWidget (
185
+ showcaseKey: _tagNameKey,
186
+ startNav: true ,
187
+ description: ShowcaseTextStyle (
188
+ descriptionText:
189
+ context.messages.settingsTagsShowCaseNameTooltip,
190
+ ),
191
+ child: FormTextField (
192
+ initialValue: widget.tagEntity.tag,
193
+ labelText: context.messages.settingsTagsTagName,
194
+ name: 'tag' ,
195
+ key: const Key ('tag_name_field' ),
196
+ large: true ,
197
+ ),
156
198
),
157
199
inputSpacer,
158
- FormSwitch (
159
- name: 'private' ,
160
- initialValue: widget.tagEntity.private,
161
- title: context.messages.settingsTagsPrivateLabel,
162
- activeColor: errorColor,
163
- ),
164
- FormSwitch (
165
- name: 'inactive' ,
166
- initialValue: widget.tagEntity.inactive,
167
- title: context.messages.settingsTagsHideLabel,
168
- activeColor: errorColor,
200
+ ShowcaseWithWidget (
201
+ showcaseKey: _tagPrivateKey,
202
+ description: ShowcaseTextStyle (
203
+ descriptionText:
204
+ context.messages.settingsTagsShowCasePrivateTooltip,
205
+ ),
206
+ child: FormSwitch (
207
+ name: 'private' ,
208
+ initialValue: widget.tagEntity.private,
209
+ title: context.messages.settingsTagsPrivateLabel,
210
+ activeColor: errorColor,
211
+ ),
169
212
),
170
- inputSpacer,
171
- FormBuilderChoiceChip <String >(
172
- name: 'type' ,
173
- initialValue: widget.tagEntity.map (
174
- genericTag: (_) => context.messages.settingsTagsTypeTag,
175
- personTag: (_) => context.messages.settingsTagsTypePerson,
176
- storyTag: (_) =>
177
- context.messages.settingsTagsTypeStory, // 'STORY',
213
+ ShowcaseWithWidget (
214
+ showcaseKey: _tagHideKey,
215
+ description: ShowcaseTextStyle (
216
+ descriptionText:
217
+ context.messages.settingsTagsShowCaseHideTooltip,
178
218
),
179
- decoration: inputDecoration (
180
- labelText: context.messages.settingsTagsTypeLabel,
181
- themeData: Theme .of (context),
219
+ child: FormSwitch (
220
+ name: 'inactive' ,
221
+ initialValue: widget.tagEntity.inactive,
222
+ title: context.messages.settingsTagsHideLabel,
223
+ activeColor: errorColor,
182
224
),
183
- selectedColor: widget.tagEntity.map (
184
- genericTag: getTagColor,
185
- personTag: getTagColor,
186
- storyTag: getTagColor,
225
+ ),
226
+ inputSpacer,
227
+ ShowcaseWithWidget (
228
+ showcaseKey: _tagTypeTagKey,
229
+ description: ShowcaseTextStyle (
230
+ descriptionText:
231
+ context.messages.settingsTagsShowCaseTypeTooltip,
187
232
),
188
- runSpacing: 4 ,
189
- spacing: 4 ,
190
- options: [
191
- FormBuilderChipOption <String >(
192
- value: 'TAG' ,
193
- child: Text (context.messages.settingsTagsTypeTag),
233
+ child: FormBuilderChoiceChip <String >(
234
+ name: 'type' ,
235
+ initialValue: widget.tagEntity.map (
236
+ genericTag: (_) => context.messages.settingsTagsTypeTag,
237
+ personTag: (_) =>
238
+ context.messages.settingsTagsTypePerson,
239
+ storyTag: (_) =>
240
+ context.messages.settingsTagsTypeStory, // 'STORY',
194
241
),
195
- FormBuilderChipOption < String > (
196
- value : 'PERSON' ,
197
- child : Text (context.messages.settingsTagsTypePerson ),
242
+ decoration : inputDecoration (
243
+ labelText : context.messages.settingsTagsTypeLabel ,
244
+ themeData : Theme . of (context),
198
245
),
199
- FormBuilderChipOption <String >(
200
- value: 'STORY' ,
201
- child: Text (context.messages.settingsTagsTypeStory),
246
+ selectedColor: widget.tagEntity.map (
247
+ genericTag: getTagColor,
248
+ personTag: getTagColor,
249
+ storyTag: getTagColor,
202
250
),
203
- ],
251
+ runSpacing: 4 ,
252
+ spacing: 4 ,
253
+ options: [
254
+ FormBuilderChipOption <String >(
255
+ value: 'TAG' ,
256
+ child: Text (
257
+ context.messages.settingsTagsTypeTag,
258
+ ),
259
+ ),
260
+ FormBuilderChipOption <String >(
261
+ value: 'PERSON' ,
262
+ child: Text (
263
+ context.messages.settingsTagsTypePerson,
264
+ ),
265
+ ),
266
+ FormBuilderChipOption <String >(
267
+ value: 'STORY' ,
268
+ child: Text (
269
+ context.messages.settingsTagsTypeStory,
270
+ ),
271
+ ),
272
+ ],
273
+ ),
204
274
),
205
275
],
206
276
),
@@ -211,19 +281,29 @@ class _TagEditPageState extends State<TagEditPage> {
211
281
mainAxisAlignment: MainAxisAlignment .spaceBetween,
212
282
children: [
213
283
const Spacer (),
214
- IconButton (
215
- icon: Icon (MdiIcons .trashCanOutline),
216
- iconSize: 24 ,
217
- tooltip: context.messages.settingsTagsDeleteTooltip,
218
- color: context.colorScheme.outline,
219
- onPressed: () {
220
- TagsRepository .upsertTagEntity (
221
- widget.tagEntity.copyWith (
222
- deletedAt: DateTime .now (),
223
- ),
224
- );
225
- Navigator .of (context).maybePop ();
226
- },
284
+ ShowcaseWithWidget (
285
+ showcaseKey: _tagDeleteKey,
286
+ endNav: true ,
287
+ description: ShowcaseTextStyle (
288
+ descriptionText:
289
+ context.messages.settingsTagsShowCaseDeleteTooltip,
290
+ ),
291
+ child: IconButton (
292
+ icon: Icon (
293
+ MdiIcons .trashCanOutline,
294
+ ),
295
+ iconSize: 24 ,
296
+ tooltip: context.messages.settingsTagsDeleteTooltip,
297
+ color: context.colorScheme.outline,
298
+ onPressed: () {
299
+ TagsRepository .upsertTagEntity (
300
+ widget.tagEntity.copyWith (
301
+ deletedAt: DateTime .now (),
302
+ ),
303
+ );
304
+ Navigator .of (context).maybePop ();
305
+ },
306
+ ),
227
307
),
228
308
],
229
309
),
@@ -252,6 +332,8 @@ class EditExistingTagPage extends StatelessWidget {
252
332
return const EmptyScaffoldWithTitle ('' );
253
333
}
254
334
255
- return TagEditPage (tagEntity: tagEntity);
335
+ return ShowCaseWidget (
336
+ builder: (context) => TagEditPage (tagEntity: tagEntity),
337
+ );
256
338
}
257
339
}
0 commit comments