placeMarker method

void placeMarker(
  1. BuildContext context,
  2. AutonomyModel model
)

Opens a dialog to prompt the user for GPS coordinates and places a marker there.

Implementation

void placeMarker(BuildContext context, AutonomyModel model) => showDialog<void>(
  context: context,
  builder: (_) => AlertDialog(
    title: const Text("Add a Marker"),
    content: Column(
      mainAxisSize: MainAxisSize.min,
      children: [ GpsEditor(model.markerBuilder) ],
    ),
    actions: [
      TextButton(child: const Text("Cancel"), onPressed: () => Navigator.of(context).pop()),
      ElevatedButton(
        onPressed: model.markerBuilder.isValid ? () { model.placeMarker(); Navigator.of(context).pop(); } : null,
        child: const Text("Add"),
      ),
    ],
  ),
);