@@ -118,7 +118,6 @@ class _MyHomePageState extends State<MyHomePage> {
118
118
controller: _passwordController,
119
119
maxLength: 20 ,
120
120
obscureText: ! _visible,
121
- style: const TextStyle (fontStyle: FontStyle .italic),
122
121
obscuringCharacter: '*' ,
123
122
decoration: InputDecoration (
124
123
prefixIcon: const Icon (Icons .lock),
@@ -127,7 +126,6 @@ class _MyHomePageState extends State<MyHomePage> {
127
126
helperText: helperText,
128
127
border: const UnderlineInputBorder (),
129
128
suffixIcon: visibilityIcon,
130
- hintStyle: const TextStyle (fontStyle: FontStyle .normal),
131
129
),
132
130
);
133
131
},
@@ -168,6 +166,30 @@ class _MyHomePageState extends State<MyHomePage> {
168
166
},
169
167
);
170
168
169
+ final Widget displayNameText = Text .rich (
170
+ TextSpan (
171
+ children: < InlineSpan > [
172
+ const TextSpan (text: '用户名:' ),
173
+ TextSpan (
174
+ text: _usernameController.text.isEmpty ? '未填写' : _usernameController.text,
175
+ style: const TextStyle (decoration: TextDecoration .underline),
176
+ ),
177
+ ],
178
+ ),
179
+ );
180
+
181
+ final Widget displayPasswordText = Text .rich (
182
+ TextSpan (
183
+ children: < InlineSpan > [
184
+ const TextSpan (text: '密码:' ),
185
+ TextSpan (
186
+ text: _passwordController.text.isEmpty ? '未填写' : _passwordController.text,
187
+ style: const TextStyle (fontStyle: FontStyle .italic),
188
+ ),
189
+ ],
190
+ ),
191
+ );
192
+
171
193
return Scaffold (
172
194
appBar: AppBar (title: Text (widget.title)),
173
195
body: Center (
@@ -177,6 +199,9 @@ class _MyHomePageState extends State<MyHomePage> {
177
199
usernameField,
178
200
passwordField,
179
201
loginButton,
202
+ const SizedBox (height: 20 ),
203
+ displayNameText,
204
+ displayPasswordText,
180
205
],
181
206
),
182
207
),
0 commit comments