v0.0.1
color_hex
Flutter 包,用于将十六进制字符串转换为 Color(),以及将 Color() 转换为十六进制字符串
6喜欢 766近 30 天下载140Pub 分数
AndroidiOSWebmacOSWindowsLinux
Flutter 包,用于将十六进制字符串转换为 Color(),以及将 Color() 转换为十六进制字符串
以下为英文项目原文快照,最新内容请访问 GitHub。
Nasr Al-Rahbi @abom_me
Pubspec changes:
dependencies:
color_hex: <last_verison>
you can add it to your text or color as extension like this :
Color color=Colors.deepPurple;
String hex="#000000";
/// here we convert the hex to color and the color to hex
Text(color.convertToHex.hex,style: TextStyle(color: hex.convertToColor),),
Another way you can convert it using the function :
Color color=Colors.deepPurple;
String hex="#000000";
InkWell(
onTap: (){
/// Convert HexColor to Color()
print(hexToColor(hex).toString());
/// Convert Color() to HexColor
print(colorToHex(color).hex);
print(colorToHex(color).color);
},
child:Text("click to convert",style: TextStyle(
/// here we convert the color to hex then we convert the hex to color again
color: color.convertToHex.hex!.convertToColor
),)
)
依赖清单 3 项
{"sdk":"flutter"}{"sdk":"flutter"}^2.0.0先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