如何在Flutter中编辑重构的图标?

时间:2019-10-03 11:21:43

标签: flutter flutter-layout flutter-dependencies

我无法编辑在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,
),

我正在尝试更改上方图标的颜色,但目前正在阻止这样做。

1 个答案:

答案 0 :(得分:0)

InputDecoration中,添加:

suffixIcon: const Icon(icon, color: Colors.red),