66 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Dart
		
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Dart
		
	
	
	
| 
 | |
| import 'package:common/utils/toast_utils.dart';
 | |
| import 'package:device_info_plus/device_info_plus.dart';
 | |
| import 'package:flutter/material.dart';
 | |
| import 'package:web_synchronization_tool/login/login_page.dart';
 | |
| import 'package:web_synchronization_tool/login/login_socket_utils.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();
 | |
| 
 | |
|     info();
 | |
|   }
 | |
| 
 | |
| 
 | |
|   info() async {
 | |
|     final deviceInfo = await DeviceInfoPlugin().deviceInfo;
 | |
|     String uuid = deviceInfo.data['deviceId'];
 | |
|     uuid = uuid.replaceAll('{', '');
 | |
|     uuid = uuid.replaceAll('}', '');
 | |
|     LoginSocketUtils.getInstance().uuid = uuid;
 | |
| 
 | |
|   }
 | |
| 
 | |
|   @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 LoginPage(),
 | |
|       navigatorObservers: [FlutterSmartDialog.observer],
 | |
|       builder: FlutterSmartDialog.init(),
 | |
|     );
 | |
|   }
 | |
| }
 |