tags work
This commit is contained in:
parent
7e6de0aa38
commit
b1a8b932b9
@ -396,27 +396,95 @@ class _UpdateeventImageState extends State<UpdateeventImage>
|
||||
),
|
||||
TextFieldTags<String>(
|
||||
textfieldTagsController: _stringTagController,
|
||||
initialTags: ['python', 'java'],
|
||||
initialTags: [],
|
||||
textSeparators: const [' ', ','],
|
||||
validator: (String tag) {
|
||||
if (tag == 'php') {
|
||||
return 'Php not allowed';
|
||||
if (_stringTagController.getTags!.contains(tag)) {
|
||||
return 'Tu as deja rentre ce tag';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
inputFieldBuilder: (context, inputFieldValues) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||
child: TextField(
|
||||
controller: inputFieldValues.textEditingController,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Tags evenement',
|
||||
hintText:
|
||||
'Cliquez ici pour ajouter ou supprimer des tags'),
|
||||
focusNode: inputFieldValues.focusNode,
|
||||
));
|
||||
padding: const EdgeInsets.only(
|
||||
left: 15.0, right: 15.0, top: 15, bottom: 0),
|
||||
child: TextField(
|
||||
controller: inputFieldValues.textEditingController,
|
||||
focusNode: inputFieldValues.focusNode,
|
||||
onChanged: inputFieldValues.onTagChanged,
|
||||
onSubmitted: inputFieldValues.onTagSubmitted,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Tags evenement',
|
||||
hintText: inputFieldValues.tags.isNotEmpty
|
||||
? ''
|
||||
: "Enter tag...",
|
||||
errorText: inputFieldValues.error,
|
||||
prefixIcon: inputFieldValues.tags.isNotEmpty
|
||||
? SingleChildScrollView(
|
||||
controller:
|
||||
inputFieldValues.tagScrollController,
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 8,
|
||||
bottom: 8,
|
||||
left: 8,
|
||||
),
|
||||
child: Wrap(
|
||||
runSpacing: 4.0,
|
||||
spacing: 4.0,
|
||||
children: inputFieldValues.tags
|
||||
.map((String tag) {
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(20.0),
|
||||
),
|
||||
color: Colors.blue,
|
||||
),
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 5.0),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10.0, vertical: 5.0),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
InkWell(
|
||||
child: Text(
|
||||
'#$tag',
|
||||
style: const TextStyle(
|
||||
color: Colors.white),
|
||||
),
|
||||
onTap: () {
|
||||
//print("$tag selected");
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 4.0),
|
||||
InkWell(
|
||||
child: const Icon(
|
||||
Icons.cancel,
|
||||
size: 14.0,
|
||||
color: Color.fromARGB(
|
||||
255, 233, 233, 233),
|
||||
),
|
||||
onTap: () {
|
||||
inputFieldValues
|
||||
.onTagRemoved(tag);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList()),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
|
Loading…
x
Reference in New Issue
Block a user