mirror of
https://github.com/localsend/localsend.git
synced 2026-05-18 21:57:26 -04:00
36 lines
1.1 KiB
Dart
36 lines
1.1 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
|
|
bool checkPlatform(List<TargetPlatform> platforms, {bool web = false}) {
|
|
if (web && kIsWeb) {
|
|
return true;
|
|
}
|
|
return platforms.contains(defaultTargetPlatform);
|
|
}
|
|
|
|
/// This platform runs on a "traditional" computer
|
|
bool checkPlatformIsDesktop() {
|
|
return checkPlatform([TargetPlatform.linux, TargetPlatform.windows, TargetPlatform.macOS]);
|
|
}
|
|
|
|
/// This platform supports tray
|
|
/// On linux, this is currently not supported
|
|
bool checkPlatformHasTray() {
|
|
return checkPlatform([TargetPlatform.windows, TargetPlatform.macOS]);
|
|
}
|
|
|
|
/// This platform can receive share intents
|
|
bool checkPlatformCanReceiveShareIntent() {
|
|
return checkPlatform([TargetPlatform.android, TargetPlatform.iOS]);
|
|
}
|
|
|
|
/// This platform has a gallery
|
|
bool checkPlatformWithGallery() {
|
|
return checkPlatform([TargetPlatform.android, TargetPlatform.iOS]);
|
|
}
|
|
|
|
/// This platform has access to file system
|
|
/// On android, do not allow to change
|
|
bool checkPlatformWithFileSystem() {
|
|
return checkPlatform([TargetPlatform.linux, TargetPlatform.windows, TargetPlatform.android, TargetPlatform.macOS]);
|
|
}
|