All Projects → alexmercerind → flutter_acrylic

alexmercerind / flutter_acrylic

Licence: MIT License
Flutter library for window acrylic, mica & transparency effects (Windows, macOS & Linux). 💙

Programming Languages

C++
36643 projects - #6 most used programming language
dart
5743 projects
swift
15916 projects
CMake
9771 projects
c
50402 projects - #5 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to flutter acrylic

Translucenttb
A lightweight utility that makes the Windows taskbar translucent/transparent.
Stars: ✭ 8,816 (+3277.78%)
Mutual labels:  blur, acrylic
Win32-Acrylic-Effect
Demonstrates implementation of the Windows 10 Acrylic Effect on C++ Win32 Apps using DWM Private APIs and Direct Composition
Stars: ✭ 104 (-60.15%)
Mutual labels:  blur, acrylic
Glasstron
The go-to solution to Electron composition effects, such as blurry windows.
Stars: ✭ 243 (-6.9%)
Mutual labels:  blur, acrylic
Win32Acrylic
Acrylic demo applications based on different technology stack
Stars: ✭ 35 (-86.59%)
Mutual labels:  acrylic, acrylic-material
MicaForEveryone
Mica For Everyone is a tool to enable backdrop effects on the title bars of Win32 apps on Windows 11.
Stars: ✭ 2,006 (+668.58%)
Mutual labels:  acrylic, mica
mica-jmh
mica 工具性能压测,目的是鞭策自己,让 mica 性能更加优秀。
Stars: ✭ 34 (-86.97%)
Mutual labels:  mica
sic
🦜 Accessible image processing and conversion from the terminal. Front-end for image-rs/image.
Stars: ✭ 96 (-63.22%)
Mutual labels:  blur
BlurKit
A lightweight library that can easily blur the view.
Stars: ✭ 17 (-93.49%)
Mutual labels:  blur
spark-convolution-patch
Convolution and other super-patches (blur, sharpen)
Stars: ✭ 74 (-71.65%)
Mutual labels:  blur
DashcamCleaner
Censor identifiable information in videos., in particular dashcam recordings in Germany.
Stars: ✭ 20 (-92.34%)
Mutual labels:  blur
RainbowTaskbar
Customizable Windows taskbar effects.
Stars: ✭ 39 (-85.06%)
Mutual labels:  blur
blurr effect
An example of how to blurr the background for a widget in flutter.
Stars: ✭ 15 (-94.25%)
Mutual labels:  blur
arcade-pcb-case
Plans to build Arcade PCB cases
Stars: ✭ 29 (-88.89%)
Mutual labels:  acrylic
BlurringAtlasForUGUI
A blur effect for uGUI in Unity, that is effective even for atlas images including dynamic fonts.
Stars: ✭ 29 (-88.89%)
Mutual labels:  blur
ECardFlow
🍭A custom ViewPager for multiple card flow system. && A layout which provide beautiful background effects for ViewPager.
Stars: ✭ 47 (-81.99%)
Mutual labels:  blur
frosted-glass
❄️ Add a live frosted glass blur effect over any type of web content, including text.
Stars: ✭ 62 (-76.25%)
Mutual labels:  blur
Kawase
Kawase dual filter blur for GameMaker Studio 2
Stars: ✭ 23 (-91.19%)
Mutual labels:  blur
react-acrylic
Frost glass effect, Acrylic Material react component
Stars: ✭ 39 (-85.06%)
Mutual labels:  acrylic
NeteaseMusic-Client
Based on vue-netease-music, Powered by Electron™
Stars: ✭ 17 (-93.49%)
Mutual labels:  acrylic-material
Unblur-Scribd
Clear the blur and show the images in scribd.com page.
Stars: ✭ 26 (-90.04%)
Mutual labels:  blur

flutter_acrylic

Window acrylic, mica & transparency effects for Flutter on Windows, macOS & Linux

Installation

Mention in your pubspec.yaml.

dependencies:
  ...
  flutter_acrylic: ^1.0.0

Windows 10 versions higher than 1803 & all Windows 11 versions are supported by the plugin, although not all effects might be available to a particular Windows version. See pinned issues if you encounter some problem or feel free to file one yourself.

Example

