| 
									
										
										
										
											2024-04-02 11:02:06 +08:00
										 |  |  | import 'package:bitsdojo_window/bitsdojo_window.dart'; | 
					
						
							| 
									
										
										
										
											2024-03-30 10:58:39 +08:00
										 |  |  | import 'package:flutter/material.dart'; | 
					
						
							| 
									
										
										
										
											2024-03-30 20:14:00 +08:00
										 |  |  | import 'package:web_synchronization_tool/windows/windows_main_page.dart'; | 
					
						
							| 
									
										
										
										
											2024-04-02 11:02:06 +08:00
										 |  |  | import 'package:window_manager/window_manager.dart'; | 
					
						
							| 
									
										
										
										
											2024-03-30 10:58:39 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-31 20:15:43 +08:00
										 |  |  | void main() async { | 
					
						
							| 
									
										
										
										
											2024-04-02 11:02:06 +08:00
										 |  |  |   WidgetsFlutterBinding.ensureInitialized(); | 
					
						
							|  |  |  |   await windowManager.ensureInitialized(); | 
					
						
							| 
									
										
										
										
											2024-03-31 20:15:43 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-02 11:02:06 +08:00
										 |  |  |   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(); | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2024-03-31 20:15:43 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-30 10:58:39 +08:00
										 |  |  |   runApp(const MyApp()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-02 11:02:06 +08:00
										 |  |  | class MyApp extends StatefulWidget { | 
					
						
							| 
									
										
										
										
											2024-03-30 10:58:39 +08:00
										 |  |  |   const MyApp({super.key}); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-02 11:02:06 +08:00
										 |  |  |   @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(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-30 10:58:39 +08:00
										 |  |  |   @override | 
					
						
							|  |  |  |   Widget build(BuildContext context) { | 
					
						
							|  |  |  |     return MaterialApp( | 
					
						
							|  |  |  |       title: 'Flutter Demo', | 
					
						
							|  |  |  |       theme: ThemeData( | 
					
						
							|  |  |  |         colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), | 
					
						
							|  |  |  |         useMaterial3: true, | 
					
						
							|  |  |  |       ), | 
					
						
							| 
									
										
										
										
											2024-04-01 21:41:42 +08:00
										 |  |  |       // home: const MainPage(),
 | 
					
						
							|  |  |  |       home: const WindowsPage(), | 
					
						
							| 
									
										
										
										
											2024-03-30 10:58:39 +08:00
										 |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |