Giter VIP home page Giter VIP logo

Comments (5)

Adrian-Samoticha avatar Adrian-Samoticha commented on June 16, 2024

I find the glitch isn’t really as noticeable when running the app in release mode (it’s really just a fraction of a second), though it is indeed noticeable at all.

It might be possible how add functionality to hide/unhide the window and document how to make sure the window is hidden during startup by modifying the app’s Swift code. This way you’d still be able to configure your app within Dart, while the only thing you’d need to do in Swift would be making sure the window is hidden during launch.

from macos_window_utils.dart.

matthew-carroll avatar matthew-carroll commented on June 16, 2024

Is there a Swift and Dart code snippet that does what you described above? Or does this require new Dart APIs in this package?

from macos_window_utils.dart.

Adrian-Samoticha avatar Adrian-Samoticha commented on June 16, 2024

Honestly, I am no longer quite sure if you can even hide the window programmatically, but you can make it invisible by setting its alpha value to 0. So, you could achieve what you’re trying to do like this:

In your MainFlutterWindow.swift file in your Xcode project, add this line to the awakeFromNib method, right above super.awakeFromNib():

self.alphaValue = 0.0

This will ensure that your window is opened with an alpha value of 0.0. Then, use the WindowManipulator’s setWindowAlphaValue method to set it to 1.0 in your Dart code at startup.

from macos_window_utils.dart.

damywise avatar damywise commented on June 16, 2024

Adding the following line after the function awakeFromNib() also works for hiding the app, though there's no method in this plugin to make it visible again, you need to add one in the plugin.

  override public func order(_ place: NSWindow.OrderingMode, relativeTo otherWin: Int) {
      super.order(place, relativeTo: otherWin)
      super.setIsVisible(false)
  }

(Adapted from window_manager)

from macos_window_utils.dart.

Adrian-Samoticha avatar Adrian-Samoticha commented on June 16, 2024

Oh, you’re right, I somehow missed the setVisible method. Maybe I should expose that.

from macos_window_utils.dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.