Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

GestureDetector on markers of Flutter_map isnt working

I’m trying to create a map using flutter_maps, but when I add a GestureDetector to the markers, some errors appear

          MarkerLayer(
            markers: [
              Marker(
                point: LatLng(-22.3285, -49.0523),
                width: 65,
                height: 50,
                builder: (context) => GestureDetector(
                  onTap: () {
                    //nothing yet
                  },
                child: Container(
                  padding: EdgeInsets.symmetric(horizontal: 4, vertical: 2),
                  decoration: BoxDecoration(
                    color: Colors.black.withOpacity(0.5),
                    borderRadius: BorderRadius.circular(5),
                  ),
                  child: Text(
                    'BLOCOS C, D & E',
                    style: TextStyle(
                      color: Colors.white,
                      fontWeight: FontWeight.bold,
                    ),
                    textAlign: TextAlign.center,
                  ),
                ),
              ),
              ),
            ],
          ),

the errors are "The named parameter ‘child’ is required, but there’s no corresponding argument." and "The named parameter ‘builder’ isn’t defined."

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Well, heed the warning: Instead of builder pass a child to the Marker. According to the doc it does not have a parameter builder: https://pub.dev/documentation/flutter_map/latest/flutter_map/Marker-class.html

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading