【问题标题】:How to convert Color to a list of RGB values in Dart & Flutter?如何将颜色转换为 Dart & Flutter 中的 RGB 值列表?
【发布时间】:2019-12-28 17:23:39
【问题描述】:

我希望能够获取 Color 并将其转换为 List<int>,例如 [0,255,255]。

我该怎么做?

【问题讨论】:

    标签: flutter dart


    【解决方案1】:
    List<int> getRGB(Color c) {
      return [c.red, c.blue, c.green];
    }
    

    使用

    Color c = Colors.red;
    print(getRGB(c));
    

    【讨论】:

      猜你喜欢
      • 2013-12-10
      • 1970-01-01
      • 1970-01-01
      • 2017-09-11
      • 2010-09-26
      • 2011-08-25
      • 1970-01-01
      • 2019-02-08
      • 2013-06-15
      相关资源
      最近更新 更多