Coder Social home page Coder Social logo

desktop_window's People

Contributors

fahadck50 avatar jpnurmi avatar justusfluegel avatar lijy91 avatar mix1009 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

desktop_window's Issues

setMinimumSize nothing works

// .....
class XxxState extends State<Xxx> with WindowListener {
@override
void initState() {
lazyInit();
}
lazyInit() async {
  windowManager.addListener(this);
  await windowManager.setMinimumSize(Size(1280, 720));  // <-- when start the app on windows, I can still resize the window to any size
}
}

environment:

Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 77d935af4d (4 weeks ago) • 2021-12-16 08:37:33 -0800
Engine • revision 890a5fca2e
Tools • Dart 2.15.1

Visual Studio Community 2019 16.11.8
Microsoft Windows [Version 10.0.19042.1110], locale zh-CN

[LINUX] Onscreen Keyboard automatically close on full screen

In Linux on-screen keyboard enabled, and desktop-window set to fullscreen, the onscreen keyboard open and close automatically when I click a text filed, it's stay in normal screen.

normal mode (without fullscreen) is working without any issue.

Rename fullscreen to maximize in next major release & add kiosk functions

the current setFullscreen works more like a .maximize() so I think we should call it that too.
Behavour should be .maximize() = .toggleFullScreen() and .maximise(true) = .setFullScreen(true) and .maximize(false) = .setFullscreen(false).
.isMaximized should be a getter for .getFullScreen();

the current fullcreen on Linux should be replaced with a maximize implementation and on macos .kioskMode(bool kioskMode) should do the same as maximize, but on Linux and Windows it should make the window fullscreen without any menu bars or the taskbar.

Add support for bringing window to front (activating window).

At the moment, there is no way to bring the application window to the front of the screen or activate the window using this plugin. To my knowledge (at least on macOS), calling setWindowSize asynchronously may cause the app to crash due to NSApplication.shared.mainWindow being nil when the window is out of focus.

I've already implemented this for macOS in a separate plugin, but it would be very fitting to add support for all the platforms here in one unified plugin.

Set Max and Min window size not work in the same time on linux

setting maximum and minimum window size is not working in the same time on linux
I am using KDE Plasma 5 as my desktop environment

only the first used method works
e.g.
if I used DesktopWindow.setMaxWindowSize(size); then DesktopWindow.setMinWindowSize(size);
only maximum size works

DesktopWindow.getWindowSize() not working on Linux

Upon trying to retrieve the window size, the error "(MAINWINDOW_NOT_FOUND, GtkWindow not found, null, null)" is thrown.

No matter where I attempt to retrieve the window size, be it on the loading of the app or by the press of a button after the window is already loaded and fully initialised, this error still occurs.

Add Android and iOS modules to allow compilation on mobile platforms

Presently the plugin only supports Desktop platforms (macos, linux and windows). When compiling a project that depends on desktop_window for mobile platform (android and ios), compilation will always fail as there are no modules set up for this plugin.
I'm not sure if this plugin could have an overloaded usage for the mobile platform but a simple no-op implementation would be useful to allow consumption in projects that have a single codebase for mobile and desktop platforms.

What do you think? I am willing to raise a PR if that helps.

macos -> GeneratedPluginRegistrant: No such module 'desktop_window'

Hello,
In macOS, there is a problem where the generated file from flutter is throwing an error. Although the program runs fine when using 'flutter run' when trying a native build from XCode an error is immediately thrown and is picked up as a compiler error.

If anyone knows the solution to this problem please let me know.

Thanks,
Rhino Inani

A screenshot of the problem is shown below.

image

This plugin did not work on windows 11.

I tried to add some code like the following in my main.dart.

  if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
    var size = Size(config.windowWidth, config.windowHeight);
    // disable window resizing
    await DesktopWindow.setWindowSize(size);
    await DesktopWindow.setMinWindowSize(size);
    await DesktopWindow.setMaxWindowSize(size);
  }

However, I got no response on windows 11, I have tested it ok on windows 10. If I comment these pieces of code or change it to use window_size of github.com/google/flutter-desktop-embedding, it works too.

64eLIdthUo.mp4

How to config the initial window size

I tried both this package and window_size of flutter-desktop-embedding. They are all first show the initial default sized window, then resize or move it. So a window blink will still exist.

Is there any way to set the initial size of the startup window without show-resize-move steps?

  desktop_window: ^0.3.0
  window_size:
    git:
      url: git://github.com/google/flutter-desktop-embedding.git
      path: plugins/window_size
import 'package:desktop_window/desktop_window.dart';
import 'package:flutter/material.dart';
import 'package:system_network_proxy/app.dart';
import 'package:system_network_proxy/flutter_configuration.dart';
import 'package:system_network_proxy/service.dart';
import 'dart:io' show Platform;
import 'dart:math' as math;
import 'package:window_size/window_size.dart' as window_size;

/// global configuration from yaml
FlutterConfiguration config;
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // await DesktopWindow.setWindowSize(Size(500, 300));
  var window = await window_size.getWindowInfo();
  if (window.screen != null) {
    final screenFrame = window.screen.visibleFrame;
    final width = 500.0;
    final height = 300.0;
    final left = ((screenFrame.width - width) / 2).roundToDouble();
    final top = ((screenFrame.height - height) / 3).roundToDouble();
    final frame = Rect.fromLTWH(left, top, width, height);
    window_size.setWindowFrame(frame);
    window_size.setWindowMinSize(Size(1.0 * width, 1.0 * height));
    window_size.setWindowMaxSize(Size(1.0 * width, 1.0 * height));
    window_size.setWindowTitle('System Network Proxy (${Platform.operatingSystem})');
  }
  config = await FlutterConfiguration.fromAsset('assets/config.yaml');
  await Service().init();
  runApp(App());
}

macOs - DesktopWindow.setMinWindowSize(Size(400,400)) not working

After setting this, I am still able to make the desktop macOs app smaller than 400x400 in width and height.

Is there something additional that I need to perform apart from DesktopWindow.setMinWindowSize() to not let it be smaller than what I am setting in the width and height here?

SetMin working on MacOS

After Updating Flutter to 2.2.2 on MacOS I receive a "MainWindow not found" message from the Future of the function "setMinWindowSize".

I'm running the application on MacOS 10.15.6

CMake 3.15 or higher is required. You are running version 3.10.2

I keep getting this error, but I have 3.16.2 but it keeps throwing me this build error.

[ +123 ms] executing: [/home/wildone/snap/flutter/common/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +81 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] b1395592de68cc8ac4522094ae59956dd21a91db
[ +1 ms] executing: [/home/wildone/snap/flutter/common/flutter/] git tag --points-at b1395592de68cc8ac4522094ae59956dd21a91db
[ +20 ms] Exit code 0 from: git tag --points-at b1395592de68cc8ac4522094ae59956dd21a91db
[ ] 2.0.4
[ +86 ms] executing: [/home/wildone/snap/flutter/common/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +8 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/stable
[ ] executing: [/home/wildone/snap/flutter/common/flutter/] git ls-remote --get-url origin
[ +7 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +99 ms] executing: [/home/wildone/snap/flutter/common/flutter/] git rev-parse --abbrev-ref HEAD
[ +9 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] stable
[ +124 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +148 ms] executing: /home/wildone/Android/Sdk/platform-tools/adb devices -l
[ +29 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +2 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +140 ms] executing: /home/wildone/Android/Sdk/platform-tools/adb devices -l
[ +25 ms] Skipping pub get: version match.
[ +30 ms] Found plugin dart_vlc at
/home/wildone/snap/flutter/common/flutter/.pub-cache/git/dart_vlc-349400f3978d751d45e5c4d310cd78d998742d40/
[ +14 ms] Found plugin desktop_window at
/home/wildone/snap/flutter/common/flutter/.pub-cache/git/desktop_window-56183be57bfcdf0ba8eb8ae2c2b61f687161dfa5/
[ +6 ms] Found plugin window_size at
/home/wildone/snap/flutter/common/flutter/.pub-cache/git/flutter-desktop-embedding-1d3bff412f8e93087243995570db3a56eba415e5/plu
gins/window_size/
[ +8 ms] Found plugin audio_session at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/audio_session-0.1.0/
[ +37 ms] Found plugin just_audio at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/just_audio-0.7.4/
[ +6 ms] Found plugin just_audio_web at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/just_audio_web-0.3.1/
[ +13 ms] Found plugin path_provider at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/
[ +4 ms] Found plugin path_provider_linux at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.0.0/
[ +4 ms] Found plugin path_provider_macos at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.0/
[ +6 ms] Found plugin path_provider_windows at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.0/
[ +265 ms] Found plugin dart_vlc at
/home/wildone/snap/flutter/common/flutter/.pub-cache/git/dart_vlc-349400f3978d751d45e5c4d310cd78d998742d40/
[ +3 ms] Found plugin desktop_window at
/home/wildone/snap/flutter/common/flutter/.pub-cache/git/desktop_window-56183be57bfcdf0ba8eb8ae2c2b61f687161dfa5/
[ +3 ms] Found plugin window_size at
/home/wildone/snap/flutter/common/flutter/.pub-cache/git/flutter-desktop-embedding-1d3bff412f8e93087243995570db3a56eba415e5/plu
gins/window_size/
[ +5 ms] Found plugin audio_session at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/audio_session-0.1.0/
[ +21 ms] Found plugin just_audio at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/just_audio-0.7.4/
[ +3 ms] Found plugin just_audio_web at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/just_audio_web-0.3.1/
[ +7 ms] Found plugin path_provider at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/
[ +3 ms] Found plugin path_provider_linux at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.0.0/
[ +2 ms] Found plugin path_provider_macos at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-2.0.0/
[ +4 ms] Found plugin path_provider_windows at
/home/wildone/snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.0.0/
[ +40 ms] Generating
/home/wildone/Desktop/projects/to_do_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +232 ms] Initializing file store
[ +23 ms] Skipping target: gen_localizations
[ +13 ms] complete
[ +13 ms] Launching lib/main.dart on Linux in debug mode...
[ +13 ms] /home/wildone/snap/flutter/common/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev
/home/wildone/snap/flutter/common/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root
/home/wildone/snap/flutter/common/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter
--debugger-module-names --experimental-emit-debug-metadata --output-dill /tmp/flutter_tools.NZTYUY/flutter_tool.ILJWBX/app.dill
--packages /home/wildone/Desktop/projects/to_do_app/.dart_tool/package_config.json -Ddart.vm.profile=false
-Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill
build/cache.dill.track.dill
[ +42 ms] Building Linux application...
[ +67 ms] <- compile package:to_do_app/main.dart
[ +6 ms] executing: [build/linux/debug/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug
/home/wildone/Desktop/projects/to_do_app/linux
[ +26 ms] List of devices attached
[ +7 ms] List of devices attached
[ +101 ms] CMake Error at flutter/ephemeral/.plugin_symlinks/dart_vlc/linux/CMakeLists.txt:9 (cmake_minimum_required):
[ +5 ms] CMake 3.15 or higher is required. You are running version 3.10.2
[ +1 ms] -- Configuring incomplete, errors occurred!
[ ] See also "/home/wildone/Desktop/projects/to_do_app/build/linux/debug/CMakeFiles/CMakeOutput.log".
[ +31 ms] Building Linux application... (completed in 232ms)
[+2125 ms] Exception: Unable to generate build files
[ +1 ms] "flutter run" took 3,623ms.
[ +10 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:644:9)

#2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1157:12)

#3 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1009:27)

#4 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#5 AppContext.run (package:flutter_tools/src/base/context.dart:149:12)

#6 CommandRunner.runCommand (package:args/command_runner.dart:197:13)

#7 FlutterCommandRunner.runCommand.
(package:flutter_tools/src/runner/flutter_command_runner.dart:278:9)

#8 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#9 AppContext.run (package:flutter_tools/src/base/context.dart:149:12)

#10 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:234:5)

#11 run.. (package:flutter_tools/runner.dart:64:9)

#12 run. (package:flutter_tools/runner.dart:62:12)

#13 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#14 AppContext.run (package:flutter_tools/src/base/context.dart:149:12)

#15 runInContext (package:flutter_tools/src/context_runner.dart:73:10)

#16 main (package:flutter_tools/executable.dart:90:3)

[ +186 ms] ensureAnalyticsSent: 178ms
[ +2 ms] Running shutdown hooks
[ ] Shutdown hook priority 4
[ +10 ms] Shutdown hooks complete
[ ] exiting with code 1

can't set window size

] Unhandled Exception: MissingPluginException(No implementation found for method setMinWindowSize on channel desktop_window)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)

#1 DesktopWindow.setMinWindowSize (package:desktop_window/desktop_window.dart:25:12)

#2 main (package:war_simulator_editor/main.dart:33:3)

stayOnTop not doing the same thing on every os

stayOnTop is inconsistent across operating systems. On macOS it lets a window stay onTop of the parent window, but on linux and windows it pins a window at the top position of the z-stack, at least as far as I know

Unhandled Exception: mainWindow not found

Can't set app to full screen using the following command:

await DesktopWindow.setFullScreen(true);

Error:

[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: mainWindow not found
#0      DesktopWindow.getWindowSize (package:desktop_window/desktop_window.dart:16:5)
<asynchronous suspension> 

Environment:
MacOS 11.4 Big Sur
Mac Mini M1

Flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-arm, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.55.2)
[✓] Connected device (1 available)

What could I have done wrong?

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.