mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-16 23:12:50 +00:00
Small fix
This commit is contained in:
parent
d152293594
commit
743d6358d5
1 changed files with 8 additions and 4 deletions
|
@ -36,6 +36,8 @@ class _ClientScreenState extends State<ClientScreen> {
|
||||||
final Uuid uuid = const Uuid();
|
final Uuid uuid = const Uuid();
|
||||||
bool editMode = true;
|
bool editMode = true;
|
||||||
|
|
||||||
|
bool validValues = false;
|
||||||
|
|
||||||
TextEditingController nameController = TextEditingController();
|
TextEditingController nameController = TextEditingController();
|
||||||
|
|
||||||
List<String> selectedTags = [];
|
List<String> selectedTags = [];
|
||||||
|
@ -68,16 +70,16 @@ class _ClientScreenState extends State<ClientScreen> {
|
||||||
List<Map<dynamic, dynamic>> upstreamServers = [];
|
List<Map<dynamic, dynamic>> upstreamServers = [];
|
||||||
|
|
||||||
|
|
||||||
bool checkValidValues() {
|
void checkValidValues() {
|
||||||
if (
|
if (
|
||||||
nameController.text != '' &&
|
nameController.text != '' &&
|
||||||
identifiersControllers.isNotEmpty &&
|
identifiersControllers.isNotEmpty &&
|
||||||
identifiersControllers[0]['controller'].text != ''
|
identifiersControllers[0]['controller'].text != ''
|
||||||
) {
|
) {
|
||||||
return true;
|
setState(() => validValues = true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
setState(() => validValues = false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +96,8 @@ class _ClientScreenState extends State<ClientScreen> {
|
||||||
if (widget.client != null) {
|
if (widget.client != null) {
|
||||||
editMode = false;
|
editMode = false;
|
||||||
|
|
||||||
|
validValues = true;
|
||||||
|
|
||||||
nameController.text = widget.client!.name;
|
nameController.text = widget.client!.name;
|
||||||
selectedTags = widget.client!.tags;
|
selectedTags = widget.client!.tags;
|
||||||
identifiersControllers = widget.client!.ids.map((e) => {
|
identifiersControllers = widget.client!.ids.map((e) => {
|
||||||
|
@ -308,7 +312,7 @@ class _ClientScreenState extends State<ClientScreen> {
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
if (widget.client == null || (widget.client != null && editMode == true)) IconButton(
|
if (widget.client == null || (widget.client != null && editMode == true)) IconButton(
|
||||||
onPressed: checkValidValues() == true
|
onPressed: validValues == true
|
||||||
? () {
|
? () {
|
||||||
createClient();
|
createClient();
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue