Skip to content

Commit

Permalink
testing multi windows
Browse files Browse the repository at this point in the history
  • Loading branch information
IoannisMaras committed Jul 9, 2022
1 parent 712d0dd commit 0ba45e9
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 33 deletions.
21 changes: 21 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.19041.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
68 changes: 35 additions & 33 deletions lib/event_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,44 +90,46 @@ class _EventWidgetState extends State<EventWidget> {
debugPrint("onSend result: $result");
}

return Column(
children: [
Expanded(
child: ListView.builder(
itemCount: messages.length,
reverse: true,
itemBuilder: (context, index) =>
_MessageItemWidget(item: messages[index]),
return Scaffold(
body: Column(
children: [
Expanded(
child: ListView.builder(
itemCount: messages.length,
reverse: true,
itemBuilder: (context, index) =>
_MessageItemWidget(item: messages[index]),
),
),
),
Row(
children: [
SizedBox(
width: 100,
child: TextField(
controller: windowInputController,
decoration: const InputDecoration(
labelText: 'Window ID',
Row(
children: [
SizedBox(
width: 100,
child: TextField(
controller: windowInputController,
decoration: const InputDecoration(
labelText: 'Window ID',
),
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
),
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
),
),
Expanded(
child: TextField(
controller: textInputController,
decoration: const InputDecoration(
hintText: 'Enter message',
Expanded(
child: TextField(
controller: textInputController,
decoration: const InputDecoration(
hintText: 'Enter message',
),
onSubmitted: (text) => submit(),
),
onSubmitted: (text) => submit(),
),
),
IconButton(
icon: const Icon(Icons.send),
onPressed: submit,
),
],
),
],
IconButton(
icon: const Icon(Icons.send),
onPressed: submit,
),
],
),
],
),
);
}
}
Expand Down
9 changes: 9 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import 'package:atlantas_windows/event_widget.dart';
import 'dart:ui';

import 'package:bitsdojo_window/bitsdojo_window.dart';

void main(List<String> args) {
if (args.firstOrNull == 'multi_window') {
final windowId = int.parse(args[1]);
Expand All @@ -20,6 +22,13 @@ void main(List<String> args) {
} else {
runApp(const _ExampleMainWindow());
}
doWhenWindowReady(() {
const initialSize = Size(600, 450);
appWindow.minSize = initialSize;
appWindow.size = initialSize;
appWindow.alignment = Alignment.center;
appWindow.show();
});
}

class _ExampleMainWindow extends StatefulWidget {
Expand Down
4 changes: 4 additions & 0 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@

#include "generated_plugin_registrant.h"

#include <bitsdojo_window_linux/bitsdojo_window_plugin.h>
#include <desktop_lifecycle/desktop_lifecycle_plugin.h>
#include <desktop_multi_window/desktop_multi_window_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) bitsdojo_window_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "BitsdojoWindowPlugin");
bitsdojo_window_plugin_register_with_registrar(bitsdojo_window_linux_registrar);
g_autoptr(FlPluginRegistrar) desktop_lifecycle_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopLifecyclePlugin");
desktop_lifecycle_plugin_register_with_registrar(desktop_lifecycle_registrar);
Expand Down
1 change: 1 addition & 0 deletions linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
bitsdojo_window_linux
desktop_lifecycle
desktop_multi_window
)
Expand Down
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import FlutterMacOS
import Foundation

import bitsdojo_window_macos
import desktop_lifecycle
import desktop_multi_window

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
BitsdojoWindowPlugin.register(with: registry.registrar(forPlugin: "BitsdojoWindowPlugin"))
DesktopLifecyclePlugin.register(with: registry.registrar(forPlugin: "DesktopLifecyclePlugin"))
FlutterMultiWindowPlugin.register(with: registry.registrar(forPlugin: "FlutterMultiWindowPlugin"))
}
56 changes: 56 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,41 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
bitsdojo_window:
dependency: "direct main"
description:
name: bitsdojo_window
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
bitsdojo_window_linux:
dependency: transitive
description:
name: bitsdojo_window_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
bitsdojo_window_macos:
dependency: transitive
description:
name: bitsdojo_window_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
bitsdojo_window_platform_interface:
dependency: transitive
description:
name: bitsdojo_window_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
bitsdojo_window_windows:
dependency: transitive
description:
name: bitsdojo_window_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -71,6 +106,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -123,6 +165,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -177,6 +226,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
sdks:
dart: ">=2.17.1 <3.0.0"
flutter: ">=2.5.0"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies:
cupertino_icons: ^1.0.2
desktop_lifecycle: ^0.1.0
desktop_multi_window: ^0.0.2
bitsdojo_window: ^0.1.2

dev_dependencies:
flutter_test:
Expand Down
3 changes: 3 additions & 0 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@

#include "generated_plugin_registrant.h"

#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
#include <desktop_lifecycle/desktop_lifecycle_plugin.h>
#include <desktop_multi_window/desktop_multi_window_plugin.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
BitsdojoWindowPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("BitsdojoWindowPlugin"));
DesktopLifecyclePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DesktopLifecyclePlugin"));
DesktopMultiWindowPluginRegisterWithRegistrar(
Expand Down
1 change: 1 addition & 0 deletions windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
bitsdojo_window_windows
desktop_lifecycle
desktop_multi_window
)
Expand Down
3 changes: 3 additions & 0 deletions windows/runner/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
auto bdw = bitsdojo_window_configure(BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP);

#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <windows.h>
Expand Down

0 comments on commit 0ba45e9

Please sign in to comment.