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

flutter_map_line_editor 표지
패키지 상세v8.0.0

flutter_map_line_editor

`flutter_map`용 기본 라인 및 다각형 편집기 (드래그 마커 사용)

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
6천
좋아요
32
Pub 점수
130

패키지 설치

flutter pub add flutter_map_line_editor

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

flutter_map 위젯 내에서 선 및 다각형의 인터랙티브 편집을 가능하게 하는 플러터 패키지입니다. 정점 조정을 위한 드래그 가능한 마커를 제공하여 사용자가 지도 위에서 벡터 형상을 직접 생성하거나 수정할 수 있도록 합니다. 지도 기하학에 대한 사용자 입력이 필요한 지리정보 애플리케이션을 위해 설계되었으며, flutter_map의 기존 기능과 원활하게 통합됩니다. 에디터는 라인과 다각형 형식 모두를 지원하며, 모든 지원되는 플랫폼에서 터치 또는 마우스 상호작용을 통해 직관적인 점 조작을 제공합니다.

사용 사례

  • 지도 기반 모양 생성
  • 인터랙티브 루트 계획
  • 지리공간 데이터 주석
  • 다각형 경계 편집
  • 실시간 지도 그리기
  • 사용자 중심의 지도 기하학 입력

주요 기능

  • 드래그 가능한 꼭짓점 마커
  • 선 및 다각형 지원
  • flutter_map와의 원활한 통합
  • 크로스 플랫폼 호환성
  • 실시간 모양 업데이트
  • 초기화 및 이벤트 처리를 위한 간단한 API

적합한 대상

  • GIS 애플리케이션
  • 사용자 입력이 있는 매핑 도구
  • 인터랙티브 지도 대시보드
  • 현장 데이터 수집 앱
  • 교육 맵핑 소프트웨어
  • 지도 상호작용 기능 프로토타이핑

고려 사항

  • flutter_map 종속성 필요
  • 기본 모양 편집에 제한됨
  • 내장된 스냅 또는 정렬 기능 없음
  • 마커에 맞춤 스타일링이 필요할 수 있습니다
  • 많은 정점으로 인한 성능 영향
  • 복잡한 기하 연산에 적합하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Line & Polygon Editor for flutter_map

pub package License: MIT Support me on Ko-fi

A basic line and polygon editor that works with flutter_map, relying on DragMarker from flutter_map_dragmarker.

Demo

Demo

Getting started

To use this package, first add flutter_map_line_editor as a dependency in your pubspec.yaml file:

dependencies:
  flutter_map_line_editor: <latest version>

See the example directory for a complete example app demonstrating the usage of this package, here are the most important features:

  • Tap the map to add a marker, add as many as you want.
  • Drag the main points to move them.
  • Drag the intermediate points to create a new point there and drag to where you want.
  • Long press to delete a point.

Usage

Once the package is installed, make sure to import the package in the file that you are going to need it, you may also need to import flutter_map_dragmarker:

import 'package:flutter_map_dragmarker/flutter_map_dragmarker.dart';
import 'package:flutter_map_line_editor/flutter_map_line_editor.dart';

Set up a new editor instance, tipically inside initState():

var polyEditor = PolyEditor(
  points: testPolyline.points,
  pointIcon: Icon(Icons.crop_square, size: 23),
  intermediateIcon: Icon(Icons.lens, size: 15, color: Colors.grey),
  callbackRefresh: () => { this.setState(() {})},
  addClosePathMarker: false, // set to true if polygon
);

The PolyEditor takes a list of LatLng points that are used to put DragMarker's over these locations. PolyEditor does not care if the given list of points is a polyline, it could be something else. This list will be edited in place so that when the build method is triggered it will use updated points.

You must also pass a Widget (tipically an Icon) using the pointIcon parameter that will be used to represent each DragMarker.

You may also pass the optional parameter intermediateIconto display another DragMarker halfway between the main points. Dragging this marker will create another main point and the line will be split.

The screen needs to be updated during a drag, so callbackRefresh takes a function that will get called each drag frame.

For polygons or “closed paths” set the parameter addClosePathMarker to true so that the end auto-returns to the start. Otherwise, if you just want a basic polyline, set this to false.

You can add a point programmatically using the onTap callback in MapOptions:

onTap: (ll) {
  polyEditor.add(testPolyline.points, ll);
},

Add the correspondent layers as FlutterMap childrens:

FlutterMap(
  options: MapOptions(
    onTap: (_, ll) {
      polyEditor.add(testPolyline.points, ll);
    },
  ),
  children: [
    // .....
    PolylineLayer(polylines: polyLines),
    DragMarkers(markers: polyEditor.edit()),
  ],
),

Report issues or feature requests in the GitHub repository, Pull Requests are welcome!

License

This package is licensed under the permissive MIT License. See the LICENSE file in this repository to get a full copy.

카테고리

의존성

의존성 목록 2 개

소스 저장소

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