Example app running on Microsoft Windows 11 (pre-compiled release mode x64 executable available to test in the "Releases" tab).

Documentation

Initialize the plugin inside the main method.

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Window.initialize();
  runApp(MyApp());
}

Apply the effect to Flutter window.

await Window.setEffect(
  effect: WindowEffect.acrylic,
  color: Color(0xCC222222),
);
await Window.setEffect(
  effect: WindowEffect.mica,
  dark: true,
);

Following effects are available for Microsoft Windows.

  • WindowEffect.acrylic.
  • WindowEffect.mica.
  • WindowEffect.aero.
  • WindowEffect.disabled.
  • WindowEffect.solid.
  • WindowEffect.transparent.

Following effects are available for macOS.

  • WindowEffect.titlebar.
  • WindowEffect.selection.
  • WindowEffect.menu.
  • WindowEffect.popover.
  • WindowEffect.sidebar.
  • WindowEffect.headerView.
  • WindowEffect.sheet.
  • WindowEffect.windowBackground.
  • WindowEffect.hudWindow.
  • WindowEffect.fullScreenUI.
  • WindowEffect.toolTip.
  • WindowEffect.contentBackground.
  • WindowEffect.underWindowBackground.
  • WindowEffect.underPageBackground.

Other utility features offered by the plugin:

Enter fullscreen.

Window.enterFullscreen();

Exit fullscreen.

Window.exitFullscreen();

Hide controls.

Window.hideWindowControls();

Show controls.

Window.showWindowControls();

macOS only utility features:

Get the height of the titlebar when the full-size content view is enabled.

final titlebarHeight = Window.getTitlebarHeight();

Set the document to be edited.

Window.setDocumentEdited();

Set the document to be unedited.

Window.setDocumentUnedited();

Set the represented file of the window.

Window.setRepresentedFilename('path/to/file.txt');

Set the represented URL of the window.

Window.setRepresentedUrl('https://flutter.dev');

Hide the titlebar of the window.

Window.hideTitle();

Show the titlebar of the window.

Window.showTitle();

Make the window's titlebar transparent.

Window.makeTitlebarTransparent();

Make the window's titlebar opaque.

Window.makeTitlebarOpaque();

Enable the window's full-size content view. It is recommended to enable the full-size content view when making the titlebar transparent.

Window.enableFullSizeContentView();

Disable the window's full-size content view.

Window.disableFullSizeContentView();

Zoom the window.

Window.zoomWindow();

Unzoom the window.

Window.unzoomWindow();

Get if the window is zoomed.

final isWindowZoomed = Window.isWindowZoomed();

Get if the window is fullscreened.

final isWindowFullscreened = Window.isWindowFullscreened();

Hide/Show the window's zoom button.

Window.hideZoomButton();
Window.showZoomButton();

Hide/Show the window's miniaturize button.

Window.hideMiniaturizeButton();
Window.showMiniaturizeButton();

Hides/Show the window's close button.

Window.hideCloseButton();
Window.showCloseButton();

Enable/Disable the window's zoom button.

Window.enableZoomButton();
Window.disableZoomButton();

Enable/Disable the window's miniaturize button.

Window.enableMiniaturizeButton();
Window.disableMiniaturizeButton();

Enable/Disable the window's close button.

Window.enableCloseButton();
Window.disableCloseButton();

Get whether the window is currently being resized by the user.

final isWindowInLiveResize = Window.isWindowInLiveResize();

Set the window's alpha value.

Window.setWindowAlphaValue(0.75);

Get if the window is visible.

final isWindowVisible = Window.isWindowVisible();

Set the window's titlebar to the default (opaque) color.

Window.setWindowBackgroundColorToDefaultColor()

Make the window's titlebar clear.

Window.setWindowBackgroundColorToClear()

Set the window's blur view state.

Window.setBlurViewState(MacOSBlurViewState.active);
Window.setBlurViewState(MacOSBlurViewState.inactive);
Window.setBlurViewState(MacOSBlurViewState.followsWindowActiveState);

More features coming soon.

Notes

Windows

No additional setup is required.

On Windows 11 versions higher than or equal to 22523, DwmSetWindowAttribute API is used for WindowEffect.acrylic, WindowEffect.mica & WindowEffect.tabbed effects.

