alexmercerind / flutter_acrylic

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

How to dynamic set effect based on system version? #40

Open lucasjinreal opened 1 year ago

lucasjinreal commented 1 year ago

Hello, I using this to dynamic set window effect, but have no reasponse:


  DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();

  void getWindowEffect() async {
    if (Platform.isWindows) {
      var sysProductName = await deviceInfo.windowsInfo;
      var pn = sysProductName.productName;
      print("--- windows information:::: ${pn}");
      if (pn.contains("Windows 10")) {
        setState(() {
          this.effect = WindowEffect.disabled;
        });

        print("effect set to: ${this.effect}");
      } else {
        this.effect = WindowEffect.acrylic;
      }
    } else {
      this.effect = WindowEffect.acrylic;
    }
  }

Am using Windowefffect.acrylic as default, but this should change if on windows 10, since it has bug when mouse dragging on window.

How should I do properly? thanks

lucasjinreal commented 1 year ago

Also, I got a white line above window, why? (no such thing on arcylic effect)

image

Adrian-Samoticha commented 1 year ago

I haven't tried it out myself, but the os_detect package does provide a way to get the operating system version as a string. Maybe you could use that to check which version of Windows your app is running on.

Adrian-Samoticha commented 1 year ago

Also, check out Platform.operatingSystemVersion from the dart:io library.