feat: 实现导航页基础功能
- 添加导航条目和分类数据模型 - 实现导航卡片网格展示 - 支持点击卡片打开链接 - 添加主题样式(渐变色、卡片阴影) - 区分系统默认和自定义条目 - 添加分类统计信息"
This commit is contained in:
28
frontend/lib/models/category.dart
Normal file
28
frontend/lib/models/category.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'nav_item.dart';
|
||||
|
||||
// 导航分类模型
|
||||
class Category {
|
||||
final String id; // 分类唯一标识
|
||||
final String name; // 分类名称
|
||||
final bool isSystem; // 是否系统分类(true=不可修改)
|
||||
final List<NavItem> entries; // 该分类下的导航条目
|
||||
|
||||
Category({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.isSystem,
|
||||
required this.entries,
|
||||
});
|
||||
|
||||
// 从 JSON 创建
|
||||
factory Category.fromJson(Map<String, dynamic> json) {
|
||||
return Category(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
isSystem: json['isSystem'] ?? false,
|
||||
entries: (json['entries'] as List)
|
||||
.map((e) => NavItem.fromJson(e))
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user