Files
Navius/frontend/lib/models/category.dart
CNWei 4075519075 feat: 实现导航页基础功能
- 添加导航条目和分类数据模型
- 实现导航卡片网格展示
- 支持点击卡片打开链接
- 添加主题样式(渐变色、卡片阴影)
- 区分系统默认和自定义条目
- 添加分类统计信息"
2026-09-06 21:44:33 +08:00

28 lines
725 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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(),
);
}
}