是否可以让 Flutter windows 应用全屏显示?
Is it possible to keep Flutter windows app in fullscreen?
是否可以运行 Flutter Windows 应用一直处于全屏模式? Window 调整大小会导致应用程序因元素无法正确呈现而中断。为了防止用户调整屏幕大小,我想禁用它。有没有办法让应用程序在 windows 上一直全屏打开??
在pubspec.yaml
中加入这行代码
dependencies:
window_size:
git:
# url: git://github.com/google/flutter-desktop-embedding.git
url: https://github.com/google/flutter-desktop-embedding
path: plugins/window_size
然后在 main.dart
中添加此代码
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:window_size/window_size.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
if (Platform.isWindows) {
setWindowMaxSize(Size(1100, 710));
setWindowMinSize(const Size(1100, 710));
Future<Null>.delayed(Duration(seconds: 0), () {
setWindowFrame(
Rect.fromCenter(center: Offset(650, 350), width: 1000, height: 710));
});
}
runApp(
(MySplashApp()),
);
}
是否可以运行 Flutter Windows 应用一直处于全屏模式? Window 调整大小会导致应用程序因元素无法正确呈现而中断。为了防止用户调整屏幕大小,我想禁用它。有没有办法让应用程序在 windows 上一直全屏打开??
在pubspec.yaml
dependencies:
window_size:
git:
# url: git://github.com/google/flutter-desktop-embedding.git
url: https://github.com/google/flutter-desktop-embedding
path: plugins/window_size
然后在 main.dart
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:window_size/window_size.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
if (Platform.isWindows) {
setWindowMaxSize(Size(1100, 710));
setWindowMinSize(const Size(1100, 710));
Future<Null>.delayed(Duration(seconds: 0), () {
setWindowFrame(
Rect.fromCenter(center: Offset(650, 350), width: 1000, height: 710));
});
}
runApp(
(MySplashApp()),
);
}