Mir Injamamul
Mir Injamamul

Reputation: 147

Cache Street map in flutter

I am using OSM plugin to show a marker in map.

OSMFlutter(
        controller: _mapController,
        osmOption: OSMOption(
            userTrackingOption: const UserTrackingOption(
                enableTracking: false,
                unFollowUser: false
            ),
            zoomOption: const ZoomOption(
                initZoom: 17,
                minZoomLevel: 4,
                maxZoomLevel: 19,
                stepZoom: 1.0
            ),
            enableRotationByGesture: false,
            showZoomController: true,
            staticPoints: [StaticPositionGeoPoint(
                "photo_point_maker",
                const MarkerIcon(
                  icon: Icon(Icons.camera_alt_rounded, color: Colors.blue, size: 48,),
                ), [GeoPoint(latitude: widget.trenchingProfile.lat ?? 0, longitude: widget.trenchingProfile.long ?? 0)])]
        ),

        onGeoPointClicked: (geoPoint)async{
          var key = '${geoPoint.latitude}_${geoPoint.latitude}';
          debugPrint("key : $key");
          //when user click on a marker
          Get.bottomSheet(CameraBottomSheetView(trenchingProfile: widget.trenchingProfile,));
        },
        // mapIsLoading: const Center(child: CircularProgressIndicator(),),
        onMapIsReady: (isReady)async{
          if(isReady){
              await _mapController.moveTo(GeoPoint(latitude: widget.trenchingProfile.lat ?? 0, longitude: widget.trenchingProfile.long ?? 0),animate:true);
              await _mapController.setZoom(zoomLevel: 17, stepZoom: 1.0);
          }
        },
      ),

when i come back to this screen, every time it is loading. i need to preload / cache this screen to show this map more faster for repitive use.

Upvotes: 0

Views: 21

Answers (0)

Related Questions