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.6 KB
Raw Blame
import 'package:flutter/material.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';

import 'package:harness_mobile/state/app_state.dart';
import 'package:harness_mobile/usage/usage_summary.dart';

import 'phone_navigation.dart';
import 'settings_row.dart';
import 'usage_page.dart';

/// The Settings ▸ Usage row, built here rather than in `settings_page.dart` so
/// the page that owns the feature owns its entry point too.
///
/// What comes back is a [SettingsRow] — the same shape as every other row in a
/// [SettingsGroup] — with a [ValueListenableBuilder] around it, so the figure
/// refreshes when someone comes back from the page without Settings having to
/// know that it can. Settings decides WHERE the row goes; this decides what it
/// says.
///
/// The value is what the account closest to running out has left of its
/// tightest window, worded as the Usage page heads its card — the one worth a
/// glance from a list of rows, since that account is the one that will stop
/// the work. Nothing when nothing has been read yet, never a zero — `0%
/// remaining` is a measurement, and this has none.
Widget buildUsageSettingsRow(
  BuildContext context,
  AppNotifier notifier,
) => ValueListenableBuilder<String?>(
  valueListenable: lastUsageSummary,
  builder: (context, summary, _) => SettingsRow(
    title: 'Usage',
    glyph: LucideIcons.gauge300,
    // Nothing until something has been read: a dash was a dead word on the row.
    value: summary,
    onTap: () =>
        Navigator.of(context)
            .push(phoneRoute((_) => UsagePage(notifier: notifier))),
  ),
);