This plugin uses the undocumented SetWindowCompositionAttribute API from user32.dll on Windows 10 & early Windows 11 versions to achieve the acrylic effect. Learn more at Rafael Rivera's amazing blog post about this here.

[ONLY on Windows 10] In most cases, you might wanna render custom window frame because the blur effect might leak outside the window boundary. You can use bitsdojo_window to make a custom window for your Flutter application.

WindowEffect.acrylic causes lag on window drag in Windows 10, this issue is fixed by Microsoft in Windows 11. This issue can be prevented by a "hack", however nothing has been done within the plugin to circumvent this on Windows 10.

WindowEffect.mica & WindowEffect.tabbed only works on Windows 11.

You can see the example application for further details.

macOS

Additional setup for macOS:

Open the macos/Runner.xcworkspace folder of your project using Xcode, press ⇧ + ⌘ + O and search for MainFlutterWindow.swift.

Insert import flutter_acrylic at the top of the file. Then, replace the code above the super.awakeFromNib()-line with the following code:

let windowFrame = self.frame
let blurryContainerViewController = BlurryContainerViewController()
self.contentViewController = blurryContainerViewController
self.setFrame(windowFrame, display: true)

/* Initialize the flutter_acrylic plugin */
MainFlutterWindowManipulator.start(mainFlutterWindow: self)

RegisterGeneratedPlugins(registry: blurryContainerViewController.flutterViewController)

Assuming you're starting with the default configuration, the finished code should look something like this:

import Cocoa
import FlutterMacOS
+import flutter_acrylic

class MainFlutterWindow: NSWindow {
  override func awakeFromNib() {
-   let flutterViewController = FlutterViewController.init()
-   let windowFrame = self.frame
-   self.contentViewController = flutterViewController
-   self.setFrame(windowFrame, display: true)

-   RegisterGeneratedPlugins(registry: flutterViewController)
    
+   let windowFrame = self.frame
+   let blurryContainerViewController = BlurryContainerViewController()
+   self.contentViewController = blurryContainerViewController
+   self.setFrame(windowFrame, display: true)

+   /* Initialize the flutter_acrylic plugin */
+   MainFlutterWindowManipulator.start(mainFlutterWindow: self)

+   RegisterGeneratedPlugins(registry: blurryContainerViewController.flutterViewController)

    super.awakeFromNib()
  }
}

Now press ⇧ + ⌘ + O once more and search for Runner.xcodeproj. Go to info > Deployment Target and set the macOS Deployment Target to 10.11 or above.

Depending on your use case, you may want to extend the area of the window that Flutter can draw to to the entire window, such that you are able to draw onto the window's title bar as well (for example when you're only trying to make the sidebar transparent while the rest of the window is meant to stay opaque).

To do so, enable the full-size content view with the following Dart code:

Window.makeTitlebarTransparent();
Window.enableFullSizeContentView();

When you decide to do this, it is recommended to wrap your application (or parts of it) in a TitlebarSafeArea widget as follows:

TitlebarSafeArea(
  child: YourApp(),
)

This ensures that your app is not covered by the window's title bar.

Linux

Additional setup for Linux.

Find my_application.cc inside the linux directory of your Flutter project & remove following lines from it.

gtk_widget_show(GTK_WIDGET(window));
gtk_widget_show(GTK_WIDGET(view));

Adding blur to the Window.

Since current Flutter embedder on Linux uses GTK 3.0, so there is no official API available for backdrop blur of the window.

However, some desktop environments like KDE Plasma (with KWin compositor) have some third party scripts like kwin-forceblur from Eon S. Jeon, which allow to add blur to GTK 3.0 windows aswell (when the window is transparent, which you can certainly achieve using the plugin). Thus, this setup can be used to obtain result as shown in the picture.

Blur on Linux is more dependent on the compositor, some compositors like compiz or wayfire also seem to support blur effects.

Platforms

Platform Status Maintainer
Windows Hitesh Kumar Saini
macOS Adrian Samoticha
Linux Hitesh Kumar Saini

License

MIT License. Contributions welcomed.

Aero blur effect.

Transparent Flutter window.

image

Transparent Flutter window on macOS Monterey with dark mode enabled.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].