mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-16 06:53:00 +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();
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue