Skip to content

Commit

Permalink
add window manager package to manager window
Browse files Browse the repository at this point in the history
  • Loading branch information
JerryFans committed Jan 13, 2022
1 parent eb8419f commit 2d81d63
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ import 'package:oktoast/oktoast.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'View/bottom_setting_view.dart';
import 'package:file_drag_and_drop/file_drag_and_drop_channel.dart';
import 'package:window_manager/window_manager.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
await dragAndDropChannel.initializedMainView();
await windowManager.ensureInitialized();
windowManager.waitUntilReadyToShow().then((_) async {
await windowManager.setResizable(false);
await windowManager.setSize(Size(800, 600));
await windowManager.show();
});
runApp(GetMaterialApp(
navigatorKey: Get.key,
home: OKToast(
Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import Foundation
import file_drag_and_drop
import path_provider_macos
import shared_preferences_macos
import window_manager

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FileDragAndDropPlugin.register(with: registry.registrar(forPlugin: "FileDragAndDropPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
}
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.10"
window_manager:
dependency: "direct main"
description:
name: window_manager
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.3"
xdg_directories:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies:
dio: ^4.0.4
oktoast: ^3.1.5
shared_preferences: ^2.0.6
window_manager: ^0.1.3

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 2d81d63

Please sign in to comment.