Add desktop window setup to isolate_example (#1041)

pull/1044/head
Miguel Beltran 3 years ago committed by GitHub
parent aa6aef0ef6
commit b2daccca71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,13 +12,18 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:window_size/window_size.dart';
import 'data_transfer_page.dart'; import 'data_transfer_page.dart';
import 'infinite_process_page.dart'; import 'infinite_process_page.dart';
import 'performance_page.dart'; import 'performance_page.dart';
void main() { void main() {
setupWindow();
runApp( runApp(
const MaterialApp( const MaterialApp(
home: HomePage(), home: HomePage(),
@ -26,6 +31,17 @@ void main() {
); );
} }
const double kWindowWidth = 1024;
const double kWindowHeight = 800;
void setupWindow() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
WidgetsFlutterBinding.ensureInitialized();
setWindowTitle('Isolate Example');
setWindowMinSize(const Size(kWindowWidth, kWindowHeight));
}
}
class HomePage extends StatelessWidget { class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key); const HomePage({Key? key}) : super(key: key);

@ -81,6 +81,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.11" version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
meta: meta:
dependency: transitive dependency: transitive
description: description:
@ -155,7 +162,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.3" version: "0.4.8"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -170,6 +177,15 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
window_size:
dependency: "direct main"
description:
path: "plugins/window_size"
ref: "03d957e8b5c99fc83cd4a781031b154ab3de8753"
resolved-ref: "03d957e8b5c99fc83cd4a781031b154ab3de8753"
url: "https://github.com/google/flutter-desktop-embedding.git"
source: git
version: "0.1.0"
sdks: sdks:
dart: ">=2.14.0 <3.0.0" dart: ">=2.14.0 <3.0.0"
flutter: ">=1.16.0" flutter: ">=1.16.0"

@ -1,6 +1,7 @@
name: isolate_example name: isolate_example
description: A Flutter sample to demonstrate isolates description: A Flutter sample to demonstrate isolates
version: 1.0.0+1 version: 1.0.0+1
publish_to: none
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=2.12.0 <3.0.0"
@ -9,6 +10,11 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
provider: ^5.0.0 provider: ^5.0.0
window_size:
git:
url: https://github.com/google/flutter-desktop-embedding.git
path: plugins/window_size
ref: 03d957e8b5c99fc83cd4a781031b154ab3de8753
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save