feat(client): 登录/注册页照原型重建,ds 真相源组件族统一全部屏
- 登录/注册(login.html/register.html 1:1):两栏卡片+品牌渐变面板+主题小衣服 pill(onSurface 变体)+记住我(记录并预填最近账号)+原型式 toast 校验; 登录 fidelity 1.4–2.1% 三主题全绿;注册暂不入闸(少 门店编号/兑换券 字段, 已记 CONTRACT,screens.mjs 留存根) - ds 原子补齐:DsToast(.toast 单例)/DsCheck(.check/.agree)/DsButton lg 档/ DsSelect 替换全部旧 DropdownButton/DsField label 在上/DsInput 后缀与密码形态 - 全屏统一:对话框按钮全 DsButton、盒式输入主题钉死(visualDensity.standard、 h38、InputDecorationTheme 渗漏修复)、图标全 lucide、JetBrains Mono 三端同源、 BrandMark 真相源 logo、只读模式写操作全量守卫(WriteGuard+DsToast) - 出入库列表:版式对齐原型(卡片对齐+搜索框居中)、KPI 近30天滚动、结清后 失效财务应收应付表;商品编辑抽屉介绍库改搜索下拉、图片双击全屏预览 - 删除旧 UI 死代码:DataTableCard/FormDialog/PageScaffold/SearchChip/ SelectProductDialog/tabStateProvider - golden/fidelity:stock-in/out 补注册(9%)、login 入册(8%)、goldens 全量重打; 修复 pubspec flutter_web_plugins 非法声明(CI pub get 阻断) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJ1g8XV1YhhmHRzhwWEW7o
This commit is contained in:
@@ -2,62 +2,166 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:jiu_client/core/auth/auth_state.dart';
|
||||
import 'package:jiu_client/models/session.dart';
|
||||
import 'package:jiu_client/models/shop.dart';
|
||||
import 'package:jiu_client/providers/session_provider.dart';
|
||||
import 'package:jiu_client/providers/shop_provider.dart';
|
||||
import 'package:jiu_client/screens/devices/device_management_screen.dart';
|
||||
|
||||
import '../support/golden_harness.dart';
|
||||
import '../support/shell_harness.dart';
|
||||
|
||||
/// design-distill 阶段4:设备管理整屏 golden × 三主题(桌面 + 移动)。
|
||||
/// 验证在线/离线状态 → StatusPill 随主题换色。
|
||||
/// design-distill 阶段4:设备管理 golden × 三主题(回归闸 + 保真基准)。
|
||||
/// 桌面版挂进真 AppShell,数据照抄原型 screens/devices.html 的
|
||||
/// SESSIONS(4 行会话)与 DEVICES(5 台外设 → 店级 custom_fields.peripherals):
|
||||
/// node tools/fidelity.mjs devices
|
||||
/// 更新基准:flutter test --update-goldens test/golden/device_management_golden_test.dart
|
||||
|
||||
List<DeviceSession> _sessions() => [
|
||||
DeviceSession(
|
||||
id: 1, userId: 1, username: '王经理', realName: '王经理',
|
||||
platform: 'macos', platformClass: 'desktop', deviceName: 'MacBook Pro',
|
||||
ip: '192.168.1.12', createdAt: DateTime(2026, 6, 20, 9, 12),
|
||||
lastSeenAt: DateTime(2026, 6, 25, 12, 50), online: true, isCurrent: true),
|
||||
DeviceSession(
|
||||
id: 2, userId: 2, username: '李销售', realName: '李销售',
|
||||
platform: 'android', platformClass: 'mobile', deviceName: 'Xiaomi 14',
|
||||
ip: '192.168.1.23', createdAt: DateTime(2026, 6, 24, 14, 30),
|
||||
lastSeenAt: DateTime(2026, 6, 25, 11, 05), online: true, isCurrent: false),
|
||||
DeviceSession(
|
||||
id: 3, userId: 3, username: '张前台', realName: '张前台',
|
||||
platform: 'windows', platformClass: 'desktop', deviceName: 'ThinkPad',
|
||||
ip: '192.168.1.31', createdAt: DateTime(2026, 6, 22, 8, 40),
|
||||
lastSeenAt: DateTime(2026, 6, 23, 18, 20), online: false, isCurrent: false),
|
||||
];
|
||||
// 原型 SESSIONS 4 行(时间 MM-DD HH:mm)
|
||||
final _sessions = [
|
||||
DeviceSession(
|
||||
id: 1,
|
||||
userId: 1,
|
||||
username: '王经理',
|
||||
realName: '王经理',
|
||||
platform: 'macos',
|
||||
platformClass: 'desktop',
|
||||
deviceName: 'macos',
|
||||
ip: '192.168.1.20',
|
||||
createdAt: DateTime(2026, 6, 20, 11, 23),
|
||||
lastSeenAt: DateTime(2026, 6, 22, 17, 40),
|
||||
online: true,
|
||||
isCurrent: true),
|
||||
DeviceSession(
|
||||
id: 2,
|
||||
userId: 1,
|
||||
username: '王经理',
|
||||
realName: '王经理',
|
||||
platform: 'windows',
|
||||
platformClass: 'desktop',
|
||||
deviceName: 'windows',
|
||||
ip: '192.168.1.21',
|
||||
createdAt: DateTime(2026, 6, 20, 10, 47),
|
||||
lastSeenAt: DateTime(2026, 6, 22, 17, 40),
|
||||
online: true,
|
||||
isCurrent: false),
|
||||
DeviceSession(
|
||||
id: 3,
|
||||
userId: 2,
|
||||
username: '李采购',
|
||||
realName: '李采购',
|
||||
platform: 'windows',
|
||||
platformClass: 'desktop',
|
||||
deviceName: 'windows',
|
||||
ip: '192.168.1.35',
|
||||
createdAt: DateTime(2026, 6, 20, 9, 13),
|
||||
lastSeenAt: DateTime(2026, 6, 22, 17, 11),
|
||||
online: false,
|
||||
isCurrent: false),
|
||||
DeviceSession(
|
||||
id: 4,
|
||||
userId: 3,
|
||||
username: '张前台',
|
||||
realName: '张前台',
|
||||
platform: 'ios',
|
||||
platformClass: 'mobile',
|
||||
deviceName: 'ios',
|
||||
ip: '10.0.0.8',
|
||||
createdAt: DateTime(2026, 6, 21, 17, 9),
|
||||
lastSeenAt: DateTime(2026, 6, 22, 16, 32),
|
||||
online: false,
|
||||
isCurrent: false),
|
||||
];
|
||||
|
||||
// 原型 DEVICES 5 台外设(登记式存档)
|
||||
const _peripherals = [
|
||||
{
|
||||
'name': '前台标签打印机',
|
||||
'kind': '标签打印机',
|
||||
'status': '在线',
|
||||
'model': 'Zebra GK888t',
|
||||
'conn': 'USB',
|
||||
'last': '2 分钟前'
|
||||
},
|
||||
{
|
||||
'name': '收银台小票机',
|
||||
'kind': '小票打印机',
|
||||
'status': '在线',
|
||||
'model': '佳博 GP-58MB',
|
||||
'conn': '蓝牙',
|
||||
'last': '刚刚'
|
||||
},
|
||||
{
|
||||
'name': '入库扫码枪',
|
||||
'kind': '扫码枪',
|
||||
'status': '在线',
|
||||
'model': 'Honeywell 1900',
|
||||
'conn': 'USB',
|
||||
'last': '5 分钟前'
|
||||
},
|
||||
{
|
||||
'name': '仓库电子秤',
|
||||
'kind': '电子秤',
|
||||
'status': '离线',
|
||||
'model': '香山 ACS-30',
|
||||
'conn': 'WiFi 192.168.1.66',
|
||||
'last': '昨天 17:42'
|
||||
},
|
||||
{
|
||||
'name': '备用标签机',
|
||||
'kind': '标签打印机',
|
||||
'status': '离线',
|
||||
'model': 'Brother QL-820',
|
||||
'conn': '网络 192.168.1.51',
|
||||
'last': '3 天前'
|
||||
},
|
||||
];
|
||||
|
||||
const _shopWithPeripherals = ShopInfo(
|
||||
id: 1,
|
||||
code: 'DSJH-001',
|
||||
name: '鼎晟酒行',
|
||||
address: '浙江省杭州市拱墅区运河路 168 号 1 幢',
|
||||
phone: '0571-8888 6666',
|
||||
managerName: '王经理',
|
||||
wechatId: 'dingsheng-wine',
|
||||
customFields: {'peripherals': _peripherals},
|
||||
);
|
||||
|
||||
class _FakeSessionNotifier extends SessionListNotifier {
|
||||
@override
|
||||
Future<List<DeviceSession>> build() async => _sessions();
|
||||
Future<List<DeviceSession>> build() async => _sessions;
|
||||
@override
|
||||
Future<void> reload() async {}
|
||||
}
|
||||
|
||||
List<Override> _overrides() => [
|
||||
sessionListProvider.overrideWith(() => _FakeSessionNotifier()),
|
||||
shopInfoProvider.overrideWith((ref) => _shopWithPeripherals),
|
||||
isReadonlyProvider.overrideWithValue(false),
|
||||
];
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
|
||||
goldenAcrossThemes(
|
||||
'device management 整屏(桌面)',
|
||||
// 桌面:外壳挂载整框,与原型整页同构
|
||||
shellGoldenAcrossThemes(
|
||||
'devices 整框(桌面)',
|
||||
path: '/devices',
|
||||
screen: (_) => const DeviceManagementScreen(),
|
||||
goldenPrefix: 'device_management',
|
||||
child: () => const Scaffold(body: DeviceManagementScreen()),
|
||||
overrides: _overrides,
|
||||
logical: const Size(1280, 900),
|
||||
);
|
||||
|
||||
// 移动:窄屏卡片流
|
||||
goldenAcrossThemes(
|
||||
'device management 整屏(移动)',
|
||||
'devices 整屏(移动)',
|
||||
goldenPrefix: 'device_management_mobile',
|
||||
child: () => const Scaffold(body: DeviceManagementScreen()),
|
||||
overrides: _overrides,
|
||||
logical: const Size(390, 1100),
|
||||
logical: const Size(390, 1400),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user