4dc4127252
三端布局(mobile/tablet/desktop): - core/responsive/form_factor.dart 形态判定 + shell/ 分发器(home_shell→desktop/mobile) - desktop_shell 对照 ui_kits/desktop/dapp.jsx: 侧栏204·6项 + 套餐卡 + 顶栏(标题/状态/主题切换) + 连接页居中单列 - 新增组件 nav_sidebar / plan_badge_card / content_top_bar / bottom_tab_bar - 新增一级页 contact_page / settings_page; navigation_provider(NavView) - 删除旧 widgets/home_shell.dart(逻辑迁入 shell/) macOS 桌面端: - 窗口默认 920×600 + 最小 720×560(MainFlutterWindow.swift) - app 图标替换为穿山甲(AppIcon.appiconset 全套, 由 app-icon.svg 渲染) 其余(本会话): - Phase2 接线: auth_api/token_store/auth_provider/vpn_bridge_provider + 真实 connection/nodes - lucide_icons 兼容补丁(packages/lucide_icons_patched) 修复 IconData final 报错 - 测试修复: connect_passthrough(UTF-8) / harness / golden @Skip - l10n 新增 settingsTitle Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
1.5 KiB
Dart
44 lines
1.5 KiB
Dart
// harness.dart — 测试公共脚手架
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:pangolin_vpn/pangolin_theme.dart';
|
|
|
|
/// 测试环境禁用 google_fonts 运行时网络拉取(离线确定化)。
|
|
///
|
|
/// 注意:golden 测试需要实际渲染字体。如果字体未提前下载/缓存,
|
|
/// 禁用网络拉取会导致 google_fonts 抛出异常。
|
|
/// 因此此函数仅在非 golden 的行为型测试中调用(widgets_test / unit)。
|
|
void disableGoogleFontsFetching() {
|
|
GoogleFonts.config.allowRuntimeFetching = false;
|
|
}
|
|
|
|
/// Golden 测试专用:允许 google_fonts 从网络/缓存加载字体。
|
|
/// 首次运行会下载并缓存字体,后续离线运行时从缓存读取。
|
|
void enableGoogleFontsFetching() {
|
|
GoogleFonts.config.allowRuntimeFetching = true;
|
|
}
|
|
|
|
/// 用穿山甲明/暗主题包裹被测组件,并固定宽度便于 golden 对照。
|
|
Widget wrapThemed(
|
|
Widget child, {
|
|
bool dark = false,
|
|
double width = 360,
|
|
List<Override> overrides = const [],
|
|
}) {
|
|
return ProviderScope(
|
|
overrides: overrides,
|
|
child: MaterialApp(
|
|
debugShowCheckedModeBanner: false,
|
|
theme: PangolinTheme.light,
|
|
darkTheme: PangolinTheme.dark,
|
|
themeMode: dark ? ThemeMode.dark : ThemeMode.light,
|
|
home: Scaffold(
|
|
body: Center(
|
|
child: SizedBox(width: width, child: child),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|