mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 18:57:05 +08:00
fix:prevent text field rebuild on watch
This commit is contained in:
@@ -12,13 +12,16 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final selectedRequest = ref.watch(selectedRequestModelProvider);
|
final selectedRequest = ref.read(selectedRequestModelProvider);
|
||||||
|
|
||||||
if (selectedRequest == null) {
|
if (selectedRequest == null) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
final currentAuthType = selectedRequest.authData?.type ?? APIAuthType.none;
|
final currentAuthType = ref.watch(
|
||||||
|
selectedRequestModelProvider
|
||||||
|
.select((request) => request?.authData?.type ?? APIAuthType.none),
|
||||||
|
);
|
||||||
final currentAuthData = selectedRequest.authData;
|
final currentAuthData = selectedRequest.authData;
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
@@ -109,7 +112,7 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onEditingComplete: () => updateAuth(
|
onChanged: (value) => updateAuth(
|
||||||
ApiAuthModel(
|
ApiAuthModel(
|
||||||
type: APIAuthType.basic,
|
type: APIAuthType.basic,
|
||||||
basic: AuthBasicAuthModel(
|
basic: AuthBasicAuthModel(
|
||||||
@@ -145,7 +148,7 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
onEditingComplete: () => updateAuth(
|
onChanged: (value) => updateAuth(
|
||||||
ApiAuthModel(
|
ApiAuthModel(
|
||||||
type: APIAuthType.basic,
|
type: APIAuthType.basic,
|
||||||
basic: AuthBasicAuthModel(
|
basic: AuthBasicAuthModel(
|
||||||
@@ -187,7 +190,7 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onEditingComplete: () => updateAuth(
|
onChanged: (value) => updateAuth(
|
||||||
ApiAuthModel(
|
ApiAuthModel(
|
||||||
type: APIAuthType.bearer,
|
type: APIAuthType.bearer,
|
||||||
bearer: AuthBearerModel(token: tokenController.text.trim()),
|
bearer: AuthBearerModel(token: tokenController.text.trim()),
|
||||||
@@ -275,7 +278,7 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onEditingComplete: () => updateAuth(
|
onChanged: (value) => updateAuth(
|
||||||
ApiAuthModel(
|
ApiAuthModel(
|
||||||
type: APIAuthType.apiKey,
|
type: APIAuthType.apiKey,
|
||||||
apikey: AuthApiKeyModel(
|
apikey: AuthApiKeyModel(
|
||||||
@@ -309,7 +312,7 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onEditingComplete: () => updateAuth(ApiAuthModel(
|
onChanged: (value) => updateAuth(ApiAuthModel(
|
||||||
type: APIAuthType.apiKey,
|
type: APIAuthType.apiKey,
|
||||||
apikey: AuthApiKeyModel(
|
apikey: AuthApiKeyModel(
|
||||||
key: keyController.text.trim(),
|
key: keyController.text.trim(),
|
||||||
@@ -350,7 +353,7 @@ class EditAuthType extends ConsumerWidget {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onEditingComplete: () => updateAuth(ApiAuthModel(
|
onChanged: (value) => updateAuth(ApiAuthModel(
|
||||||
type: APIAuthType.jwt,
|
type: APIAuthType.jwt,
|
||||||
jwt: AuthJwtModel(jwt: jwtController.text.trim()),
|
jwt: AuthJwtModel(jwt: jwtController.text.trim()),
|
||||||
)),
|
)),
|
||||||
|
|||||||
Reference in New Issue
Block a user