import 'package:flutter/material.dart'; import 'package:patbond_flutter/core/theme/app_theme.dart'; /// 空态插画区(05 号规范 §3.4):承载引导动作的空态,向上兼容现有 /// `EmptyState`(42 图标 + 一行 bodySmall 的纯提示版继续留用)。 /// /// 布局:112 圆形插画区(`surfaceTint` 底 + 56 `primary` 图标,大面积 /// 装饰用法)→ 标题 → 说明(12 `inkSoft` ≤2 行居中)→ 可选 CTA。 /// v1 插画用 Material 图标,正式素材待品牌侧供给后原位替换。 class EmptyStateIllustration extends StatelessWidget { const EmptyStateIllustration({ required this.icon, required this.title, super.key, this.description, this.ctaLabel, this.onCtaPressed, }); final IconData icon; final String title; final String? description; /// CTA 文案;null 则不渲染按钮(如筛选后空态)。 final String? ctaLabel; final VoidCallback? onCtaPressed; @override Widget build(BuildContext context) { return Padding( padding: const EdgeInsets.symmetric(vertical: 48, horizontal: 16), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: 112, height: 112, decoration: const BoxDecoration( shape: BoxShape.circle, color: AppColors.surfaceTint, ), child: Icon(icon, size: 56, color: AppColors.primary), ), const SizedBox(height: 16), Text( title, style: Theme.of(context).textTheme.titleMedium, textAlign: TextAlign.center, ), if (description != null) ...[ const SizedBox(height: 8), Text( description!, maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: const TextStyle( color: AppColors.inkSoft, fontSize: 12, height: 1.4, ), ), ], if (ctaLabel != null) ...[ const SizedBox(height: 24), FilledButton( style: FilledButton.styleFrom( padding: const EdgeInsets.symmetric(horizontal: 24), ), onPressed: onCtaPressed, child: Text(ctaLabel!), ), ], ], ), ); } }