How to make the shadow match the content

You can use the following code:

...

Tilt(
+ lightShadowMode: LightShadowMode.projector,
  ...
),

...

For more information, see: Tilt widget - LightShadowMode.

You should assess the performance risks yourself. If your scenario runs smoothly, then you can use it.

Performance risk exists:

Apply a shadow to the entire Tilt widget, similar to a projector effect.
will display a shadow that exactly matches the non-transparent parts of the widget.
Recommended for the following scenarios:

  • Images only
  • No data states
  • No Hero tags