mirror of
https://github.com/localsend/localsend.git
synced 2026-04-23 08:30:03 -04:00
30 lines
935 B
Dart
30 lines
935 B
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 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]);
|
|
}
|