File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ class Input with Tools implements Component<String> {
15
15
final String answer;
16
16
final String ? placeholder;
17
17
final bool secure;
18
+ final bool hidden;
18
19
late final List <Sequence > exitMessage;
19
20
String value = '' ;
20
21
String ? errorMessage;
@@ -31,6 +32,7 @@ class Input with Tools implements Component<String> {
31
32
required this .answer,
32
33
this .placeholder,
33
34
this .secure = false ,
35
+ this .hidden = false ,
34
36
Result Function (String value)? validate,
35
37
List <Sequence >? exitMessage,
36
38
}) {
@@ -120,8 +122,11 @@ class Input with Tools implements Component<String> {
120
122
}
121
123
}
122
124
123
- String generateValue () =>
124
- secure ? value.replaceAll (RegExp (r'.' ), '*' ) : value;
125
+ String generateValue () => secure
126
+ ? value.replaceAll (RegExp (r'.' ), '*' )
127
+ : ! hidden
128
+ ? value
129
+ : '' ;
125
130
126
131
void render () async {
127
132
final buffer = StringBuffer ();
@@ -131,9 +136,8 @@ class Input with Tools implements Component<String> {
131
136
SetStyles .reset,
132
137
Print (' $answer ' ),
133
138
SetStyles (Style .foreground (Color .brightBlack)),
134
- Print (value.isEmpty && errorMessage == null
135
- ? placeholder ?? generateValue ()
136
- : generateValue ()),
139
+ Print (
140
+ value.isEmpty && errorMessage == null ? placeholder ?? generateValue () : generateValue ()),
137
141
SetStyles .reset,
138
142
]);
139
143
You can’t perform that action at this time.
0 commit comments