alexmercerind / flutter_acrylic

Flutter library for window acrylic, mica & transparency effects.
MIT License
605 stars 54 forks source link

[Question/Feature Request] Use This Effect on a Widget? #57

Open seanocali opened 1 year ago

seanocali commented 1 year ago

Instead of applying the effect on the app's window, can it be used as the background color of a Container?

Adrian-Samoticha commented 1 year ago

It can be on macOS using the TransparentMacOSSidebar, TransparentMacOSBottomBar, or VisualEffectSubviewContainer widgets. There is no way to do so on Linux or Windows.

alexmercerind commented 1 year ago

You can "clip out" a section from your widget tree & remove Flutter paint from that region. It will make Flutter use window's background in that region. Do it using CustomPainter, just use BlendMode.clear. See:

https://github.com/alexmercerind/flutter_native_view/blob/master/lib/src/widgets.dart#L145-L160

This is only solution for Windows & Linux.