mirror of
https://github.com/foss42/apidash.git
synced 2025-12-01 18:28:25 +08:00
feat: add readOnly and obscureText properties to EnvironmentTriggerField
This commit is contained in:
@@ -17,6 +17,8 @@ class EnvironmentTriggerField extends StatefulWidget {
|
|||||||
this.decoration,
|
this.decoration,
|
||||||
this.optionsWidthFactor,
|
this.optionsWidthFactor,
|
||||||
this.autocompleteNoTrigger,
|
this.autocompleteNoTrigger,
|
||||||
|
this.readOnly = false,
|
||||||
|
this.obscureText = false
|
||||||
}) : assert(
|
}) : assert(
|
||||||
!(controller != null && initialValue != null),
|
!(controller != null && initialValue != null),
|
||||||
'controller and initialValue cannot be simultaneously defined.',
|
'controller and initialValue cannot be simultaneously defined.',
|
||||||
@@ -32,6 +34,8 @@ class EnvironmentTriggerField extends StatefulWidget {
|
|||||||
final InputDecoration? decoration;
|
final InputDecoration? decoration;
|
||||||
final double? optionsWidthFactor;
|
final double? optionsWidthFactor;
|
||||||
final AutocompleteNoTrigger? autocompleteNoTrigger;
|
final AutocompleteNoTrigger? autocompleteNoTrigger;
|
||||||
|
final bool readOnly;
|
||||||
|
final bool obscureText;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<EnvironmentTriggerField> createState() =>
|
State<EnvironmentTriggerField> createState() =>
|
||||||
@@ -125,6 +129,9 @@ class EnvironmentTriggerFieldState extends State<EnvironmentTriggerField> {
|
|||||||
onTapOutside: (event) {
|
onTapOutside: (event) {
|
||||||
_focusNode.unfocus();
|
_focusNode.unfocus();
|
||||||
},
|
},
|
||||||
|
readOnly: widget.readOnly,
|
||||||
|
obscureText: widget.obscureText
|
||||||
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -58,8 +58,11 @@ class _AuthFieldState extends State<EnvAuthField> {
|
|||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
EnvironmentTriggerField(
|
EnvironmentTriggerField(
|
||||||
keyId: "auth-${widget.title ?? widget.hintText}-${Random.secure()}",
|
keyId: "auth-${widget.title ?? widget.hintText}-${Random.secure()}",
|
||||||
onChanged: widget.readOnly ? null : widget.onChanged,
|
onChanged: widget.onChanged,
|
||||||
initialValue: widget.initialValue,
|
initialValue: widget.initialValue,
|
||||||
|
readOnly: widget.readOnly,
|
||||||
|
// TODO: Needs some new implementation
|
||||||
|
// obscureText: widget.isObscureText,
|
||||||
style: kCodeStyle.copyWith(
|
style: kCodeStyle.copyWith(
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
fontSize: Theme.of(context).textTheme.bodyMedium?.fontSize,
|
fontSize: Theme.of(context).textTheme.bodyMedium?.fontSize,
|
||||||
|
|||||||
Reference in New Issue
Block a user