randomColor function

Color randomColor()

随机颜色

Implementation

Color randomColor() {
  Random random = Random();
  int red = random.nextInt(256); // 0-255之间的随机红色值
  int green = random.nextInt(256); // 0-255之间的随机绿色值
  int blue = random.nextInt(256); // 0-255之间的随机蓝色值
  return Color.fromARGB(255, red, green, blue); // 创建Color对象
}