addCircle method

void addCircle(
  1. double lat,
  2. double lng,
  3. TypicalFood food
)

The addCircle function adds a circle to the map. @param lat The latitude of the circle. @param lng The longitude of the circle. @param food The TypicalFood object. {@category Functions}

Implementation

void addCircle(double lat, double lng, TypicalFood food) {
  final id = CircleId(lat.toString() + lng.toString());
  final circle = Circle(
      circleId: id,
      center: LatLng(lat, lng),
      radius: 3 * 1000, // 15 kms
      strokeWidth: 2,
      strokeColor: Theme.of(context).primaryColor,
      fillColor: Theme.of(context).primaryColor.withOpacity(0.5),
      consumeTapEvents: true,
      onTap: () {
        Navigator.of(context).push(
          MaterialPageRoute(
            builder: (context) => TypicalFoodDetailsPage(food: food),
          ),
        );
      });
  setState(() {
    circles[id] = circle;
  });
}