Some checks failed
Security / Security check (push) Failing after 2s
The Studio design system, widgets and helpers carried a Fai* / fai_ prefix (FaiSpace, FaiColors, FaiTheme, FaiLog, 17 fai_*.dart files, the faiBinary* l10n keys). Studio is the Ch∆In product, so rename them to Chain* / chain_ — carefully preserving English fail/failure/failed. Also fix stale references: the 'fai' binary in l10n strings -> 'chain', FAI_* env vars (FAI_BIN/DATA_DIR/MODULES_DIR/TODAY/BOOTSTRAP_TOKEN) -> CHAIN_*, fai_platform -> fai_chain, fai_hub -> chain_hub. Vendor security-hook tooling (FAI_BANNED_TERMS_FILE) + the .fai bundle ext left. flutter analyze + test: clean (20 passed). Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
110 lines
3.7 KiB
Dart
110 lines
3.7 KiB
Dart
// ChainEmptyState — gracious empty / loading / error placeholder.
|
|
// Replaces "(no data)" strings with one tone, one icon, one tip.
|
|
//
|
|
// The blank surface is where an app most easily feels unfinished,
|
|
// so this state is deliberately *designed*: the Ch∆In delta (∆)
|
|
// sits as a soft watermark behind the icon badge, the badge
|
|
// carries a whisper of elevation, and the copy breathes. The
|
|
// result reads "nothing here yet, on purpose" rather than
|
|
// "something is broken".
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../theme/tokens.dart';
|
|
import 'chain_delta_mark.dart';
|
|
|
|
class ChainEmptyState extends StatelessWidget {
|
|
final IconData icon;
|
|
final String title;
|
|
final String? hint;
|
|
final Widget? action;
|
|
|
|
/// Icon tone. Defaults to muted; set to [Theme.colorScheme.error]
|
|
/// for connection-failure variants.
|
|
final Color? iconColor;
|
|
|
|
const ChainEmptyState({
|
|
super.key,
|
|
required this.icon,
|
|
required this.title,
|
|
this.hint,
|
|
this.action,
|
|
this.iconColor,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final color = iconColor ?? theme.colorScheme.onSurfaceVariant;
|
|
return Center(
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints(maxWidth: 440),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(ChainSpace.xxl),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
// Brand hero: an oversized, low-opacity ∆ watermark
|
|
// anchors the composition while the contextual icon
|
|
// badge sits crisply on top — so every empty surface
|
|
// still carries the Ch∆In signature, never a bare icon.
|
|
SizedBox(
|
|
width: 112,
|
|
height: 112,
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Opacity(
|
|
opacity: 0.10,
|
|
child: ChainDeltaMark(
|
|
color: theme.colorScheme.primary,
|
|
size: 112,
|
|
),
|
|
),
|
|
Container(
|
|
width: 60,
|
|
height: 60,
|
|
decoration: BoxDecoration(
|
|
color: theme.colorScheme.surfaceContainerHigh,
|
|
shape: BoxShape.circle,
|
|
border: Border.all(
|
|
color: color.withValues(alpha: 0.18),
|
|
),
|
|
boxShadow: ChainElevation.low(theme.brightness),
|
|
),
|
|
child: Icon(icon, size: 26, color: color),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: ChainSpace.xl),
|
|
Text(
|
|
title,
|
|
textAlign: TextAlign.center,
|
|
style: theme.textTheme.titleMedium?.copyWith(
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
if (hint != null) ...[
|
|
const SizedBox(height: ChainSpace.sm),
|
|
Text(
|
|
hint!,
|
|
textAlign: TextAlign.center,
|
|
style: theme.textTheme.bodyMedium?.copyWith(
|
|
color: theme.colorScheme.onSurfaceVariant,
|
|
height: 1.5,
|
|
),
|
|
),
|
|
],
|
|
if (action != null) ...[
|
|
const SizedBox(height: ChainSpace.xl),
|
|
action!,
|
|
],
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|