// 模板 BLoC — 通过 API 加载模板列表 import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:nuanji_app/data/remote/api_client.dart'; // ===== 模型 ===== /// 日记模板 class Template { final String id; final String name; final String? description; final String? previewUrl; final Map? templateData; final String? category; final bool isFree; /// 用于 UI 显示的 emoji(基于 category 推导) String get emoji => switch (category) { '日常' => '☀️', '旅行' => '🗺️', '校园' => '📚', '节日' => '🎄', '创意' => '✨', _ => '📝', }; const Template({ required this.id, required this.name, this.description, this.previewUrl, this.templateData, this.category, this.isFree = true, }); } // ===== State ===== /// 模板页面状态 class TemplateState { final List