Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

1.8 KB
Raw Blame
import 'package:harness/shared/theme/app_icons.dart';
import 'package:flutter/material.dart';
import 'package:harness/terminal/terminal_text.dart';

import '../../theme/app_theme.dart';
import '../theme/app_theme.dart' as grid;

/// A single-line shell command with a copy affordance: tap anywhere on the row to copy, the trailing
/// icon flips to a checkmark for a moment to confirm. Shared by any screen that hands the user a
/// command to run themselves (`harness_join_guide_screen.dart`, `environment_setup_screen.dart`).
class CommandRow extends StatelessWidget {
  final String command;
  final bool copied;
  final VoidCallback onCopy;

  const CommandRow({
    super.key,
    required this.command,
    required this.copied,
    required this.onCopy,
  });

  @override
  Widget build(BuildContext context) {
    TerminalFontScope.watch(context);
    return InkWell(
      onTap: onCopy,
      borderRadius: BorderRadius.circular(grid.AppCard.insetRadius),
      child: Container(
        width: double.infinity,
        padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
        decoration: BoxDecoration(
          color: AppColors.background,
          border: Border.all(color: AppColors.border),
          borderRadius: BorderRadius.circular(grid.AppCard.insetRadius),
        ),
        child: Row(
          children: [
            Text('\$ ', style: grid.AppType.mono(color: AppColors.mutedStrong)),
            Expanded(
              child: SelectableText(
                command,
                style: grid.AppType.mono(color: AppColors.text),
              ),
            ),
            Icon(
              copied ? AppIcons.check : AppIcons.copy,
              size: 16,
              color: copied ? AppColors.success : AppColors.mutedStrong,
            ),
          ],
        ),
      ),
    );
  }
}