安装
本指南介绍了相关兼容性以及如何添加 flutter_tilt package。
安装
1
兼容性
平台兼容
| Android | iOS | Web | macOS | Windows | Linux |
|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
传感器兼容
传感器仅在以下平台触发。
不支持传感器的平台不会影响其他功能的正常使用。
| Android | iOS | Web (HTTPS) | macOS | Windows | Linux |
|---|---|---|---|---|---|
| ✅ | ✅ | 浏览器兼容 | ❌ | ❌ | ❌ |
注意:
目前 Web 使用 Sensor API - Gyroscope,但它不兼容部分主流浏览器,比如 Safari、Firefox。
2
添加 flutter_tilt
3
导入 flutter_tilt
在你的 Dart 代码中,你可以这样导入:
import 'package:flutter_tilt/flutter_tilt.dart';