Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .idea/libraries/Dart_SDK.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/libraries/KotlinJavaRuntime.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/runConfigurations/main_dart.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions .metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.

version:
revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
- platform: macos
create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
12 changes: 3 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@
"type": "dart",
"request": "attach",
"osx": {
"deviceId": "macos",
"serviceInfoFile": "${env:TMPDIR}vmservice.nativeshell_examples",
"vmServiceInfoFile": "${env:TMPDIR}vmservice.nativeshell_examples"
},
"windows": {
"deviceId": "windows",
"serviceInfoFile": "${env:TEMP}/vmservice.nativeshell_examples",
"vmServiceInfoFile": "${env:TEMP}/vmservice.nativeshell_examples"
"serviceInfoFile": "${env:TEMP}/vmservice.nativeshell_examples"
},
"linux": {
"deviceId": "linux",
"serviceInfoFile": "${env:XDG_RUNTIME_DIR}/vmservice.nativeshell_examples",
"vmServiceInfoFile": "${env:XDG_RUNTIME_DIR}/vmservice.nativeshell_examples"
"serviceInfoFile": "${env:XDG_RUNTIME_DIR}/vmservice.nativeshell_examples"
}
},
]
}
}
18 changes: 18 additions & 0 deletions examples.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>
5 changes: 2 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:nativeshell/nativeshell.dart';

import 'pages/other_window.dart';
import 'pages/platform_channels.dart';
import 'main_window.dart';
import 'pages/modal_window.dart';
import 'pages/other_window.dart';
import 'pages/platform_channels.dart';
import 'widgets/veil.dart';

void main() async {
Expand Down
45 changes: 23 additions & 22 deletions lib/main_window.dart
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:nativeshell/nativeshell.dart';
import 'package:nativeshell/nativeshell.dart' as nshell;
import 'package:nativeshell_examples/pages/flutter_plugins.dart';

import 'main.dart';
import 'widgets/button.dart';
import 'pages/window_management.dart';
import 'pages/drag_drop.dart';
import 'pages/file_open_dialog.dart';
import 'pages/menu.dart';
import 'widgets/page.dart';
import 'pages/platform_channels.dart';
import 'pages/window_management.dart';
import 'widgets/button.dart';
import 'widgets/page.dart';

class MainWindowState extends WindowState {
class MainWindowState extends nshell.WindowState {
@override
Widget build(BuildContext context) {
return ExamplesWindow(child: MainWindow());
}

@override
WindowSizingMode get windowSizingMode =>
WindowSizingMode.atLeastIntrinsicSize;
nshell.WindowSizingMode get windowSizingMode =>
nshell.WindowSizingMode.atLeastIntrinsicSize;

@override
Future<void> initializeWindow(Size intrinsicContentSize) async {
if (Platform.isMacOS) {
await Menu(_buildMenu).setAsAppMenu();
await nshell.Menu(_buildMenu).setAsAppMenu();
}
await window.setTitle('NativeShell Examples');
return super.initializeWindow(intrinsicContentSize);
Expand All @@ -38,18 +35,22 @@ class MainWindowState extends WindowState {

// This will be the default "fallback" app menu used for any window that doesn't
// have other menu
List<MenuItem> _buildMenu() => [
MenuItem.children(title: 'App', children: [
MenuItem.withRole(role: MenuItemRole.hide),
MenuItem.withRole(role: MenuItemRole.hideOtherApplications),
MenuItem.withRole(role: MenuItemRole.showAll),
MenuItem.separator(),
MenuItem.withRole(role: MenuItemRole.quitApplication),
]),
MenuItem.children(title: 'Window', role: MenuRole.window, children: [
MenuItem.withRole(role: MenuItemRole.minimizeWindow),
MenuItem.withRole(role: MenuItemRole.zoomWindow),
List<nshell.MenuItem> _buildMenu() => [
nshell.MenuItem.children(title: 'App', children: [
nshell.MenuItem.withRole(role: nshell.MenuItemRole.hide),
nshell.MenuItem.withRole(
role: nshell.MenuItemRole.hideOtherApplications),
nshell.MenuItem.withRole(role: nshell.MenuItemRole.showAll),
nshell.MenuItem.separator(),
nshell.MenuItem.withRole(role: nshell.MenuItemRole.quitApplication),
]),
nshell.MenuItem.children(
title: 'Window',
role: nshell.MenuRole.window,
children: [
nshell.MenuItem.withRole(role: nshell.MenuItemRole.minimizeWindow),
nshell.MenuItem.withRole(role: nshell.MenuItemRole.zoomWindow),
]),
];

class Page {
Expand Down
Loading