From daf39ce7584000df81362502e03ba61d356fe7af Mon Sep 17 00:00:00 2001 From: Eric Windmill Date: Wed, 15 Apr 2026 11:45:24 -0700 Subject: [PATCH] refactor: remove window_size plugin and manual window configuration from samples --- animations/lib/main.dart | 27 ------------------- .../flutter/generated_plugin_registrant.cc | 4 --- .../linux/flutter/generated_plugins.cmake | 1 - .../Flutter/GeneratedPluginRegistrant.swift | 2 -- animations/pubspec.yaml | 4 --- .../flutter/generated_plugin_registrant.cc | 3 --- .../windows/flutter/generated_plugins.cmake | 1 - cupertino_gallery/pubspec.yaml | 1 + desktop_photo_search/fluent_ui/lib/main.dart | 13 +-------- desktop_photo_search/fluent_ui/pubspec.yaml | 4 --- desktop_photo_search/material/lib/main.dart | 15 ----------- desktop_photo_search/material/pubspec.yaml | 4 --- form_app/lib/main.dart | 24 +---------------- form_app/pubspec.yaml | 4 --- navigation_and_routing/lib/main.dart | 21 +-------------- navigation_and_routing/pubspec.yaml | 5 +--- 16 files changed, 5 insertions(+), 128 deletions(-) diff --git a/animations/lib/main.dart b/animations/lib/main.dart index fda00fdf6..21150f483 100644 --- a/animations/lib/main.dart +++ b/animations/lib/main.dart @@ -2,43 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:io' show Platform; - -import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; -import 'package:window_size/window_size.dart'; import 'src/basics/basics.dart'; import 'src/misc/misc.dart'; void main() { - setupWindow(); runApp(const AnimationSamples()); } -const double windowWidth = 480; -const double windowHeight = 854; - -void setupWindow() { - if (!kIsWeb && - (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) { - WidgetsFlutterBinding.ensureInitialized(); - setWindowTitle('Animation Samples'); - setWindowMinSize(const Size(windowWidth, windowHeight)); - setWindowMaxSize(const Size(windowWidth, windowHeight)); - getCurrentScreen().then((screen) { - setWindowFrame( - Rect.fromCenter( - center: screen!.frame.center, - width: windowWidth, - height: windowHeight, - ), - ); - }); - } -} - class Demo { final String name; final String route; diff --git a/animations/linux/flutter/generated_plugin_registrant.cc b/animations/linux/flutter/generated_plugin_registrant.cc index 9f8c70320..e71a16d23 100644 --- a/animations/linux/flutter/generated_plugin_registrant.cc +++ b/animations/linux/flutter/generated_plugin_registrant.cc @@ -6,10 +6,6 @@ #include "generated_plugin_registrant.h" -#include void fl_register_plugins(FlPluginRegistry* registry) { - g_autoptr(FlPluginRegistrar) window_size_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "WindowSizePlugin"); - window_size_plugin_register_with_registrar(window_size_registrar); } diff --git a/animations/linux/flutter/generated_plugins.cmake b/animations/linux/flutter/generated_plugins.cmake index 12c7443ed..2e1de87a7 100644 --- a/animations/linux/flutter/generated_plugins.cmake +++ b/animations/linux/flutter/generated_plugins.cmake @@ -3,7 +3,6 @@ # list(APPEND FLUTTER_PLUGIN_LIST - window_size ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/animations/macos/Flutter/GeneratedPluginRegistrant.swift b/animations/macos/Flutter/GeneratedPluginRegistrant.swift index f5cde84ba..cccf817a5 100644 --- a/animations/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/animations/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,8 +5,6 @@ import FlutterMacOS import Foundation -import window_size func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - WindowSizePlugin.register(with: registry.registrar(forPlugin: "WindowSizePlugin")) } diff --git a/animations/pubspec.yaml b/animations/pubspec.yaml index b20928bd1..35403b564 100644 --- a/animations/pubspec.yaml +++ b/animations/pubspec.yaml @@ -12,10 +12,6 @@ dependencies: sdk: flutter flutter_animate: ^4.1.0 go_router: ^16.0.0 - window_size: # plugin is not yet part of the flutter framework - git: - url: https://github.com/google/flutter-desktop-embedding.git - path: plugins/window_size dev_dependencies: analysis_defaults: diff --git a/animations/windows/flutter/generated_plugin_registrant.cc b/animations/windows/flutter/generated_plugin_registrant.cc index 9372fc507..8b6d4680a 100644 --- a/animations/windows/flutter/generated_plugin_registrant.cc +++ b/animations/windows/flutter/generated_plugin_registrant.cc @@ -6,9 +6,6 @@ #include "generated_plugin_registrant.h" -#include void RegisterPlugins(flutter::PluginRegistry* registry) { - WindowSizePluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("WindowSizePlugin")); } diff --git a/animations/windows/flutter/generated_plugins.cmake b/animations/windows/flutter/generated_plugins.cmake index ff2147b2c..b93c4c30c 100644 --- a/animations/windows/flutter/generated_plugins.cmake +++ b/animations/windows/flutter/generated_plugins.cmake @@ -3,7 +3,6 @@ # list(APPEND FLUTTER_PLUGIN_LIST - window_size ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/cupertino_gallery/pubspec.yaml b/cupertino_gallery/pubspec.yaml index 6aac360fd..69e483a21 100644 --- a/cupertino_gallery/pubspec.yaml +++ b/cupertino_gallery/pubspec.yaml @@ -2,6 +2,7 @@ name: cupertino_gallery description: A Flutter project showcasing supported Cupertino components. publish_to: "none" version: 1.0.0+1 +resolution: workspace environment: sdk: ^3.9.0-0 diff --git a/desktop_photo_search/fluent_ui/lib/main.dart b/desktop_photo_search/fluent_ui/lib/main.dart index cd0e16400..b8c39f13d 100644 --- a/desktop_photo_search/fluent_ui/lib/main.dart +++ b/desktop_photo_search/fluent_ui/lib/main.dart @@ -10,7 +10,6 @@ import 'package:flutter/services.dart'; import 'package:logging/logging.dart'; import 'package:menubar/menubar.dart' as menubar; import 'package:provider/provider.dart'; -import 'package:window_size/window_size.dart'; import 'src/model/photo_search_model.dart'; import 'src/unsplash/unsplash.dart'; @@ -37,7 +36,7 @@ void main() { exit(1); } - setupWindow(); + // Removed setupWindow() call runApp( ChangeNotifierProvider( @@ -48,16 +47,6 @@ void main() { ); } -const double windowWidth = 1024; -const double windowHeight = 800; - -void setupWindow() { - if (!kIsWeb && - (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) { - WidgetsFlutterBinding.ensureInitialized(); - setWindowMinSize(const Size(windowWidth, windowHeight)); - } -} class UnsplashSearchApp extends StatelessWidget { const UnsplashSearchApp({super.key}); diff --git a/desktop_photo_search/fluent_ui/pubspec.yaml b/desktop_photo_search/fluent_ui/pubspec.yaml index 9863e8bc6..4ec96add0 100644 --- a/desktop_photo_search/fluent_ui/pubspec.yaml +++ b/desktop_photo_search/fluent_ui/pubspec.yaml @@ -26,10 +26,6 @@ dependencies: transparent_image: ^2.0.1 url_launcher: ^6.1.12 uuid: ^4.0.0 - window_size: - git: - url: https://github.com/google/flutter-desktop-embedding.git - path: plugins/window_size dev_dependencies: analysis_defaults: diff --git a/desktop_photo_search/material/lib/main.dart b/desktop_photo_search/material/lib/main.dart index 319a4f8a9..d2fdad606 100644 --- a/desktop_photo_search/material/lib/main.dart +++ b/desktop_photo_search/material/lib/main.dart @@ -4,13 +4,11 @@ import 'dart:io'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:logging/logging.dart'; import 'package:menubar/menubar.dart' as menubar; import 'package:provider/provider.dart'; -import 'package:window_size/window_size.dart'; import 'src/model/photo_search_model.dart'; import 'src/unsplash/unsplash.dart'; @@ -37,8 +35,6 @@ void main() { exit(1); } - setupWindow(); - runApp( ChangeNotifierProvider( create: (context) => @@ -48,17 +44,6 @@ void main() { ); } -const double windowWidth = 1024; -const double windowHeight = 800; - -void setupWindow() { - if (!kIsWeb && - (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) { - WidgetsFlutterBinding.ensureInitialized(); - setWindowMinSize(const Size(windowWidth, windowHeight)); - } -} - class UnsplashSearchApp extends StatelessWidget { const UnsplashSearchApp({super.key}); diff --git a/desktop_photo_search/material/pubspec.yaml b/desktop_photo_search/material/pubspec.yaml index 5a46a857e..29ef3b1f4 100644 --- a/desktop_photo_search/material/pubspec.yaml +++ b/desktop_photo_search/material/pubspec.yaml @@ -25,10 +25,6 @@ dependencies: transparent_image: ^2.0.1 url_launcher: ^6.1.12 uuid: ^4.0.0 - window_size: - git: - url: https://github.com/google/flutter-desktop-embedding.git - path: plugins/window_size dev_dependencies: analysis_defaults: diff --git a/form_app/lib/main.dart b/form_app/lib/main.dart index 46a11baca..5733d16e1 100644 --- a/form_app/lib/main.dart +++ b/form_app/lib/main.dart @@ -7,7 +7,6 @@ import 'dart:io' show Platform; import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; -import 'package:window_size/window_size.dart'; import 'src/autofill.dart'; import 'src/form_widgets.dart'; @@ -16,31 +15,10 @@ import 'src/sign_in_http.dart'; import 'src/validation.dart'; void main() { - setupWindow(); + // Removed setupWindow() call runApp(const FormApp()); } -const double windowWidth = 480; -const double windowHeight = 854; - -void setupWindow() { - if (!kIsWeb && - (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) { - WidgetsFlutterBinding.ensureInitialized(); - setWindowTitle('Form Samples'); - setWindowMinSize(const Size(windowWidth, windowHeight)); - setWindowMaxSize(const Size(windowWidth, windowHeight)); - getCurrentScreen().then((screen) { - setWindowFrame( - Rect.fromCenter( - center: screen!.frame.center, - width: windowWidth, - height: windowHeight, - ), - ); - }); - } -} final demos = [ Demo( diff --git a/form_app/pubspec.yaml b/form_app/pubspec.yaml index 69dc8aef8..11b6d0236 100644 --- a/form_app/pubspec.yaml +++ b/form_app/pubspec.yaml @@ -15,10 +15,6 @@ dependencies: http: ^1.0.0 json_annotation: any english_words: ^4.0.0 - window_size: - git: - url: https://github.com/google/flutter-desktop-embedding.git - path: plugins/window_size go_router: ^16.0.0 dev_dependencies: diff --git a/navigation_and_routing/lib/main.dart b/navigation_and_routing/lib/main.dart index 19993439f..1b0ec26b3 100644 --- a/navigation_and_routing/lib/main.dart +++ b/navigation_and_routing/lib/main.dart @@ -6,33 +6,14 @@ import 'dart:io' show Platform; import 'package:flutter/foundation.dart' show kIsWeb; import 'package:flutter/material.dart'; -import 'package:window_size/window_size.dart'; import 'src/app.dart'; void main() { - setupWindow(); + // Removed setupWindow() call runApp(const Bookstore()); } const double windowWidth = 480; const double windowHeight = 854; -void setupWindow() { - if (!kIsWeb && - (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) { - WidgetsFlutterBinding.ensureInitialized(); - setWindowTitle('Navigation and routing'); - setWindowMinSize(const Size(windowWidth, windowHeight)); - setWindowMaxSize(const Size(windowWidth, windowHeight)); - getCurrentScreen().then((screen) { - setWindowFrame( - Rect.fromCenter( - center: screen!.frame.center, - width: windowWidth, - height: windowHeight, - ), - ); - }); - } -} diff --git a/navigation_and_routing/pubspec.yaml b/navigation_and_routing/pubspec.yaml index 19617657d..0e5c4682a 100644 --- a/navigation_and_routing/pubspec.yaml +++ b/navigation_and_routing/pubspec.yaml @@ -14,10 +14,7 @@ dependencies: sdk: flutter go_router: ^16.0.0 url_launcher: ^6.1.1 - window_size: - git: - url: https://github.com/google/flutter-desktop-embedding.git - path: plugins/window_size + url_launcher: ^6.1.1 dev_dependencies: analysis_defaults: