Skip to content

Commit 9900e55

Browse files
committed
wip: Add window_manager_windows package
1 parent 0ffd6d3 commit 9900e55

12 files changed

+273
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26+
/pubspec.lock
27+
**/doc/api/
28+
.dart_tool/
29+
build/
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: "2663184aa79047d0a33a14a3b607954f8fdd8730"
8+
channel: "stable"
9+
10+
project_type: plugin
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
17+
base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730
18+
19+
# User provided section
20+
21+
# List of Local paths (relative to this file) that should be
22+
# ignored by the migrate tool.
23+
#
24+
# Files that are not part of the templates will be ignored by default.
25+
unmanaged_files:
26+
- 'lib/main.dart'
27+
- 'ios/Runner.xcodeproj/project.pbxproj'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.0.1
2+
3+
* TODO: Describe initial release.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO: Add your license here.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# window_manager_windows
2+
3+
A new Flutter plugin project.
4+
5+
## Getting Started
6+
7+
This project is a starting point for a Flutter
8+
[plug-in package](https://flutter.dev/to/develop-plugins),
9+
a specialized package that includes platform-specific implementation code for
10+
Android and/or iOS.
11+
12+
For help getting started with Flutter development, view the
13+
[online documentation](https://docs.flutter.dev), which offers tutorials,
14+
samples, guidance on mobile development, and a full API reference.
15+
16+
The plugin project was generated without specifying the `--platforms` flag, no platforms are currently supported.
17+
To add platforms, run `flutter create -t plugin --platforms <platforms> .` in this directory.
18+
You can also find a detailed instruction on how to add platforms in the `pubspec.yaml` at https://flutter.dev/to/pubspec-plugin-platforms.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include: package:flutter_lints/flutter.yaml
2+
3+
# Additional information about this file can be found at
4+
# https://dart.dev/guides/language/analysis-options
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// You have generated a new plugin project without specifying the `--platforms`
2+
// flag. A plugin project with no platform support was generated. To add a
3+
// platform, run `flutter create -t plugin --platforms <platforms> .` under the
4+
// same directory. You can also find a detailed instruction on how to add
5+
// platforms in the `pubspec.yaml` at
6+
// https://flutter.dev/to/pubspec-plugin-platforms.
7+
8+
import 'window_manager_windows_platform_interface.dart';
9+
10+
class WindowManagerWindows {
11+
Future<String?> getPlatformVersion() {
12+
return WindowManagerWindowsPlatform.instance.getPlatformVersion();
13+
}
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import 'package:flutter/foundation.dart';
2+
import 'package:flutter/services.dart';
3+
4+
import 'window_manager_windows_platform_interface.dart';
5+
6+
/// An implementation of [WindowManagerWindowsPlatform] that uses method channels.
7+
class MethodChannelWindowManagerWindows extends WindowManagerWindowsPlatform {
8+
/// The method channel used to interact with the native platform.
9+
@visibleForTesting
10+
final methodChannel = const MethodChannel('window_manager_windows');
11+
12+
@override
13+
Future<String?> getPlatformVersion() async {
14+
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
15+
return version;
16+
}
17+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
2+
3+
import 'window_manager_windows_method_channel.dart';
4+
5+
abstract class WindowManagerWindowsPlatform extends PlatformInterface {
6+
/// Constructs a WindowManagerWindowsPlatform.
7+
WindowManagerWindowsPlatform() : super(token: _token);
8+
9+
static final Object _token = Object();
10+
11+
static WindowManagerWindowsPlatform _instance = MethodChannelWindowManagerWindows();
12+
13+
/// The default instance of [WindowManagerWindowsPlatform] to use.
14+
///
15+
/// Defaults to [MethodChannelWindowManagerWindows].
16+
static WindowManagerWindowsPlatform get instance => _instance;
17+
18+
/// Platform-specific implementations should set this with their own
19+
/// platform-specific class that extends [WindowManagerWindowsPlatform] when
20+
/// they register themselves.
21+
static set instance(WindowManagerWindowsPlatform instance) {
22+
PlatformInterface.verifyToken(instance, _token);
23+
_instance = instance;
24+
}
25+
26+
Future<String?> getPlatformVersion() {
27+
throw UnimplementedError('platformVersion() has not been implemented.');
28+
}
29+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: window_manager_windows
2+
description: "A new Flutter plugin project."
3+
version: 0.0.1
4+
homepage:
5+
6+
environment:
7+
sdk: ^3.5.3
8+
flutter: '>=3.3.0'
9+
10+
dependencies:
11+
flutter:
12+
sdk: flutter
13+
plugin_platform_interface: ^2.0.2
14+
15+
dev_dependencies:
16+
flutter_test:
17+
sdk: flutter
18+
flutter_lints: ^4.0.0
19+
20+
# For information on the generic Dart part of this file, see the
21+
# following page: https://dart.dev/tools/pub/pubspec
22+
23+
# The following section is specific to Flutter packages.
24+
flutter:
25+
# This section identifies this Flutter project as a plugin project.
26+
# The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.)
27+
# which should be registered in the plugin registry. This is required for
28+
# using method channels.
29+
# The Android 'package' specifies package in which the registered class is.
30+
# This is required for using method channels on Android.
31+
# The 'ffiPlugin' specifies that native code should be built and bundled.
32+
# This is required for using `dart:ffi`.
33+
# All these are used by the tooling to maintain consistency when
34+
# adding or updating assets for this project.
35+
plugin:
36+
platforms:
37+
# This plugin project was generated without specifying any
38+
# platforms with the `--platform` argument. If you see the `some_platform` map below, remove it and
39+
# then add platforms following the instruction here:
40+
# https://flutter.dev/to/pubspec-plugin-platforms
41+
# -------------------
42+
some_platform:
43+
pluginClass: somePluginClass
44+
# -------------------
45+
46+
# To add assets to your plugin package, add an assets section, like this:
47+
# assets:
48+
# - images/a_dot_burr.jpeg
49+
# - images/a_dot_ham.jpeg
50+
#
51+
# For details regarding assets in packages, see
52+
# https://flutter.dev/to/asset-from-package
53+
#
54+
# An image asset can refer to one or more resolution-specific "variants", see
55+
# https://flutter.dev/to/resolution-aware-images
56+
57+
# To add custom fonts to your plugin package, add a fonts section here,
58+
# in this "flutter" section. Each entry in this list should have a
59+
# "family" key with the font family name, and a "fonts" key with a
60+
# list giving the asset and other descriptors for the font. For
61+
# example:
62+
# fonts:
63+
# - family: Schyler
64+
# fonts:
65+
# - asset: fonts/Schyler-Regular.ttf
66+
# - asset: fonts/Schyler-Italic.ttf
67+
# style: italic
68+
# - family: Trajan Pro
69+
# fonts:
70+
# - asset: fonts/TrajanPro.ttf
71+
# - asset: fonts/TrajanPro_Bold.ttf
72+
# weight: 700
73+
#
74+
# For details regarding fonts in packages, see
75+
# https://flutter.dev/to/font-from-package

0 commit comments

Comments
 (0)