fixes for Windows

This commit is contained in:
Nick Fisher
2024-06-08 15:30:24 +10:00
parent 6eea9c1f66
commit 4f830f1f95
133 changed files with 59 additions and 23 deletions

View File

@@ -72,6 +72,14 @@ class _FilamentWidgetState extends State<FilamentWidget> {
@override
Widget build(BuildContext context) {
if (_texture?.usesBackingWindow == true) {
return Stack(children: [
Positioned.fill(child: CustomPaint(painter: TransparencyPainter()))
]);
}
if (_texture == null || _resizing) {
return widget.initial ??
Container(color: kIsWeb ? Colors.transparent : Colors.red);
@@ -79,7 +87,7 @@ class _FilamentWidgetState extends State<FilamentWidget> {
var textureWidget = Texture(
key: ObjectKey("texture_${_texture!.flutterTextureId}"),
textureId: _texture!.flutterTextureId,
textureId: _texture!.flutterTextureId!,
filterQuality: FilterQuality.none,
freeze: false,
);
@@ -98,3 +106,19 @@ class _FilamentWidgetState extends State<FilamentWidget> {
]));
}
}
class TransparencyPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
canvas.drawRect(
Rect.fromLTWH(0, 0, size.width, size.height),
Paint()
..blendMode = BlendMode.clear
..color = const Color(0x00000000),
);
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
}