61 lines
1.6 KiB
Dart
61 lines
1.6 KiB
Dart
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:web_synchronization_tool/windows/windows_main_page.dart';
|
|
import 'package:window_manager/window_manager.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await windowManager.ensureInitialized();
|
|
|
|
WindowOptions windowOptions = const WindowOptions(
|
|
center: true, backgroundColor: Colors.white,// fullScreen: true,//, title: '赢佳'
|
|
// skipTaskbar: true, //跳过任务栏,任务栏无显示
|
|
// titleBarStyle: TitleBarStyle.hidden, //隐藏顶部标题栏
|
|
);
|
|
windowManager.waitUntilReadyToShow(windowOptions, () async {
|
|
await windowManager.show();
|
|
await windowManager.focus();
|
|
});
|
|
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatefulWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
State<MyApp> createState() => _MyAppState();
|
|
}
|
|
|
|
class _MyAppState extends State<MyApp> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
//允许调整窗口大小
|
|
windowManager.setResizable(false);
|
|
|
|
const double width = 1920;
|
|
const double height = 1000;
|
|
//设置最小大小
|
|
const windowSize = Size(width, height);
|
|
windowManager.setSize(windowSize);
|
|
appWindow.minSize = windowSize;
|
|
windowManager.center();
|
|
windowManager.focus();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Flutter Demo',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
|
useMaterial3: true,
|
|
),
|
|
// home: const MainPage(),
|
|
home: const WindowsPage(),
|
|
);
|
|
}
|
|
}
|