commandButtons method

Widget commandButtons(
  1. dynamic context,
  2. ShellModel model
)

Implementation

Widget commandButtons(context, final ShellModel model) {
  final color = Theme.of(context).scaffoldBackgroundColor;
  const iconSize = 15.0;
  return Obx(
    () => Row(children: [
      const SizedBox(height: 5),
      if (!model.isRunning) ...[
        Tooltip(
          message: "Run '${model.command()}' command",
          child: ElevatedButton(
            onPressed: ()  {
              model.run();
              if (!model.external()) {
                controller.service.showDetails(model);
              }
            },
            child: Icon(
              Icons.play_circle,
              size: iconSize,
              color: color,
            ),
          ),
        ),
      ] else ...[
        const SizedBox(width: 10),
        Tooltip(
          message: "Stop running '${model.command()}' command",
          child: ElevatedButton(
            onPressed: () {
              // shellService.kill(model().id)
              model.stop();
            },
            child: Icon(
              Icons.stop_circle,
              size: iconSize,
              color: color,
            ),
          ),
        ),
      ],
      const SizedBox(width: 5),
      Tooltip(
        message: "Show Command output",
        child: ElevatedButton(
          onPressed: () {
            controller.service
                .showDetails(model);
          },
          child: Icon(
            Icons.attachment,
            size: iconSize,
            color: color,
          ),
        ),
      ),
      const SizedBox(width: 5),
      Tooltip(
        message: "Copy command to clipboard",
        child: ElevatedButton(
          onPressed: () => SystemUtils.copyToClipboard(command.command),
          child: Icon(
            Icons.copy_rounded,
            size: iconSize,
            color: color,
          ),
        ),
      ),
    ]),
  );
}