@@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
22
33/// 带图标的输入框
44class 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.
2224class _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