我无法编辑在flutter中重构的图标小部件。 这是我的代码:
class DetailsInput extends StatelessWidget {
DetailsInput({
this.label,
this.keyboard,
this.icon,
});
final String label;
final TextInputType keyboard;
final IconData icon;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 25.0, right: 25.0),
child: TextField(
keyboardType: keyboard,
cursorColor: Colors.deepPurpleAccent,
decoration: InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.black54),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.deepPurpleAccent),
),
fillColor: Colors.black54,
focusColor: Colors.black54,
hintText: label,
hoverColor: Colors.black54,
hintStyle: kBasicLabelStyle,
),
),
);
这是我放置代码并试图修改其样式的区域:
DetailsInput(
icon: Icons.contact_phone,
keyboard: TextInputType.number,
),
我正在尝试更改上方图标的颜色,但目前正在阻止这样做。
答案 0 :(得分:0)
在InputDecoration
中,添加:
suffixIcon: const Icon(icon, color: Colors.red),