パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.0.1

compassx

真の方位、精度、キャリブレーションが必要なFlutterコンパスプラグイン。

AndroidiOS
30日間ダウンロード
3010
いいね数
20
Pub ポイント
150

パッケージをインストール

flutter pub add compassx

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

CompassX は、真の方位、磁気精度、キャリブレーション状態を含むデバイスのコンパスデータにアクセスできるFlutterプラグインです。AndroidおよびiOSプラットフォームをサポートし、デバイスのセンサーを通じてリアルタイムで方向情報を提供します。ナビゲーション、マッピング、拡張現実アプリケーションなど、正確な方向入力が必要な用途に最適です。`flutter pub add compassx` を使用した最小限のセットアップにより、開発者は信頼性の高いコンパス機能をアプリに統合できます。ソースコードはGitHub上で公開されており、透明性とカスタマイズが可能です。

用途

  • ナビゲーションアプリ
  • 拡張現実体験
  • 屋外活動のトラッキング
  • マップベースのアプリケーション
  • 方向性UI要素

主な機能

  • 真の方位角サポート
  • 磁気精度レポート
  • リアルタイムセンサーの更新
  • キャリブレーション状態のモニタリング
  • クロスプラットフォーム互換性

適している対象

  • ナビゲーションツールを開発する開発者
  • 方向認識を必要とするアプリ
  • AR および位置ベースのサービス
  • センサー統合を必要とするモバイルアプリ

注意事項

  • マグネトメーターを搭載したデバイスが必要です
  • 正確性は環境に依存します
  • ユーザーのキャリブレーションが必要になる場合があります
  • 一部のデバイスではバックグラウンド操作が制限されています
  • iOS ではプライバシーの許可が必要です

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

CompassX

Logo

Provides reliable compass data and extensive documentation.

Usage

StreamBuilder<CompassXEvent>(
  stream: CompassX.events,
  builder: (context, snapshot) {
    if (!snapshot.hasData) return const Text('No data');
    final compass = snapshot.data!;
    return Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        Text('Heading: ${compass.heading}'),
        Text('Accuracy: ${compass.accuracy}'),
        Text('Should calibrate: ${compass.shouldCalibrate}'),
        Transform.rotate(
          angle: compass.heading * math.pi / 180,
          child: Icon(
            Icons.arrow_upward_rounded,
            size: MediaQuery.of(context).size.width - 80,
          ),
        ),
      ],
    );
  },
),
  • heading: The heading relative to true north in degree.
  • accuracy: The accuracy of the sensor data.
  • shouldCalibrate: Whether the sensor should be calibrated or not.

Install

$ flutter pub add compassx

Check the minimum supported version of your project and update as necessary.

  • iOS: 12
  • Android: 21

Request permission to get true heading in Android. Not required on iOS.

$ flutter pub add permission_handler

Specify the permissions one or both of the following in AndroidManifest.xml. It can be copied from example.

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  • ACCESS_COARSE_LOCATION: Used when normal accuracy is required.
  • ACCESS_FINE_LOCATION: Used when the highest quality accuracy is required.

Add code to request permissions.

if (Platform.isAndroid) await Permission.location.request();

CompassX heading currently supports only portrait mode. It is recommended to fix the orientation of the device.

SystemChrome.setPreferredOrientations([
        DeviceOrientation.portraitUp,
        DeviceOrientation.portraitDown,
      ]);

Testing

It is recommended to use a real device. iOS simulators cannot use the heading sensor (compass). See Testing CompassX for details.

Documentation

If you are going to use this plugin in your product apps, I strongly suggest you read full documentation carefully.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。