77 lines
2.1 KiB
Dart
77 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../const/font.dart';
|
|
|
|
/// 工具元信息 —— 数据驱动首页卡片渲染
|
|
class ToolMeta {
|
|
final String name;
|
|
final String description;
|
|
final IconData icon;
|
|
final Color iconColor;
|
|
final Color bgColor;
|
|
|
|
const ToolMeta({
|
|
required this.name,
|
|
required this.description,
|
|
required this.icon,
|
|
this.iconColor = Colors.blue,
|
|
this.bgColor = const Color(0xFFF5F5F5),
|
|
});
|
|
}
|
|
|
|
class ToolCard extends StatelessWidget {
|
|
const ToolCard({super.key, required this.meta});
|
|
|
|
final ToolMeta meta;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Card(
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
|
child: Row(
|
|
children: [
|
|
// 图标占位区
|
|
Container(
|
|
width: 80,
|
|
height: double.infinity,
|
|
decoration: BoxDecoration(
|
|
color: meta.bgColor,
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Icon(meta.icon, color: meta.iconColor, size: 36),
|
|
),
|
|
SizedBox(width: 12),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
meta.name,
|
|
style: TextStyle(
|
|
fontSize: Font.FONT_SIZE_SUBTITLE,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
SizedBox(height: 6),
|
|
Divider(height: 1),
|
|
SizedBox(height: 6),
|
|
Text(
|
|
meta.description,
|
|
maxLines: 2,
|
|
style: TextStyle(
|
|
fontSize: Font.FONT_SIZE_CONTENT,
|
|
overflow: TextOverflow.ellipsis,
|
|
color: Colors.grey.shade600,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|