For UI that should differ slightly on iOS and Android, i.e. on different platforms, there must be a way to detect
for more simple way you just use this return method, that access full project. like i print these on button click.
import 'package:flutter/material.dart';
import 'package:gymmanager/components/platformCheck.dart';
class SplashScreen extends StatefulWidget {
@override
_SplashScreenState createState() => _SplashScreenState();
}
class _SplashScreenState extends State {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: RaisedButton(
child: Text("Platform check"),
onPressed: () async {
var platform = await platformName();
print("Platform :- " + platform);
},
),
),
);
}
}
and this is your platformCheck.dart class
import 'dart:io' show Platform;
import 'package:flutter/foundation.dart' show kIsWeb;
Future platformName() {
var platformName = '';
if (kIsWeb) {
platformName = "Web";
} else {
if (Platform.isAndroid) {
platformName = "Android";
} else if (Platform.isIOS) {
platformName = "IOS";
} else if (Platform.isFuchsia) {
platformName = "Fuchsia";
} else if (Platform.isLinux) {
platformName = "Linux";
} else if (Platform.isMacOS) {
platformName = "MacOS";
} else if (Platform.isWindows) {
platformName = "Windows";
}
}
return Future.value(platformName);
}