Skip to content

Commit b02e77e

Browse files
committed
hint password
1 parent 0d72126 commit b02e77e

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎lib/page/LoginPage.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class _LoginPageState extends State<LoginPage> {
6767
new GSYInputWidget(
6868
hintText: GSYStrings.login_password_hint_text,
6969
iconData: Icons.access_alarm,
70+
obscureText: true,
7071
onChanged: (String value) {
7172
_password = value;
7273
},

‎lib/widget/GSYInputWidget.dart‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
22

33
/// 带图标的输入框
44
class GSYInputWidget extends StatefulWidget {
5+
final bool obscureText;
6+
57
final String hintText;
68

79
final IconData iconData;
@@ -12,14 +14,16 @@ class GSYInputWidget extends StatefulWidget {
1214

1315
final TextEditingController controller;
1416

15-
GSYInputWidget({Key key, this.hintText, this.iconData, this.onChanged, this.textStyle, this.controller}) : super(key: key);
17+
GSYInputWidget({Key key, this.hintText, this.iconData, this.onChanged, this.textStyle, this.controller, this.obscureText = false}) : super(key: key);
1618

1719
@override
18-
_GSYInputWidgetState createState() => new _GSYInputWidgetState(hintText, iconData, onChanged, textStyle, controller);
20+
_GSYInputWidgetState createState() => new _GSYInputWidgetState(hintText, iconData, onChanged, textStyle, controller, obscureText);
1921
}
2022

2123
/// State for [GSYInputWidget] widgets.
2224
class _GSYInputWidgetState extends State<GSYInputWidget> {
25+
final bool obscureText;
26+
2327
final String hintText;
2428

2529
final IconData iconData;
@@ -30,13 +34,14 @@ class _GSYInputWidgetState extends State<GSYInputWidget> {
3034

3135
final TextEditingController controller;
3236

33-
_GSYInputWidgetState(this.hintText, this.iconData, this.onChanged, this.textStyle, this.controller) : super();
37+
_GSYInputWidgetState(this.hintText, this.iconData, this.onChanged, this.textStyle, this.controller, this.obscureText) : super();
3438

3539
@override
3640
Widget build(BuildContext context) {
3741
return new TextField(
3842
controller: controller,
3943
onChanged: onChanged,
44+
obscureText: obscureText,
4045
decoration: new InputDecoration(
4146
hintText: hintText,
4247
icon: new Icon(iconData),

0 commit comments

Comments
 (0)