패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.0.1

compassx

진짜 헤딩, 정확도 및 보정이 필요한 Flutter 컴пас 플러그인.

AndroidiOS
30일 다운로드
3천
좋아요
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.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.