Files
lixi 97a1f46e3f
CI / flutter-gates (push) Successful in 1m31s
重构:宠物列表/详情/编辑页接入真实数据(T2-12,四态齐备)
- 档案 Tab 替换为真实宠物列表(05 号规范 P1):PetsController 四态
  驱动(loading/empty/error+重试/ready),空态插画 + 建档 CTA,
  下拉刷新,虚线添加卡;页面一律走 T2-11 数据层、不直连 ApiClient
- 新增 PetDetailPage(P2 档案信息部分):内存副本首屏 + getPet 刷新,
  40401 防枚举 → 不存在态返回列表并刷新;仅 owner 显示编辑入口
  (40300 语义);体重/疫苗/时间线区块留待 T2-13/14 接摘要与记录接口
- 新增 PetFormPage(建档/编辑):品种目录接口 + 自定义品种互斥
  (目录失败回落自定义 + 重试)、性别契约必填、生日+估算、芯片号;
  失焦+提交双校验、错误三层模型沿用登录纵切
- 40902 版本冲突:明确提示 + 自动拉取最新 version 重提路径(有测试);
  40903 芯片号冲突字段级报错(有测试)
- 埋点挂接:pet_create_started(表单首次输入、每次进入一次)/
  succeeded / failed 三事件接线;建宠表单路由名 pet_form、详情页
  pet_detail 进入既有 RouteObserver 采集;档案 Tab 页名 pet_archive
  改报 pet_list(字典 v2);编辑表单不带路由名(漏斗到达段不掺编辑)
- app.dart 装配:pet 服务 ApiClient(:8083)共享 TokenRefresher;
  登出 reset 控制器防跨账号泄漏;PetsController.loadBreeds 按物种缓存
- AppState 清理:pets 页原 demo 消费方移除,vaccines 及其模型/持久化
  删除;pet demo 仅存首页问候/创作页/主壳头像(后续工单收敛)
- 头像按 ADR-010 本地占位,不做上传
- 测试 145 → 177 全绿(列表/详情/表单四态与冲突路径 widget 测试、
  控制器 loadBreeds/reset、展示纯函数);analyze 0;format 无 diff

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-08 12:15:32 +08:00

246 lines
6.9 KiB
Dart

