createTask method
- BuildContext context,
- AutonomyCommandBuilder command
Opens a dialog to prompt the user to create an AutonomyCommand and sends it to the rover.
Implementation
void createTask(BuildContext context, AutonomyCommandBuilder command) => showDialog<void>(
context: context,
builder: (_) => AlertDialog(
title: const Text("Create a new Task"),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
DropdownEditor<AutonomyTask>(
name: "Task type",
value: command.task,
items: [
for (final task in AutonomyTask.values)
if (task != AutonomyTask.AUTONOMY_TASK_UNDEFINED) task,
],
onChanged: command.updateTask,
humanName: (task) => task.humanName,
),
GpsEditor(command.gps),
],
),
actions: [
TextButton(child: const Text("Cancel"), onPressed: () => Navigator.of(context).pop()),
ElevatedButton(
onPressed: command.isLoading ? null : () { command.submit(); Navigator.of(context).pop(); },
child: const Text("Submit"),
),
],
),
);