Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appWindow.hide() behaviour changes from IDE to compiled EXE #221

Open
boganiLuca opened this issue Jun 20, 2023 · 1 comment
Open

appWindow.hide() behaviour changes from IDE to compiled EXE #221

boganiLuca opened this issue Jun 20, 2023 · 1 comment

Comments

@boganiLuca
Copy link

boganiLuca commented Jun 20, 2023

I am developing an app that can run in two different ways, depending on args passed to it. One way has a GUI for configuring the app, the other way is supposed to be run as a Windows service and does its things depending on how it has been configured on the GUI side (this is just to give some context).

So, I basically have a flag set at runtime that depends on the args passed, and the last lines of the main method are this:

void main() {
  runApp(const MyApp());
  doWhenWindowReady(() {  
    if (isService) {  
      appWindow.hide();   
      //sets up the service and stuff...
    } else {   
      //sets the windows properties...
      appWindow.show();
    }  
  });  
}

I continued developing the app without worries, because in Android Studio everything worked fine: when it was supposed to show the GUI, it showed the GUI, and when it was started as a service, there was no thing on the screen ever.

The problem appeared when I started preparing to deploy it: I noticed that the hide() method seemed to be ignored because when I started it as a service, I got a total black GUI with nothing on it (and that was right, since the only widget is an empty container when it's a service). Everything else worked as intended, though.

I narrowed down the variables (used the same PC, changed some lines of code to be sure, etc), and now I am at this point: the app's code is a copy-paste of the example, except for this part:

doWhenWindowReady(() {
    if (true) { 
      appWindow.hide(); 
      return;
    }
    final win = appWindow;
    const initialSize = Size(600, 450);
    win.minSize = initialSize;
    win.size = initialSize;
    win.alignment = Alignment.center;
    win.title = "Custom window with Flutter";
    win.show();
  });

In Android Studio, it works as intended: nothing is shown until I uncomment the hide() and return lines. But, if I build the app with the code shown above and then run it, I still get the example's orange window, but with a size different from 600x450, meaning that the return gets executed but not the hide().
Any hints on why the hide() command is working differently?

Plugin version: 0.1.5
Flutter doctor:

[√] Flutter (Channel stable, 3.10.5, on Microsoft Windows [Versione 10.0.19045.3086], locale it-IT)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.0)
[√] Android Studio (version 2022.2)

@luohao123
Copy link

Same here, does this lib no longer matained?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants