Open michael-kim-korea opened 7 months ago
Yes, there is no alpha component in PDF. Use the Opacity widget instead.
We've just bumped into this issue, any ideas where we could contribute a PR? Is there some background to help resolve this?
same answer: There is no alpha component in PDF. Use the Opacity widget instead.
How does opacity work? Could PdfColor when using alpha with components add then Opacity widget automatically?
A bit like how container uses DecoratedBox automatically if you provide a colour.
It's not exactly the same. If you add an opacity widget, any children will be transparent. Think of it like changing the opacity of a photoshop or inkscape layer
Yeah we have a widget that adds opacity, then the child, then a 100% opacity and then the rest of the children.
Just trying to help vs complain about the issue happy to contribute as the library is one of the best in Flutter/Dart.
Could be implemented for BoxDecoration, why not. https://github.com/DavBfr/dart_pdf/blob/a6f0d9f05e6c2ff7f2bb00aaf0f8986691f9345f/pdf/lib/src/widgets/decoration.dart#L255
Describe the bug When setting the color in Container's BoxDecoration, PdfColor.fromInt(0x00000000) is applied, but transparent is not applied to the screen and is displayed in black. However, it applies if you specify a color. PdfColor.fromInt(0x01FF0000) or PdfColor.fromInt(0x010000FF).
I don't know if this is a bug or intentional, but alpha is applied in the flutter widget.
To Reproduce pw.Container( width: 100.0, height: 100.0, decoration: pw.BoxDecoration( // color: PdfColor.fromInt(0x00000000), // not apply color: PdfColor.fromInt(0x01000000), // not apply // color: PdfColor.fromInt(0x010000FF), // alpha apply border: pw.Border.all(color: PdfColor.fromInt(0xFF00FF00)) ), child: Text("Test"), );
Desktop (please complete the following information):