In the TextField widget, there is a property called obscureText
, which will make the letters into a dot. But you can override the character to show an asterisk.
obscureText: true,
obscuringCharacter: '*',
So In your case you need to add the obscuringCharacter here:
class PINNumber extends StatelessWidget {
final TextEditingController textEditingController;
final OutlineInputBorder outlineInputBorder;
const PINNumber(
{Key key, this.textEditingController, this.outlineInputBorder})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: 50.0,
child: TextFormField(
controller: textEditingController,
enabled: false,
obscuringCharacter: '*', //added obscuringCharacter here
obscureText: true,
textAlign: TextAlign.center,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(16.0),
border: outlineInputBorder,
filled: true,
fillColor: Colors.white30,
),
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 21.0,
color: Colors.black,
),
),
);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…