import 'package:patbond_flutter/models/models.dart';
const petAvatar =
'https://images.unsplash.com/photo-1552053831-71594a27632d?auto=format&fit=crop&w=600&q=85';
const userAvatar =
'https://images.unsplash.com/photo-1494790108377-be9c29b29330?auto=format&fit=crop&w=300&q=80';
const generatedPetImage =
'https://images.unsplash.com/photo-1605568427561-40dd23c2acea?auto=format&fit=crop&w=1200&q=85';
const locationWeatherOptions = [
LocationWeather(
city: '北京',
district: '朝阳区',
temperature: 28,
condition: WeatherCondition.sunny,
conditionText: '晴',
highTemperature: 31,
lowTemperature: 21,
humidity: 42,
),
LocationWeather(
city: '上海',
district: '浦东新区',
temperature: 25,
condition: WeatherCondition.cloudy,
conditionText: '多云',
highTemperature: 28,
lowTemperature: 22,
humidity: 68,
),
LocationWeather(
city: '深圳',
district: '南山区',
temperature: 32,
condition: WeatherCondition.rainy,
conditionText: '阵雨',
highTemperature: 34,
lowTemperature: 27,
humidity: 81,
),
LocationWeather(
city: '成都',
district: '高新区',
temperature: 23,
condition: WeatherCondition.overcast,
conditionText: '阴',
highTemperature: 26,
lowTemperature: 19,
humidity: 72,
),
LocationWeather(
city: '杭州',
district: '西湖区',
temperature: 27,
condition: WeatherCondition.cloudy,
conditionText: '多云',
highTemperature: 30,
lowTemperature: 22,
humidity: 64,
),
LocationWeather(
city: '哈尔滨',
district: '道里区',
temperature: 6,
condition: WeatherCondition.snow,
conditionText: '小雪',
highTemperature: 8,
lowTemperature: 1,
humidity: 73,
),
];
final initialLocationWeather = locationWeatherOptions.first;
const initialPet = PetProfile(
name: '豆豆',
breed: '柴犬',
gender: PetGender.male,
birthday: '2024-05-15',
weight: 5.2,
tags: ['已绝育', '疫苗齐全', '定期驱虫', '芯片植入'],
avatarUrl: petAvatar,
);
const initialPosts = [
PostModel(
id: 'post1',
authorName: '豆豆的妈妈',
authorAvatar: userAvatar,
time: '2小时前',
breedTag: '柴犬',
content: '用 AI 把豆豆生成了治愈系插画,太可爱了吧!大家也快去试试创作功能!✨',
mainImage: generatedPetImage,
likes: 128,
tags: ['AI创作', '柴犬', 'Patbond'],
comments: [
CommentModel(
id: 'c1',
authorName: 'CorgiLover99',
authorAvatar:
'https://images.unsplash.com/photo-1534528741775-53994a69daeb?auto=format&fit=crop&w=200&q=80',
content: '这也太像了吧!求教程怎么生成的?',
time: '1小时前',
),
CommentModel(
id: 'c2',
authorName: 'MiloDaCat',
authorAvatar:
'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?auto=format&fit=crop&w=200&q=80',
content: '好可爱的画风,豆豆真上镜!',
time: '45分钟前',
),
],
),
PostModel(
id: 'post2',
authorName: 'Momo と猫',
authorAvatar:
'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?auto=format&fit=crop&w=200&q=80',
time: '5小时前',
breedTag: '求助专区',
content: '猫咪最近总是挠耳朵,有懂的朋友吗?',
mainImage:
'https://images.unsplash.com/photo-1574158622682-e40e69881006?auto=format&fit=crop&w=1200&q=85',
likes: 12,
tags: ['猫咪健康', '求助'],
comments: [
CommentModel(
id: 'c3',
authorName: '猫奴小七',
authorAvatar:
'https://images.unsplash.com/photo-1527980965255-d3b416303d12?auto=format&fit=crop&w=200&q=80',
content: '建议先去医院检查耳道,不要自行用药哦。',
time: '4小时前',
),
],
),
];
const serviceProviders = [
ServiceProviderModel(
id: 'h1',
kind: ProviderKind.hospital,
name: '安宠动物医院(高新旗舰店)',
distance: '1.2km',
rating: 4.9,
description: '猫科内科 · 骨外科 · 预防医学 · 24H急诊',
tags: ['猫专科认证', '24H急诊'],
price: 299,
image:
'https://images.unsplash.com/photo-1628009368231-7bb7cfcb0def?auto=format&fit=crop&w=900&q=85',
verified: true,
),
ServiceProviderModel(
id: 'h2',
kind: ProviderKind.hospital,
name: '瑞派宠物医院(南山分院)',
distance: '3.5km',
rating: 4.7,
description: '异宠专科 · 牙科 · 皮肤科',
tags: ['异宠专家坐诊'],
price: 399,
image:
'https://images.unsplash.com/photo-1581888227599-779811939961?auto=format&fit=crop&w=900&q=85',
),
ServiceProviderModel(
id: 'g1',
kind: ProviderKind.grooming,
name: 'PawSpa 高级宠物沙龙',
distance: '1.6km',
rating: 4.9,
description: '资深美容师主理 · 环境静音 · 猫咪免应激',
tags: ['日系精修', '猫咪免应激'],
price: 158,
image:
'https://images.unsplash.com/photo-1516734212186-a967f81ad0d7?auto=format&fit=crop&w=900&q=85',
verified: true,
),
ServiceProviderModel(
id: 'p1',
kind: ProviderKind.personal,
name: '阳光遛狗员-阿健',
distance: '0.8km',
rating: 4.9,
description: '资深铲屎官,提供耐心、安全的上门遛狗服务。',
tags: ['实时定位', '自带清洁包', '只接中小型犬'],
price: 45,
image:
'https://images.unsplash.com/photo-1601758228041-f3b2795255f1?auto=format&fit=crop&w=900&q=85',
verified: true,
),
ServiceProviderModel(
id: 'p2',
kind: ProviderKind.personal,
name: '喵汪小保姆-莉莉',
distance: '3.5km',
rating: 4.7,
description: '周末全天可接单,可接大型犬并提供喂食服务。',
tags: ['可接大型犬', '体能充沛'],
price: 60,
image:
'https://images.unsplash.com/photo-1558788353-f76d92427f16?auto=format&fit=crop&w=900&q=85',
),
];
const creationStyles = [
CreationStyle(
id: 'healing',
title: '治愈动画',
subtitle: '梦幻动漫感',
image: generatedPetImage,
),
CreationStyle(
id: '3d',
title: '3D 卡通',
subtitle: '经典渲染',
image:
'https://images.unsplash.com/photo-1558929996-da64ba858215?auto=format&fit=crop&w=700&q=85',
),
CreationStyle(
id: 'comic',
title: '漫画风',
subtitle: '帅气网格',
image:
'https://images.unsplash.com/photo-1543466835-00a7907e9de1?auto=format&fit=crop&w=700&q=85',
),
CreationStyle(
id: 'watercolor',
title: '水彩',
subtitle: '柔和手绘质感',
image:
'https://images.unsplash.com/photo-1537151608828-ea2b11777ee8?auto=format&fit=crop&w=700&q=85',
),
];
const serviceCategories = [
('投喂', 'restaurant'),
('遛狗', 'walk'),
('洗澡', 'bath'),
('美容', 'cut'),
('寄养', 'home'),
('运输', 'truck'),
('领养', 'favorite'),
('医院', 'hospital'),
];