Small fix

This commit is contained in:
Juan Gilsanz Polo 2023-04-15 02:06:33 +02:00
parent d152293594
commit 743d6358d5

View file

@ -36,6 +36,8 @@ class _ClientScreenState extends State<ClientScreen> {
final Uuid uuid = const Uuid();
bool editMode = true;
bool validValues = false;
TextEditingController nameController = TextEditingController();
List<String> selectedTags = [];
@ -68,16 +70,16 @@ class _ClientScreenState extends State<ClientScreen> {
List<Map<dynamic, dynamic>> upstreamServers = [];
bool checkValidValues() {
void checkValidValues() {
if (
nameController.text != '' &&
identifiersControllers.isNotEmpty &&
identifiersControllers[0]['controller'].text != ''
) {
return true;
setState(() => validValues = true);
}
else {
return false;
setState(() => validValues = false);
}
}
@ -94,6 +96,8 @@ class _ClientScreenState extends State<ClientScreen> {
if (widget.client != null) {
editMode = false;
validValues = true;
nameController.text = widget.client!.name;
selectedTags = widget.client!.tags;
identifiersControllers = widget.client!.ids.map((e) => {
@ -308,7 +312,7 @@ class _ClientScreenState extends State<ClientScreen> {
),
actions: [
if (widget.client == null || (widget.client != null && editMode == true)) IconButton(
onPressed: checkValidValues() == true
onPressed: validValues == true
? () {
createClient();
Navigator.pop(context);