initial commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
/// Plateformes supportées par l'application (mobile natif uniquement, pas de web).
|
||||
enum AppPlatform {
|
||||
android,
|
||||
ios,
|
||||
}
|
||||
|
||||
/// Indique si la plateforme courante est supportée (Android ou iOS).
|
||||
bool get isMobilePlatformSupported {
|
||||
if (kIsWeb) {
|
||||
return false;
|
||||
}
|
||||
return Platform.isAndroid || Platform.isIOS;
|
||||
}
|
||||
|
||||
/// Plateforme courante. Lance une exception si web ou desktop.
|
||||
AppPlatform get currentAppPlatform {
|
||||
if (kIsWeb) {
|
||||
throw UnsupportedError(
|
||||
'Laverie Mobile ne cible pas le web. Utilisez Android ou iOS.',
|
||||
);
|
||||
}
|
||||
if (Platform.isAndroid) {
|
||||
return AppPlatform.android;
|
||||
}
|
||||
if (Platform.isIOS) {
|
||||
return AppPlatform.ios;
|
||||
}
|
||||
throw UnsupportedError(
|
||||
'Plateforme non supportée. Cible : Android (prioritaire) et iOS.',
|
||||
);
|
||||
}
|
||||
|
||||
bool get isAndroid => !kIsWeb && Platform.isAndroid;
|
||||
|
||||
bool get isIos => !kIsWeb && Platform.isIOS;
|
||||
Reference in New Issue
Block a user