ListTile(
leading: Icon(FontAwesomeIcons.qrcode,
size: 50),
title: Text(record.hes, style: (
TextStyle(
fontSize: 30,
color: Color(0xFF545F61),
)
),),
subtitle: Text(record.name + " " + record.sname, style: (
TextStyle(
fontSize: 20,
color: Color(0xFF545F61),
)
),),
onTap: () => print(record.tc),
),
我有一个像这样的listTile。当我显示姓名和姓氏时,我想隐藏在前2个字符之后。喜欢的名字:"mi**"和sname: "ly***"名称:"mike"和sname:"lynch"注意:我从firebase获取这些记录。
也许你可以试试这个
record.name.replaceRange(2, record.name.length, "*" * (record.name.length - 2))
// or
record.sname.replaceRange(2, record.sname.length, "*" * (record.sname.length - 2))
try this
int visibleCharacters = 2;
var hiddenName = record.name.substring(0, visibleCharacters) +
('*' * (record.name.length - visibleCharacters));
var hiddenSurname = record.sname.substring(0, visibleCharacters) +
('*' * (record.sname.length - visibleCharacters));