David PHAM-VAN

Change PdfColor.fromInt to const constructor

1 # 1.1.1 1 # 1.1.1
2 * Improve PdfPoint and PdfRect 2 * Improve PdfPoint and PdfRect
  3 +* Change PdfColor.fromInt to const constructor
3 4
4 # 1.1.0 5 # 1.1.0
5 * Rename classes to satisfy Dart conventions 6 * Rename classes to satisfy Dart conventions
@@ -48,10 +48,11 @@ class PdfColor { @@ -48,10 +48,11 @@ class PdfColor {
48 48
49 const PdfColor(this.r, this.g, this.b, [this.a = 1.0]); 49 const PdfColor(this.r, this.g, this.b, [this.a = 1.0]);
50 50
51 - factory PdfColor.fromInt(int color) {  
52 - return PdfColor((color >> 16 & 0xff) / 255.0, (color >> 8 & 0xff) / 255.0,  
53 - (color & 0xff) / 255.0, (color >> 24 & 0xff) / 255.0);  
54 - } 51 + const PdfColor.fromInt(int color)
  52 + : r = (color >> 16 & 0xff) / 255.0,
  53 + g = (color >> 8 & 0xff) / 255.0,
  54 + b = (color & 0xff) / 255.0,
  55 + a = (color >> 24 & 0xff) / 255.0;
55 56
56 factory PdfColor.fromHex(String color) { 57 factory PdfColor.fromHex(String color) {
57 return PdfColor( 58 return PdfColor(