1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-09 14:28:51 +00:00

Add window setup to null_unsafe_app (#1045)

This commit is contained in:
Miguel Beltran
2022-03-08 01:58:41 +01:00
committed by GitHub
parent 9ed8a73e2d
commit 25dcadb0ef
50 changed files with 2383 additions and 1 deletions

View File

@@ -2,12 +2,28 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:window_size/window_size.dart';
void main() {
setupWindow();
runApp(const MyApp());
}
const double windowWidth = 400;
const double windowHeight = 400;
void setupWindow() {
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
WidgetsFlutterBinding.ensureInitialized();
setWindowTitle('Weather');
setWindowMinSize(const Size(windowWidth, windowHeight));
}
}
// This app simulates possible null errors. Try running it and see if it fails.
// You can then try to hot reload a few times; you should see it occasionally
// failing and occasionally succeeding.