flutter_acrylic icon indicating copy to clipboard operation
flutter_acrylic copied to clipboard

can not get windows dark -> light switch, but macOS is OK

Open lucasjinreal opened this issue 1 year ago • 7 comments

Hi, I have a same logic like this:

if (brightness == InterfaceBrightness.dark) {
                            brightness = InterfaceBrightness.light;
                          } else if (brightness == InterfaceBrightness.light) {
                            brightness = InterfaceBrightness.dark;
                          } else {
                            brightness = InterfaceBrightness.dark;
                          }
                          bool v = brightness == InterfaceBrightness.dark;
                          // aboutBloc.setForceDark(v);
                          if (v) {
                            Get.changeTheme(themeDataDark);
                          } else {
                            Get.changeTheme(themeData);
                          }
                          print('[brightness] crt brightness: ${brightness}');
                          this.setWindowEffect(WindowEffect.acrylic,
                              brightness == InterfaceBrightness.dark);

...

void setWindowEffect(WindowEffect value, bool dark) {
    Window.setEffect(
      effect: value,
      color: this.color,
      dark: dark,
    );
    if (Platform.isMacOS) {
      if (brightness != InterfaceBrightness.auto) {
        Window.overrideMacOSBrightness(
            dark: brightness == InterfaceBrightness.dark);
      }
    }
    this.setState(() => this.effect = value);
  }



the printed out brightness is dark and light when switch.

But the setWindowEffect can not make window to bright. While same code on macOS is ok.

what'sthe problem here?

lucasjinreal avatar Oct 06 '22 13:10 lucasjinreal