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

GitHub 저장소shohag7552/google_map_custom_windows

google_map_custom_windows

Google 마커의 사용자 지정 창을 위한 패키지입니다. Google 지도 마커에 여러 창을 표시할 수 있습니다.

google_map_custom_windows 프로젝트 이미지
스타
0
포크
1
최근 푸시(UTC)
2025. 9. 8.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

google map custom info window

A Flutter package that extends the capabilities of google_maps_flutter by allowing developers to display fully customizable info windows for markers, including the ability to show multiple info windows simultaneously on the map.

✨Features

  • Customizable Info Windows: Design your info window using any Flutter widget.
  • Multiple Info Windows: Display several info windows at once, ideal for showing details of nearby locations or clustered markers.
  • Highly Flexible: Control the content, styling, and behavior of each info window independently.
  • Easy Integration: Seamlessly integrates with your existing Maps_flutter implementation.

📸 Demo screen recording

🚀 Getting Started

  1. Add Dependencies First, ensure you have google_maps_flutter integrated into your project. Then, add google_map_custom_windows to your pubspec.yaml:

     dependencies:
       google_map_custom_windows: ^1.0.1
    

    Run flutter pub get to fetch the new dependencies.

  2. Import

     import 'package:google_map_custom_windows/google_map_custom_windows.dart';
    
  3. Usage To use the custom info windows, you'll primarily interact with the GoogleMapCustomWindowController and the CustomMapInfoWindow widget.

  • Initialize GoogleMapCustomWindowController, Create an instance of GoogleMapCustomWindowController in your StatefulWidget's initState.
    late GoogleMapCustomWindowController _googleMapCustomWindowController;
    
    @override
    void initState() {
     super.initState();
     _googleMapCustomWindowController = GoogleMapCustomWindowController();
    }
    
  • Need to create your custom info window widget for view. You can create multiple window as your requirement.
    class MyCustomInfoWidget extends StatelessWidget {
    final String title;
    const MyCustomInfoWidget({super.key, required this.title});
    
    @override
    Widget build(BuildContext context) {
     return Container(
       decoration: BoxDecoration(
         borderRadius: BorderRadius.circular(10),
         color: Colors.black,
       ),
       alignment: Alignment.center,
       child: Text(
         title,
         style: TextStyle(color: Colors.white, fontSize: 14),
       ),
     );
    }
    }
    
  • Declare list of info window and same size of list LatLng.
    List<Widget> infoWidgets = [
    MyCustomInfoWidget(title: 'From Marker'),
    MyCustomInfoWidget(title: 'To Marker'),
    ];
    
    List<LatLng> infoPositions = [
    LatLng(23.798054, 90.413459),
    LatLng(23.789451, 90.419584),
    ];
    
  • Use Stack widget for using custom info window.
    @Stack(
         children: [
           GoogleMap(
             mapType: MapType.normal,
             markers: markers,
             initialCameraPosition: CameraPosition(target: initPosition, zoom: 15),
             onMapCreated: (GoogleMapController controller) {
               _setFromToMarker();
               _googleMapCustomWindowController.googleMapController = controller;
               _googleMapCustomWindowController.addInfoWindow!(infoWidgets, infoPositions);
             },
             onTap: (position) {
               _googleMapCustomWindowController.hideInfoWindow!();
             },
             onCameraMove: (CameraPosition cameraPosition) {
               _googleMapCustomWindowController.onCameraMove!();
             },
           ),
    
           CustomMapInfoWindow(
             controller: _googleMapCustomWindowController,
             offset: const Offset(0, 50),
             height: 40,
             width: 100,
           ),
         ],
       )
    
  1. Don't forget to dispose _googleMapCustomWindowController
    @override
      void dispose() {
        _googleMapCustomWindowController.dispose();
        super.dispose();
      }
    

🤝 Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub. If you'd like to contribute code, please fork the repository and submit a pull request.

Mehedi Hasan GitHub avatar
GitHub 작성자

Mehedi Hasan ↗

언어Dart

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 4 개

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