mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-05-11 18:36:11 +02:00
Refact. Build flutter web (#7472)
* Refact. Build flutter web Signed-off-by: fufesou <shuanglongchen@yeah.net> * Refact. Flutter web, wrap Platform.xx Signed-off-by: fufesou <shuanglongchen@yeah.net> --------- Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
285e298a8b
commit
9558974080
14 changed files with 1625 additions and 54 deletions
10
flutter/lib/native/common.dart
Normal file
10
flutter/lib/native/common.dart
Normal file
|
@ -0,0 +1,10 @@
|
|||
import 'dart:io';
|
||||
|
||||
final isAndroid_ = Platform.isAndroid;
|
||||
final isIOS_ = Platform.isIOS;
|
||||
final isWindows_ = Platform.isWindows;
|
||||
final isMacOS_ = Platform.isWindows;
|
||||
final isLinux_ = Platform.isWindows;
|
||||
final isWeb_ = false;
|
||||
|
||||
final isDesktop_ = Platform.isWindows || Platform.isMacOS || Platform.isLinux;
|
41
flutter/lib/native/win32.dart
Normal file
41
flutter/lib/native/win32.dart
Normal file
|
@ -0,0 +1,41 @@
|
|||
import 'dart:ffi' hide Size;
|
||||
|
||||
import 'package:ffi/ffi.dart';
|
||||
|
||||
import 'package:win32/win32.dart' as win32;
|
||||
|
||||
/// Get windows target build number.
|
||||
///
|
||||
/// [Note]
|
||||
/// Please use this function wrapped with `Platform.isWindows`.
|
||||
int getWindowsTargetBuildNumber_() {
|
||||
final rtlGetVersion = DynamicLibrary.open('ntdll.dll').lookupFunction<
|
||||
Void Function(Pointer<win32.OSVERSIONINFOEX>),
|
||||
void Function(Pointer<win32.OSVERSIONINFOEX>)>('RtlGetVersion');
|
||||
final osVersionInfo = _getOSVERSIONINFOEXPointer();
|
||||
rtlGetVersion(osVersionInfo);
|
||||
int buildNumber = osVersionInfo.ref.dwBuildNumber;
|
||||
calloc.free(osVersionInfo);
|
||||
return buildNumber;
|
||||
}
|
||||
|
||||
/// Get Windows OS version pointer
|
||||
///
|
||||
/// [Note]
|
||||
/// Please use this function wrapped with `Platform.isWindows`.
|
||||
Pointer<win32.OSVERSIONINFOEX> _getOSVERSIONINFOEXPointer() {
|
||||
final pointer = calloc<win32.OSVERSIONINFOEX>();
|
||||
pointer.ref
|
||||
..dwOSVersionInfoSize = sizeOf<win32.OSVERSIONINFOEX>()
|
||||
..dwBuildNumber = 0
|
||||
..dwMajorVersion = 0
|
||||
..dwMinorVersion = 0
|
||||
..dwPlatformId = 0
|
||||
..szCSDVersion = ''
|
||||
..wServicePackMajor = 0
|
||||
..wServicePackMinor = 0
|
||||
..wSuiteMask = 0
|
||||
..wProductType = 0
|
||||
..wReserved = 0;
|
||||
return pointer;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue