feat(editor): flow list rows get icons + smarter byte formatting

The FLOWS sidebar entries showed just "name" + "1234 B" — two
plain lines, no glyph, no visual hierarchy. Replaced with:

  - leading 28×28 rounded icon tile (account_tree_outlined),
    accent-tinted when the row is active so selection reads
    at a glance.
  - active row title bumps to FontWeight.w600 + onSecondaryContainer.
  - sizes formatted compactly: bytes / KB / MB so a 4.3 KB
    flow doesn't render as "4321 B" and a long one doesn't
    overflow into a multi-line ellipsis.

Bumped to 0.20.1.

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-06-09 01:57:30 +02:00
parent 5cd2745db5
commit 8b38584555
2 changed files with 60 additions and 12 deletions

View file

@ -1051,6 +1051,17 @@ class _FlowFile {
}); });
} }
/// Compact byte-count formatter used in the flow-list rows.
/// '12 B' / '4.3 KB' / '1.2 MB'. Avoids overflowing the
/// narrow sidebar with raw byte counts on long flows.
String _formatBytes(int bytes) {
if (bytes < 1024) return '$bytes B';
if (bytes < 1024 * 1024) {
return '${(bytes / 1024).toStringAsFixed(1)} KB';
}
return '${(bytes / (1024 * 1024)).toStringAsFixed(1)} MB';
}
class _FileList extends StatelessWidget { class _FileList extends StatelessWidget {
final Future<List<_FlowFile>> filesFuture; final Future<List<_FlowFile>> filesFuture;
final String? activeName; final String? activeName;
@ -1161,20 +1172,57 @@ class _FileList extends StatelessWidget {
), ),
), ),
), ),
child: Column( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( // Subtle leading icon that distinguishes a
f.name, // flow file from any other row in the
style: theme.textTheme.bodyMedium?.copyWith( // sidebar. Active row gets the accent
fontWeight: FontWeight.w500, // colour, others stay muted so the active
// selection reads at a glance.
Container(
width: 28,
height: 28,
margin: const EdgeInsets.only(right: FaiSpace.sm),
decoration: BoxDecoration(
color: isActive
? theme.colorScheme.primary.withValues(alpha: 0.15)
: theme.colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(FaiRadius.sm),
),
child: Icon(
Icons.account_tree_outlined,
size: 16,
color: isActive
? theme.colorScheme.primary
: theme.colorScheme.onSurfaceVariant,
), ),
overflow: TextOverflow.ellipsis,
), ),
Text( Expanded(
'${f.sizeBytes} B', child: Column(
style: theme.textTheme.bodySmall?.copyWith( crossAxisAlignment: CrossAxisAlignment.start,
color: theme.colorScheme.onSurfaceVariant, children: [
Text(
f.name,
style: theme.textTheme.bodyMedium?.copyWith(
fontWeight: isActive
? FontWeight.w600
: FontWeight.w500,
color: isActive
? theme.colorScheme.onSecondaryContainer
: null,
),
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 1),
Text(
_formatBytes(f.sizeBytes),
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
fontSize: 11,
),
),
],
), ),
), ),
], ],

View file

@ -1,6 +1,6 @@
name: fai_studio_flow_editor name: fai_studio_flow_editor
description: Swappable inline YAML editor for F∆I Studio flows. description: Swappable inline YAML editor for F∆I Studio flows.
version: 0.20.0 version: 0.20.1
publish_to: 'none' publish_to: 'none'
repository: https://git.flemming.ai/fai/studio-flow-editor repository: https://git.flemming.ai/fai/studio-flow-editor