v0.0.1
color_hex
Flutter 套件,用於將十六進制字串轉換為 Color(),以及將 Color() 轉換為十六進制字串
6喜歡 638近 30 天下載140Pub 分數
AndroidiOSWebmacOSWindowsLinux
Flutter 套件,用於將十六進制字串轉換為 Color(),以及將 Color() 轉換為十六進制字串
{"sdk":"flutter"}{"sdk":"flutter"}^2.0.0以下為英文專案原文快照,最新內容請造訪 GitHub。
Nasr Al-Rahbi @abom_me
Twitter Instagram LinkedIn Stack Overflow
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
),)
)