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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user