refactor: remove window_size plugin and manual window configuration from samples

pull/2831/head
Eric Windmill 4 weeks ago
parent 6e9d36a18d
commit daf39ce758

@ -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;

@ -6,10 +6,6 @@
#include "generated_plugin_registrant.h"
#include <window_size/window_size_plugin.h>
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);
}

@ -3,7 +3,6 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
window_size
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST

@ -5,8 +5,6 @@
import FlutterMacOS
import Foundation
import window_size
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
WindowSizePlugin.register(with: registry.registrar(forPlugin: "WindowSizePlugin"))
}

@ -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:

@ -6,9 +6,6 @@
#include "generated_plugin_registrant.h"
#include <window_size/window_size_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
WindowSizePluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowSizePlugin"));
}

@ -3,7 +3,6 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
window_size
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST

@ -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

@ -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<PhotoSearchModel>(
@ -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});

@ -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:

@ -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<PhotoSearchModel>(
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});

@ -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:

@ -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(

@ -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:

@ -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,
),
);
});
}
}

@ -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:

Loading…
Cancel
Save