feat: 实现导航页基础功能
- 添加导航条目和分类数据模型 - 实现导航卡片网格展示 - 支持点击卡片打开链接 - 添加主题样式(渐变色、卡片阴影) - 区分系统默认和自定义条目 - 添加分类统计信息"
This commit is contained in:
28
frontend/lib/models/nav_item.dart
Normal file
28
frontend/lib/models/nav_item.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
// 导航条目模型
|
||||
class NavItem {
|
||||
final String id; // 唯一标识
|
||||
final String title; // 显示名称
|
||||
final String url; // 链接地址
|
||||
final String icon; // 图标(emoji 或文字)
|
||||
final bool isSystem; // 是否系统默认(true=不可修改)
|
||||
|
||||
// 构造函数
|
||||
NavItem({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.url,
|
||||
required this.icon,
|
||||
required this.isSystem,
|
||||
});
|
||||
|
||||
// 从 JSON 创建对象(后续从后端获取数据时使用)
|
||||
factory NavItem.fromJson(Map<String, dynamic> json) {
|
||||
return NavItem(
|
||||
id: json['id'],
|
||||
title: json['title'],
|
||||
url: json['url'],
|
||||
icon: json['icon'] ?? '🔗',
|
||||
isSystem: json['isSystem'] ?? false,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user