I have found A working solution for Color
part, Here is the code
String stringColor = "Color(0xff000000)";
String valueString =
stringColor.split('(0x')[1].split(')')[0]; // kind of hacky..
print(valueString);
int value = int.parse(valueString, radix: 16);
print(value);
Color otherColor = new Color(value);
print(otherColor);
print(otherColor.runtimeType);
CREDITS
You Can Also use Extension
for the same, As Shown HERE
EDITED:
I have made a workaround solution by using Power of Extension
, Its working perfectly too.
Add this Outside of Your Class
extension AlignExtensions on String {
toAlign() {
if (this.contains("left")) {
return TextAlign.left;
} else if (this.contains("center")) {
return TextAlign.center;
} else if (this.contains("right")) {
return TextAlign.right;
} else if (this.contains("end")) {
return TextAlign.end;
}
}
}
And to use this Extension
Class, Use this line of code
,
textAlign: "TextAlign.right".toAlign(),