feat(client): 设备管理屏在线状态徽章 → StatusPill + golden
onlineBadge(在线/离线 圆点文字)→ StatusPill(圆点软底 pill, success/okSoft 与 muted/infoSoft);整屏 golden ×三主题(桌面+移动)入回归闸。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSKEiHsvauyxYUW2itzUXX
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
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/models/session.dart';
|
||||
import 'package:jiu_client/providers/session_provider.dart';
|
||||
import 'package:jiu_client/screens/devices/device_management_screen.dart';
|
||||
|
||||
import '../support/golden_harness.dart';
|
||||
|
||||
/// design-distill 阶段4:设备管理整屏 golden × 三主题(桌面 + 移动)。
|
||||
/// 验证在线/离线状态 → StatusPill 随主题换色。
|
||||
/// 更新基准: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),
|
||||
];
|
||||
|
||||
class _FakeSessionNotifier extends SessionListNotifier {
|
||||
@override
|
||||
Future<List<DeviceSession>> build() async => _sessions();
|
||||
@override
|
||||
Future<void> reload() async {}
|
||||
}
|
||||
|
||||
List<Override> _overrides() => [
|
||||
sessionListProvider.overrideWith(() => _FakeSessionNotifier()),
|
||||
];
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
|
||||
goldenAcrossThemes(
|
||||
'device management 整屏(桌面)',
|
||||
goldenPrefix: 'device_management',
|
||||
child: () => const Scaffold(body: DeviceManagementScreen()),
|
||||
overrides: _overrides,
|
||||
logical: const Size(1280, 900),
|
||||
);
|
||||
|
||||
goldenAcrossThemes(
|
||||
'device management 整屏(移动)',
|
||||
goldenPrefix: 'device_management_mobile',
|
||||
child: () => const Scaffold(body: DeviceManagementScreen()),
|
||||
overrides: _overrides,
|
||||
logical: const Size(390, 1100),
|
||||
);
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
Reference in New Issue
Block a user