| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- import 'package:flutter/material.dart';
- import '../../core/theme/app_colors.dart';
- /// Pencil Component/StatusBanner — 状态横幅
- ///
- /// 垂直居中排列:大图标(40x40)、状态文字(16号/600字重)、副文字(13号)。
- /// 圆角8,高度120,padding (20,16),gap 8。
- class StatusBanner extends StatelessWidget {
- final IconData icon;
- final String statusText;
- final String subText;
- final Color color;
- const StatusBanner({
- super.key,
- required this.icon,
- required this.statusText,
- required this.subText,
- this.color = AppColors.success,
- });
- @override
- Widget build(BuildContext context) {
- final backgroundColor = _lighten(color, 0.88);
- return Container(
- width: double.infinity,
- padding: const EdgeInsets.fromLTRB(16, 24, 16, 24),
- decoration: BoxDecoration(
- color: backgroundColor,
- borderRadius: BorderRadius.circular(8),
- ),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(icon, size: 40, color: color),
- const SizedBox(height: 8),
- Text(
- statusText,
- style: TextStyle(
- fontSize: AppFontSizes.subtitle,
- fontWeight: FontWeight.w600,
- color: color,
- ),
- ),
- if (subText.isNotEmpty) ...[
- const SizedBox(height: 4),
- Text(
- subText,
- style: TextStyle(
- fontSize: 13,
- color: color,
- ),
- ),
- ],
- ],
- ),
- );
- }
- /// 将颜色变浅,用于计算背景色
- static Color _lighten(Color color, double amount) {
- return Color.lerp(color, Colors.white, amount)!;
- }
- }
|