|
|
|
@ -108,6 +108,13 @@ class TextLine extends StatelessWidget { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Color _hexStringToColor(String s) { |
|
|
|
|
switch (s.toLowerCase()) { |
|
|
|
|
case 'transparent': |
|
|
|
|
return Colors.transparent; |
|
|
|
|
case 'black': |
|
|
|
|
return Colors.black; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (s.startsWith('rgba')) { |
|
|
|
|
s = s.substring(5); // trim left 'rgba(' |
|
|
|
|
s = s.substring(0, s.length - 1); // trim right ')' |
|
|
|
@ -115,9 +122,7 @@ class TextLine extends StatelessWidget { |
|
|
|
|
return Color.fromRGBO(int.parse(arr[0]), int.parse(arr[1]), |
|
|
|
|
int.parse(arr[2]), double.parse(arr[3])); |
|
|
|
|
} |
|
|
|
|
if (s == 'transparent') { |
|
|
|
|
return Colors.transparent; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String hex = s.replaceFirst('#', ''); |
|
|
|
|
hex = hex.length == 6 ? 'ff' + hex : hex; |
|
|
|
|
int val = int.parse(hex, radix: 16); |
|
|
|
|