diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index 592ceee..ec97fc6 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index 592ceee..c4855bf 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 0000000..88359b2 --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,41 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '11.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/lib/extension/extension.dart b/lib/extension/extension.dart new file mode 100644 index 0000000..40643f0 --- /dev/null +++ b/lib/extension/extension.dart @@ -0,0 +1,94 @@ +import 'dart:collection'; + +import 'package:flutter/material.dart'; + +const designWidth = 360; + +Size screenSize = const Size(360, 690); + +extension IterableExtension on Iterable { + E? getOrNull(int index) { + if (index >= 0 && index < length) { + return elementAt(index); + } + return null; + } + + Queue toQueue() { + return Queue.from(this); + } +} + +extension ListExtention on List { + E? get firstOrNull { + Iterator it = iterator; + if (!it.moveNext()) { + return null; + } + return it.current; + } + + E? getAllowOverflow(int index) { + if (index >= length) { + return null; + } + return this[index]; + } + + E? firstOrNullWhere(bool test(E element)) { + for (E element in this) { + if (test(element)) return element; + } + return null; + } +} + +extension MapExtention on Map { + dynamic get(dynamic key) { + return this[key]; + } +} + +extension ScopeFunc on T { + R let(R Function(T it) op) => op(this); + + T also(void Function(T it) op) { + op(this); + return this; + } +} + +extension DoubleGap on double { + SizedBox get gapColumn => SizedBox(height: this); + + SizedBox get gapRow => SizedBox(width: this); + + double get dp => this * screenSize.width / designWidth; +} + +extension IntGap on int { + SizedBox get gapColumn => SizedBox(height: toDouble()); + + Widget gapColumnWithBg(Color color) => Container(color: color, height: toDouble()); + + SizedBox get gapRow => SizedBox(width: toDouble()); + + double get dp => this * screenSize.width / designWidth; +} + +extension Localization on String { + Text toText({ + double? size, + Color? color, + FontWeight weight = FontWeight.w400, + double? lineHeight, + TextStyle? style, + }) { + size ??= 16.dp; + style ??= TextStyle(fontWeight: weight, fontSize: size, color: color); + if (lineHeight != null) { + style = style.copyWith(height: lineHeight / size); + } + return Text(this, style: style); + } +} diff --git a/lib/image/drag.dart b/lib/image/drag.dart new file mode 100644 index 0000000..016009d --- /dev/null +++ b/lib/image/drag.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; + +class DraggableArea extends StatefulWidget { + final Widget child; + + const DraggableArea({ + Key? key, + required this.child, + this.moveChanged, + this.dx = 0, + this.dy = 0, + }) : super(key: key); + final Function(double dx, double dy)? moveChanged; + final double dx; + final double dy; + + @override + State createState() => _DraggableAreaState(); +} + +class _DraggableAreaState extends State { + late double left = widget.dx; + late double top = widget.dy; + + double? first; + double? end; + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Positioned( + left: left, + top: top, + child: Draggable( + feedback: widget.child, + childWhenDragging: const SizedBox.shrink(), + onDragUpdate: (u) => onUpdate(u), + onDragEnd: (detail) => onEnd(detail.offset), + child: widget.child, + ), + ), + ], + ); + } + + void onEnd(Offset offset) { + left = offset.dx; + top = top + (end ?? 0) - (first ?? 0); + first = null; + end = null; + widget.moveChanged?.call(left, top); + } + + onUpdate(DragUpdateDetails u) { + first ??= u.globalPosition.dy; + end = u.globalPosition.dy; + } +} diff --git a/lib/image/image_page.dart b/lib/image/image_page.dart new file mode 100644 index 0000000..984370a --- /dev/null +++ b/lib/image/image_page.dart @@ -0,0 +1,233 @@ +import 'package:bot_toast/bot_toast.dart'; +import 'package:extended_image/extended_image.dart'; +import 'package:file_picker/file_picker.dart'; +import 'package:flutter/material.dart'; +import 'package:px_eye/extension/extension.dart'; +import 'package:px_eye/image/drag.dart'; +import 'package:px_eye/widget/button.dart'; +import 'package:window_manager/window_manager.dart'; + +class ImagePage extends StatefulWidget { + const ImagePage({Key? key}) : super(key: key); + + @override + State createState() => _ImagePageState(); +} + +class _ImagePageState extends State with WindowListener { + File? image; + File? image2; + bool isImageSelected1 = true; + bool isImageSelected2 = true; + double opacity1 = 1; + double opacity2 = 1; + double opacityWindow = 1; + + double offsetDx1 = 0; + double offsetDy1 = 0; + double offsetDx2 = 0; + double offsetDy2 = 0; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Image Comparison'), + actions: [ + SizedBox( + width: 50.dp, + child: EasyButton( + color: Colors.blue, + text: 'reset', + onPressed: () { + offsetDx1 = 0; + offsetDy1 = 0; + offsetDx2 = 0; + offsetDy2 = 0; + setState(() {}); + }), + ) + ], + ), + body: Column( + children: [ + Row( + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: 'Window Opacity'.toText(size: 12.dp), + ), + Expanded( + child: Slider( + value: opacityWindow, + onChanged: (v) { + opacityWindow = v; + windowManager.setOpacity(opacityWindow); + setState(() {}); + }, + ), + ), + ], + ), + getSelectedButton(), + 5.gapColumnWithBg(Colors.grey.shade300), + Expanded( + child: Stack( + children: [ + getImageView( + image, + selectImage1, + opacity1, + show: isImageSelected1, + moveChanged: (dx, dy) { + offsetDx1 = dx; + offsetDy1 = dy; + setState(() {}); + }, + dx: offsetDx1, + dy: offsetDy1, + ), + getImageView( + image2, + selectImage2, + opacity2, + show: isImageSelected2, + moveChanged: (dx, dy) { + offsetDx2 = dx; + offsetDy2 = dy; + setState(() {}); + }, + dx: offsetDx2, + dy: offsetDy2, + ), + ], + ), + ), + ], + )); + } + + Widget getImageView( + File? imageFile, + VoidCallback callback, + double opacity, { + bool show = true, + double dx = 0, + double dy = 0, + Function(double dx, double dy)? moveChanged, + }) { + if (!show || imageFile == null) { + return const SizedBox(); + } + var width = MediaQuery.of(context).size.width - 100; + return DraggableArea( + key: ValueKey('${DateTime.now()}'), + dx: dx, + dy: dy, + moveChanged: moveChanged, + child: Opacity( + opacity: opacity, + child: SizedBox( + width: width, + child: getImage(imageFile), + ), + ), + ); + } + + Widget getImage(File imageFile) { + return Image.file( + imageFile, + fit: BoxFit.fitWidth, + ); + } + + Future selectImage() async { + BotToast.showLoading(); + FilePickerResult? result = await FilePicker.platform.pickFiles(); + BotToast.cleanAll(); + var path = result?.files.single.path; + if (path != null) { + return File(path); + } + return null; + } + + Widget getSelectedButton() { + return Container( + margin: EdgeInsets.symmetric(vertical: 5.dp), + height: 20.dp, + child: Row( + children: [ + SizedBox( + width: 20.dp, + height: 20.dp, + child: Switch( + value: isImageSelected1, + onChanged: (v) { + isImageSelected1 = v; + setState(() {}); + }, + ), + ), + SizedBox( + width: 50.dp, + child: EasyButton(text: 'image1', onPressed: selectImage1, type: image != null ? ButtonType.secondary : ButtonType.primary), + ), + SizedBox( + width: 80.dp, + child: Slider( + value: opacity1, + onChanged: (v) { + opacity1 = v; + setState(() {}); + }, + ), + ), + const Spacer(), + SizedBox( + width: 20.dp, + height: 20.dp, + child: Switch( + value: isImageSelected2, + onChanged: (v) { + isImageSelected2 = v; + setState(() {}); + }, + ), + ), + SizedBox( + width: 50.dp, + child: EasyButton(text: 'image2', onPressed: selectImage2, type: image2 != null ? ButtonType.secondary : ButtonType.primary), + ), + SizedBox( + width: 80.dp, + child: Slider( + value: opacity2, + onChanged: (v) { + opacity2 = v; + setState(() {}); + }, + ), + ) + ], + ), + ); + } + + void selectImage1() async { + image = await selectImage(); + setState(() {}); + } + + void selectImage2() async { + image2 = await selectImage(); + setState(() {}); + } + + @override + void onWindowResize() { + setState(() {}); + super.onWindowResize(); + } +} diff --git a/lib/main.dart b/lib/main.dart index 008fa38..032dd5a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,25 @@ +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:px_eye/image/image_page.dart'; +import 'package:px_eye/widget/button.dart'; +import 'package:window_manager/window_manager.dart'; + +import 'extension/extension.dart'; + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + // Must add this line. + await windowManager.ensureInitialized(); + + WindowOptions windowOptions = const WindowOptions( + size: Size(800, 1600), + ); + windowManager.waitUntilReadyToShow(windowOptions, () async { + await windowManager.show(); + await windowManager.focus(); + }); -void main() { runApp(const MyApp()); } @@ -11,20 +30,18 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Demo', + debugShowCheckedModeBanner: false, + builder: BotToastInit(), + title: 'Pixel eye', theme: ThemeData( - // This is the theme of your application. - // - // Try running your application with "flutter run". You'll see the - // application has a blue toolbar. Then, without quitting the app, try - // changing the primarySwatch below to Colors.green and then invoke - // "hot reload" (press "r" in the console where you ran "flutter run", - // or simply save your changes to "hot reload" in a Flutter IDE). - // Notice that the counter didn't reset back to zero; the application - // is not restarted. - primarySwatch: Colors.blue, + primaryColor: Colors.transparent, ), - home: const MyHomePage(title: 'Flutter Demo Home Page'), + navigatorObservers: [BotToastNavigatorObserver()], + //2. registered route observer + home: Builder(builder: (context) { + screenSize = MediaQuery.of(context).size; + return const MyHomePage(title: 'Pixel eye'); + }), ); } } @@ -32,15 +49,6 @@ class MyApp extends StatelessWidget { class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); - // This widget is the home page of your application. It is stateful, meaning - // that it has a State object (defined below) that contains fields that affect - // how it looks. - - // This class is the configuration for the state. It holds the values (in this - // case the title) provided by the parent (in this case the App widget) and - // used by the build method of the State. Fields in a Widget subclass are - // always marked "final". - final String title; @override @@ -48,68 +56,89 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - int _counter = 0; + int width = 800; + int height = 1600; - void _incrementCounter() { - setState(() { - // This call to setState tells the Flutter framework that something has - // changed in this State, which causes it to rerun the build method below - // so that the display can reflect the updated values. If we changed - // _counter without calling setState(), then the build method would not be - // called again, and so nothing would appear to happen. - _counter++; - }); + Future onClickEnter() async { + resetScreen(); + Navigator.push( + context, + PageRouteBuilder( + opaque: false, + pageBuilder: (_, __, ___) => const ImagePage(), + )); + } + + Future resetScreen() async { + var size = Size(width.toDouble(), height.toDouble()); + Offset newPosition = await calcWindowPosition(size, Alignment.center); + await windowManager.setBounds(null, position: newPosition, size: size, animate: true); + setState(() {}); } @override Widget build(BuildContext context) { - // This method is rerun every time setState is called, for instance as done - // by the _incrementCounter method above. - // - // The Flutter framework has been optimized to make rerunning build methods - // fast, so that you can just rebuild anything that needs updating rather - // than having to individually change instances of widgets. return Scaffold( appBar: AppBar( - // Here we take the value from the MyHomePage object that was created by - // the App.build method, and use it to set our appbar title. title: Text(widget.title), ), body: Center( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. - child: Column( - // Column is also a layout widget. It takes a list of children and - // arranges them vertically. By default, it sizes itself to fit its - // children horizontally, and tries to be as tall as its parent. - // - // Invoke "debug painting" (press "p" in the console, choose the - // "Toggle Debug Paint" action from the Flutter Inspector in Android - // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) - // to see the wireframe for each widget. - // - // Column has various properties to control how it sizes itself and - // how it positions its children. Here we use mainAxisAlignment to - // center the children vertically; the main axis here is the vertical - // axis because Columns are vertical (the cross axis would be - // horizontal). - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - 'You have pushed the button this many times:', - ), - Text( - '$_counter', - style: Theme.of(context).textTheme.headlineMedium, - ), - ], + child: Padding( + padding: EdgeInsets.all(8.dp), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + children: [ + 'width:'.toText(size: 9.dp), + SizedBox( + height: 20.dp, + width: 50.dp, + child: TextField( + controller: TextEditingController(text: '$width'), + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + onChanged: (number) { + width = int.tryParse(number) ?? 800; + }, + style: TextStyle(fontSize: 14.dp, fontWeight: FontWeight.w600), + decoration: InputDecoration( + contentPadding: EdgeInsets.all(2.dp), + hintStyle: TextStyle(fontSize: 14.dp, color: Colors.grey, fontWeight: FontWeight.w600), + ), + onSubmitted: (_) => onClickEnter(), + ), + ), + 'height:'.toText(size: 9.dp), + SizedBox( + height: 20.dp, + width: 50.dp, + child: TextField( + controller: TextEditingController(text: '$height'), + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + onChanged: (number) { + height = int.tryParse(number) ?? 800; + }, + style: TextStyle(fontSize: 14.dp, fontWeight: FontWeight.w600), + decoration: InputDecoration( + contentPadding: EdgeInsets.all(2.dp), + hintStyle: TextStyle(fontSize: 14.dp, color: Colors.grey, fontWeight: FontWeight.w600), + ), + onSubmitted: (_) => onClickEnter(), + ), + ), + ], + ), + 5.dp.gapColumn, + EasyButton( + text: 'Enter', + onPressed: () => onClickEnter(), + ), + ], + ), ), ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), // This trailing comma makes auto-formatting nicer for build methods. ); } } diff --git a/lib/widget/button.dart b/lib/widget/button.dart new file mode 100644 index 0000000..b79d078 --- /dev/null +++ b/lib/widget/button.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; + +enum ButtonType { primary, secondary } + +class EasyButton extends StatelessWidget { + const EasyButton({ + Key? key, + required this.text, + required this.onPressed, + this.type = ButtonType.primary, + this.padding, + this.height = 48, + this.minWidth = double.infinity, + this.borderSide, + this.textColor, + this.color, + this.fontWeight, + this.borderRadius = 6, + }) : super(key: key); + + final String text; + final VoidCallback? onPressed; + final ButtonType type; + final EdgeInsets? padding; + final double height; + final double minWidth; + final BorderSide? borderSide; + final Color? textColor; + final Color? color; + final FontWeight? fontWeight; + final double borderRadius; + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.transparent, + padding: padding, + child: TextButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.resolveWith((Set states) { + if (states.contains(MaterialState.disabled)) { + return Colors.grey.withOpacity(0.5); + } + return color ?? (type == ButtonType.secondary ? Colors.white : Colors.blue); + }), + foregroundColor: MaterialStateProperty.resolveWith((Set states) { + if (states.contains(MaterialState.disabled)) { + return Colors.grey.withOpacity(0.1); + } + return color ?? (type == ButtonType.secondary ? Colors.white : Colors.blue); + }), + minimumSize: MaterialStateProperty.all(Size(minWidth, height)), + shape: MaterialStateProperty.all( + RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(borderRadius)), + side: type == ButtonType.secondary ? borderSide ?? BorderSide(color: Colors.grey.withOpacity(0.9)) : BorderSide.none, + ), + ), + ), + onPressed: onPressed, + child: Text( + text, + style: TextStyle( + fontWeight: fontWeight ?? FontWeight.normal, + fontSize: 20, + color: textColor ?? (type == ButtonType.secondary ? Colors.grey : Colors.white)), + ), + ), + ); + } +} diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index e71a16d..b7a6d08 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,6 +6,14 @@ #include "generated_plugin_registrant.h" +#include +#include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) screen_retriever_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin"); + screen_retriever_plugin_register_with_registrar(screen_retriever_registrar); + g_autoptr(FlPluginRegistrar) window_manager_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "WindowManagerPlugin"); + window_manager_plugin_register_with_registrar(window_manager_registrar); } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 2e1de87..913ac71 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,6 +3,8 @@ # list(APPEND FLUTTER_PLUGIN_LIST + screen_retriever + window_manager ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/macos/Flutter/Flutter-Debug.xcconfig b/macos/Flutter/Flutter-Debug.xcconfig index c2efd0b..4b81f9b 100644 --- a/macos/Flutter/Flutter-Debug.xcconfig +++ b/macos/Flutter/Flutter-Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/Flutter-Release.xcconfig b/macos/Flutter/Flutter-Release.xcconfig index c2efd0b..5caa9d1 100644 --- a/macos/Flutter/Flutter-Release.xcconfig +++ b/macos/Flutter/Flutter-Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817..3e13b0f 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,12 @@ import FlutterMacOS import Foundation +import path_provider_foundation +import screen_retriever +import window_manager func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin")) + WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin")) } diff --git a/macos/Podfile b/macos/Podfile new file mode 100644 index 0000000..049abe2 --- /dev/null +++ b/macos/Podfile @@ -0,0 +1,40 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/macos/Podfile.lock b/macos/Podfile.lock new file mode 100644 index 0000000..1abedd9 --- /dev/null +++ b/macos/Podfile.lock @@ -0,0 +1,35 @@ +PODS: + - FlutterMacOS (1.0.0) + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + - screen_retriever (0.0.1): + - FlutterMacOS + - window_manager (0.2.0): + - FlutterMacOS + +DEPENDENCIES: + - FlutterMacOS (from `Flutter/ephemeral`) + - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`) + - screen_retriever (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos`) + - window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`) + +EXTERNAL SOURCES: + FlutterMacOS: + :path: Flutter/ephemeral + path_provider_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos + screen_retriever: + :path: Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos + window_manager: + :path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos + +SPEC CHECKSUMS: + FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 + path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9 + screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38 + window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8 + +PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 + +COCOAPODS: 1.11.3 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 99578a2..7b0d1a4 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -26,6 +26,7 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 715AA16F6614306C8EF1870A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C83B38EF926F3AAFC60C0D8 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -54,7 +55,7 @@ /* Begin PBXFileReference section */ 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* px_eye.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "px_eye.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* px_eye.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = px_eye.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -66,8 +67,12 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 42436F2CD57601937C0CC984 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 7F08B4BFB2C8A895759CF7B4 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + 9C83B38EF926F3AAFC60C0D8 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F033D757A5BCA22080B7A2C4 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -75,6 +80,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 715AA16F6614306C8EF1870A /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -99,6 +105,7 @@ 33CEB47122A05771004F2AC0 /* Flutter */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, + 80EC868AC06C55E0766CECAA /* Pods */, ); sourceTree = ""; }; @@ -145,9 +152,21 @@ path = Runner; sourceTree = ""; }; + 80EC868AC06C55E0766CECAA /* Pods */ = { + isa = PBXGroup; + children = ( + F033D757A5BCA22080B7A2C4 /* Pods-Runner.debug.xcconfig */, + 42436F2CD57601937C0CC984 /* Pods-Runner.release.xcconfig */, + 7F08B4BFB2C8A895759CF7B4 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( + 9C83B38EF926F3AAFC60C0D8 /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -159,11 +178,13 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + AA55441720BF8E0EEAF94A95 /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, + 31459F372A1F092FB7841232 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -233,6 +254,23 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 31459F372A1F092FB7841232 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -271,6 +309,28 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; + AA55441720BF8E0EEAF94A95 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/macos/Runner.xcworkspace/contents.xcworkspacedata b/macos/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/macos/Runner/MainFlutterWindow.swift b/macos/Runner/MainFlutterWindow.swift index 2722837..f99a7e3 100644 --- a/macos/Runner/MainFlutterWindow.swift +++ b/macos/Runner/MainFlutterWindow.swift @@ -2,12 +2,29 @@ import Cocoa import FlutterMacOS class MainFlutterWindow: NSWindow { +// +// override init(contentRect: NSRect, styleMask style: NSWindow.StyleMask, backing backingStoreType: NSWindow.BackingStoreType, defer flag: Bool) { +// super.init(contentRect: contentRect, styleMask: style, backing: backingStoreType, defer: flag) +// +// +// self.isOpaque = false +// self.hasShadow = false +// self.backgroundColor = NSColor(red: 1, green: 0.5, blue: 0.5, alpha: 0.5) +// // Change the title bar appereance +// self.title = "My Custom Title" +// //self.titleVisibility = .hidden +// self.titlebarAppearsTransparent = true +// +// } override func awakeFromNib() { let flutterViewController = FlutterViewController.init() let windowFrame = self.frame +// self.isOpaque = false +// self.backgroundColor = NSColor(red: 1, green: 0.5, blue: 0.5, alpha: 0.5) self.contentViewController = flutterViewController self.setFrame(windowFrame, display: true) + RegisterGeneratedPlugins(registry: flutterViewController) super.awakeFromNib() diff --git a/pubspec.lock b/pubspec.lock index 087b13b..e4ff08a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -17,6 +17,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + bot_toast: + dependency: "direct main" + description: + name: bot_toast + sha256: "19306147033316a7873c5d261b874fca3f341c05e4e1c12be56153ad11187edd" + url: "https://pub.dev" + source: hosted + version: "4.0.3" characters: dependency: transitive description: @@ -41,6 +49,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.17.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + url: "https://pub.dev" + source: hosted + version: "3.0.2" cupertino_icons: dependency: "direct main" description: @@ -49,6 +65,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" + extended_image: + dependency: "direct main" + description: + name: extended_image + sha256: f6728c46e2c770be807c5e741a080b8751d5be280332103869049ecacdcf6845 + url: "https://pub.dev" + source: hosted + version: "4.2.1" + extended_image_library: + dependency: transitive + description: + name: extended_image_library + sha256: b1de389378589e4dffb3564d782373238f19064037458092c49b3043b2791b2b + url: "https://pub.dev" + source: hosted + version: "3.4.1" fake_async: dependency: transitive description: @@ -57,6 +89,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + file: + dependency: transitive + description: + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + file_picker: + dependency: "direct main" + description: + name: file_picker + sha256: dd328189f2f4ccea042bb5b382d5e981691cc74b5a3429b9317bff2b19704489 + url: "https://pub.dev" + source: hosted + version: "5.2.8" flutter: dependency: "direct main" description: flutter @@ -70,11 +126,48 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: c224ac897bed083dabf11f238dd11a239809b446740be0c2044608c50029ffdf + url: "https://pub.dev" + source: hosted + version: "2.0.9" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + http: + dependency: transitive + description: + name: http + sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482" + url: "https://pub.dev" + source: hosted + version: "0.13.5" + http_client_helper: + dependency: transitive + description: + name: http_client_helper + sha256: "1f32359bd07a064ad256d1f84ae5f973f69bc972e7287223fa198abe1d969c28" + url: "https://pub.dev" + source: hosted + version: "2.0.3" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" js: dependency: transitive description: @@ -123,6 +216,86 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.2" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: c7edf82217d4b2952b2129a61d3ad60f1075b9299e629e149a8d2e39c2e6aad4 + url: "https://pub.dev" + source: hosted + version: "2.0.14" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "019f18c9c10ae370b08dce1f3e3b73bc9f58e7f087bb5e921f06529438ac0ae7" + url: "https://pub.dev" + source: hosted + version: "2.0.24" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: ad4c4d011830462633f03eb34445a45345673dfd4faf1ab0b4735fbd93b19183 + url: "https://pub.dev" + source: hosted + version: "2.2.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: "2ae08f2216225427e64ad224a24354221c2c7907e448e6e0e8b57b1eb9f10ad1" + url: "https://pub.dev" + source: hosted + version: "2.1.10" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec" + url: "https://pub.dev" + source: hosted + version: "2.0.6" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: f53720498d5a543f9607db4b0e997c4b5438884de25b0f73098cc2671a51b130 + url: "https://pub.dev" + source: hosted + version: "2.1.5" + platform: + dependency: transitive + description: + name: platform + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + process: + dependency: transitive + description: + name: process + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + url: "https://pub.dev" + source: hosted + version: "4.2.4" + screen_retriever: + dependency: transitive + description: + name: screen_retriever + sha256: "4931f226ca158123ccd765325e9fbf360bfed0af9b460a10f960f9bb13d58323" + url: "https://pub.dev" + source: hosted + version: "0.1.6" sky_engine: dependency: transitive description: flutter @@ -176,6 +349,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.16" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + url: "https://pub.dev" + source: hosted + version: "1.3.1" vector_math: dependency: transitive description: @@ -184,5 +365,30 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + win32: + dependency: transitive + description: + name: win32 + sha256: a6f0236dbda0f63aa9a25ad1ff9a9d8a4eaaa5012da0dc59d21afdb1dc361ca4 + url: "https://pub.dev" + source: hosted + version: "3.1.4" + window_manager: + dependency: "direct main" + description: + name: window_manager + sha256: "2b2572442b2a5178642730442dc625ac088244f5827b1f0811371b1b7485eb62" + url: "https://pub.dev" + source: hosted + version: "0.3.2" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1 + url: "https://pub.dev" + source: hosted + version: "1.0.0" sdks: dart: ">=2.19.4 <3.0.0" + flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 7db734a..abc776e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,6 +31,10 @@ dependencies: flutter: sdk: flutter + file_picker: ^5.2.8 + bot_toast: ^4.0.3 + extended_image: ^4.0.0 + window_manager: ^0.3.2 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 8b6d468..d6b86fa 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,12 @@ #include "generated_plugin_registrant.h" +#include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + ScreenRetrieverPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("ScreenRetrieverPlugin")); + WindowManagerPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("WindowManagerPlugin")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b93c4c3..bfa52f4 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,8 @@ # list(APPEND FLUTTER_PLUGIN_LIST + screen_retriever + window_manager ) list(APPEND FLUTTER_FFI_PLUGIN_LIST