feat(client): 设置/用户/设备/关于窄屏对齐移动原型(hub 形态/卡片流/sheet/无打印)
- 系统设置窄屏改 hub 三组(门店/偏好/数据):门店信息/编号规则/默认仓库走 底部 sheet,主题外观接 showThemeSheet,?tab= 深链窄屏忽略;桌面 subnav 不动 - 用户管理窄屏:m-section + 头像卡片流 + 角色图标徽章 + FAB 新增; 点卡开详情 sheet(drow + 重置密码/启停/编辑),表单复用为 sheet 形态 - 设备管理窄屏:会话卡流(本机标注/在线图标徽章)+ 外设卡流(mc-foot 脚注), 「+ 添加设备」在区块标题行右侧(m-pill 选择 sheet),打印模板窄屏不渲染 - 关于我们窄屏:品牌 hero + hub 链接组 + 产品信息 drow 卡 + 时间线 pill 标签 + 意见反馈 sheet(类型 pill/描述/联系方式);授权信息不显示(已迁 /me/license) - golden:四屏窄屏基准独立成 *_mobile_golden_test.dart(390×844 @2x 三主题), 桌面 golden 零漂移 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
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';
|
||||
|
||||
/// 设备管理窄屏 golden × 三主题(390×844 @2x):m-section 两区块——
|
||||
/// 登录设备会话卡流(用户·平台+本机 / 设备·IP / 在线徽章+时间 / ›)
|
||||
/// + 外设卡流(名称 / 型号·类型·连接 / 状态徽章 / 最近活动脚注),
|
||||
/// 「+ 添加设备」在区块标题行右侧,打印模板不渲染——对齐原型 m-devices.html。
|
||||
/// 更新基准:flutter test --update-goldens test/golden/device_management_mobile_golden_test.dart
|
||||
|
||||
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),
|
||||
];
|
||||
|
||||
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 分钟前'
|
||||
},
|
||||
];
|
||||
|
||||
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;
|
||||
@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(
|
||||
'devices 卡片流 整屏(移动)',
|
||||
goldenPrefix: 'device_management_mobile',
|
||||
child: () => const Scaffold(body: DeviceManagementScreen()),
|
||||
overrides: _overrides,
|
||||
logical: const Size(390, 844),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user