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:
wangjia
2026-07-03 09:58:14 +08:00
parent ca7595b113
commit 6238b86dcb
286 changed files with 16831 additions and 11136 deletions
+157 -35
View File
@@ -2,73 +2,195 @@ 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/models/page_result.dart';
import 'package:jiu_client/core/auth/auth_state.dart';
import 'package:jiu_client/core/models/page_result.dart';
import 'package:jiu_client/core/utils/clock.dart';
import 'package:jiu_client/models/finance.dart';
import 'package:jiu_client/models/stock_summary.dart';
import 'package:jiu_client/providers/finance_provider.dart';
import 'package:jiu_client/repositories/finance_repository.dart';
import 'package:jiu_client/providers/stock_in_provider.dart';
import 'package:jiu_client/providers/stock_out_provider.dart';
import 'package:jiu_client/screens/finance/finance_screen.dart';
import '../support/golden_harness.dart';
import '../support/shell_harness.dart';
/// design-distill 阶段4:财务整屏 golden × 三主题(桌面 + 移动)。
/// 验证类型徽章(应收/应付/收款/付款)+ 结清状态徽章 → StatusPill 随主题换色。
/// design-distill 阶段4:财务管理 golden × 三主题(回归闸 + 保真基准)。
/// 桌面版挂进真 AppShell,数据照抄原型 screens/finance.html 的
/// TREND6 月)/ SUMMARY8 单位)/ FLOWS10 条);KPI 环比经 stock summary
/// 假数据凑成 ▲8.4% / ▼3.1%
/// node tools/fidelity.mjs finance
/// 更新基准:flutter test --update-goldens test/golden/finance_golden_test.dart
const _records = [
FinanceRecord(
id: 1, type: 'receivable', amount: 126800, balance: 126800,
status: 'open', partnerName: '鼎丰超市', recordDate: '2026-06-20'),
FinanceRecord(
id: 2, type: 'payable', amount: 152600, balance: 0,
status: 'closed', partnerName: '老窖酒水批发', recordDate: '2026-06-18'),
FinanceRecord(
id: 3, type: 'receipt', amount: 54200, balance: 0,
status: 'closed', partnerName: '金樽酒楼', recordDate: '2026-06-15'),
FinanceRecord(
id: 4, type: 'payment', amount: 88400, balance: 88400,
status: 'open', partnerName: '汾酒山西直营', recordDate: '2026-06-12'),
// 原型 TREND(万元 → 元)
const _trend = [
TrendPoint(month: '2026-01', inAmount: 1420000, outAmount: 1180000),
TrendPoint(month: '2026-02', inAmount: 960000, outAmount: 880000),
TrendPoint(month: '2026-03', inAmount: 1680000, outAmount: 1210000),
TrendPoint(month: '2026-04', inAmount: 1540000, outAmount: 1090000),
TrendPoint(month: '2026-05', inAmount: 1720000, outAmount: 1360000),
TrendPoint(month: '2026-06', inAmount: 1860000, outAmount: 1320000),
];
// 财务屏经 FutureBuilder 直读 repository,故覆盖 repoimplements + noSuchMethod
// 只实现 listRecords,其余方法 golden 静态渲染不会触达)。
class _FakeFinanceRepo implements FinanceRepository {
@override
Future<PageResult<FinanceRecord>> listRecords({
String? type,
String? month,
int page = 1,
int pageSize = 50,
}) async =>
const PageResult(data: _records, total: 4, page: 1, pageSize: 20);
// 原型 SUMMARY 8 行
const _rows = [
PartnerFinanceRow(partnerId: 1, name: '华东酒类批发', recv: 128400, openCount: 2),
PartnerFinanceRow(partnerId: 2, name: '金樽商贸', recv: 86200, openCount: 1),
PartnerFinanceRow(partnerId: 3, name: '茅台华南经销', pay: 142800, openCount: 1),
PartnerFinanceRow(partnerId: 4, name: '鸿运餐饮连锁', recv: 74600, openCount: 1),
PartnerFinanceRow(partnerId: 5, name: '五粮液省级代理', pay: 96400, openCount: 1),
PartnerFinanceRow(
partnerId: 6, name: '盛世名酒城', recv: 52300, pay: 18600, openCount: 2),
PartnerFinanceRow(partnerId: 7, name: '御品烟酒行', recv: 31800, openCount: 1),
PartnerFinanceRow(partnerId: 8, name: '川渝糖酒集团', pay: 60400, openCount: 1),
];
// 原型 FLOWS 10 条(收款→receipt / 付款→payment;原型 SK/FK 单号无对应
// ref 模型 → 关联单号列显 —,属已知差异)
const _flows = [
FinanceRecord(
id: 1,
type: 'receipt',
amount: 68000,
balance: 0,
status: 'closed',
partnerName: '华东酒类批发',
recordDate: '2026-06-20',
remark: '飞天茅台货款'),
FinanceRecord(
id: 2,
type: 'payment',
amount: 142800,
balance: 0,
status: 'closed',
partnerName: '茅台华南经销',
recordDate: '2026-06-19',
remark: '6月采购结算'),
FinanceRecord(
id: 3,
type: 'receipt',
amount: 42600,
balance: 0,
status: 'closed',
partnerName: '金樽商贸',
recordDate: '2026-06-18',
remark: '五粮液尾款'),
FinanceRecord(
id: 4,
type: 'receipt',
amount: 31500,
balance: 0,
status: 'closed',
partnerName: '鸿运餐饮连锁',
recordDate: '2026-06-17',
remark: '宴会用酒'),
FinanceRecord(
id: 5,
type: 'payment',
amount: 96400,
balance: 0,
status: 'closed',
partnerName: '五粮液省级代理',
recordDate: '2026-06-16',
remark: '普五补货'),
FinanceRecord(
id: 6,
type: 'receipt',
amount: 23800,
balance: 0,
status: 'closed',
partnerName: '盛世名酒城',
recordDate: '2026-06-15',
remark: '国窖1573'),
FinanceRecord(
id: 7,
type: 'payment',
amount: 60400,
balance: 0,
status: 'closed',
partnerName: '川渝糖酒集团',
recordDate: '2026-06-14',
remark: '剑南春进货'),
FinanceRecord(
id: 8,
type: 'receipt',
amount: 18900,
balance: 0,
status: 'closed',
partnerName: '御品烟酒行',
recordDate: '2026-06-13',
remark: '习酒窖藏'),
FinanceRecord(
id: 9,
type: 'payment',
amount: 18600,
balance: 0,
status: 'closed',
partnerName: '盛世名酒城',
recordDate: '2026-06-12',
remark: '退换货补差'),
FinanceRecord(
id: 10,
type: 'receipt',
amount: 55200,
balance: 0,
status: 'closed',
partnerName: '华东酒类批发',
recordDate: '2026-06-11',
remark: '梦之蓝M6'),
];
class _FakeFinanceList extends FinanceListNotifier {
@override
dynamic noSuchMethod(Invocation invocation) =>
super.noSuchMethod(invocation);
Future<PageResult<FinanceRecord>> build() async =>
const PageResult(data: _flows, total: 10, page: 1, pageSize: 50);
@override
void setType(String type) {}
@override
void setMonth(String month) {}
@override
void setRange(String startDate, String endDate) {}
@override
void setPage(int page) {}
@override
void setPageSize(int pageSize) {}
@override
void reload() {}
}
List<Override> _overrides() => [
financeRepositoryProvider.overrideWithValue(_FakeFinanceRepo()),
financeListProvider.overrideWith(() => _FakeFinanceList()),
financeTrendProvider.overrideWith((ref) async => _trend),
financePartnerRowsProvider.overrideWith((ref) async => _rows),
// 环比凑成原型 ▲8.4% / ▼3.1%
stockOutSummaryProvider.overrideWith((ref) async =>
const StockSummary(monthAmount: 1860000, lastMonthAmount: 1715867)),
stockInSummaryProvider.overrideWith((ref) async =>
const StockSummary(monthAmount: 1320000, lastMonthAmount: 1362229)),
isReadonlyProvider.overrideWithValue(false),
];
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
SharedPreferences.setMockInitialValues({});
appClock = () => DateTime(2026, 7, 13, 9, 30, 15);
goldenAcrossThemes(
'finance 整屏(桌面)',
// 桌面:外壳挂载整框,与原型整页同构
shellGoldenAcrossThemes(
'finance 整框(桌面)',
path: '/finance',
screen: (_) => const FinanceScreen(),
goldenPrefix: 'finance',
child: () => const Scaffold(body: FinanceScreen()),
overrides: _overrides,
logical: const Size(1280, 900),
);
// 移动:窄屏单列(KPI 横滚 + 卡片流)
goldenAcrossThemes(
'finance 整屏(移动)',
goldenPrefix: 'finance_mobile',
child: () => const Scaffold(body: FinanceScreen()),
overrides: _overrides,
logical: const Size(390, 1300),
logical: const Size(390, 1600),
);
}