fix: disable onChanged for read-only auth fields

This commit is contained in:
Udhay-Adithya
2025-07-07 22:32:14 +05:30
parent 38d8e8e76b
commit 127b2c1efc
3 changed files with 40 additions and 32 deletions

View File

@@ -55,14 +55,16 @@ class _ApiKeyAuthFieldsState extends State<ApiKeyAuthFields> {
],
tooltip: "Select where to add API key",
isOutlined: true,
onChanged: (String? newLocation) {
if (newLocation != null) {
setState(() {
_addKeyTo = newLocation;
});
_updateApiKeyAuth();
}
},
onChanged: widget.readOnly
? null
: (String? newLocation) {
if (newLocation != null) {
setState(() {
_addKeyTo = newLocation;
});
_updateApiKeyAuth();
}
},
),
const SizedBox(height: 16),
AuthTextField(

View File

@@ -102,14 +102,16 @@ class _DigestAuthFieldsState extends State<DigestAuthFields> {
],
tooltip: "Algorithm that will be used to produce the digest",
isOutlined: true,
onChanged: (String? newLocation) {
if (newLocation != null) {
setState(() {
_algorithmController = newLocation;
});
_updateDigestAuth();
}
},
onChanged: widget.readOnly
? null
: (String? newLocation) {
if (newLocation != null) {
setState(() {
_algorithmController = newLocation;
});
_updateDigestAuth();
}
},
),
const SizedBox(height: 12),
AuthTextField(

View File

@@ -61,14 +61,16 @@ class _JwtAuthFieldsState extends State<JwtAuthFields> {
],
tooltip: "Select where to add JWT token",
isOutlined: true,
onChanged: (String? newAddTokenTo) {
if (newAddTokenTo != null) {
setState(() {
_addTokenTo = newAddTokenTo;
});
_updateJwtAuth();
}
},
onChanged: widget.readOnly
? null
: (String? newAddTokenTo) {
if (newAddTokenTo != null) {
setState(() {
_addTokenTo = newAddTokenTo;
});
_updateJwtAuth();
}
},
),
const SizedBox(height: 16),
Text(
@@ -99,14 +101,16 @@ class _JwtAuthFieldsState extends State<JwtAuthFields> {
],
tooltip: "Select JWT algorithm",
isOutlined: true,
onChanged: (String? newAlgorithm) {
if (newAlgorithm != null) {
setState(() {
_algorithm = newAlgorithm;
});
_updateJwtAuth();
}
},
onChanged: widget.readOnly
? null
: (String? newAlgorithm) {
if (newAlgorithm != null) {
setState(() {
_algorithm = newAlgorithm;
});
_updateJwtAuth();
}
},
),
const SizedBox(height: 16),
if (_algorithm.startsWith('HS')) ...[