Skip to content

Commit eb9276e

Browse files
committed
fix: optimize some painting and transformations with early return
1 parent ae52f13 commit eb9276e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/liquid_glass_renderer/lib/src/glass_glow.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ class GlassGlowLayerState extends State<GlassGlowLayer>
123123
late final _radiusController = SingleMotionController(
124124
vsync: this,
125125
motion: const Motion.smoothSpring(),
126-
)..value = 1;
126+
initialValue: 1,
127+
);
127128

128129
bool _dragging = false;
129130
double _baseRadius = 0;
@@ -257,6 +258,12 @@ class _RenderGlassGlowLayer extends RenderProxyBox {
257258

258259
@override
259260
void paint(PaintingContext context, Offset offset) {
261+
if (_glowColor.a == 0 || _glowRadius <= 0) {
262+
// No glow to paint
263+
super.paint(context, offset);
264+
return;
265+
}
266+
260267
final canvas = context.canvas;
261268
final bounds = offset & size;
262269

0 commit comments

Comments
 (0)