feat(client): 三端布局架构 + macOS 桌面端 + app 图标
三端布局(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>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// form_factor.dart — 三端形态判定(mobile / tablet / desktop)
|
||||
//
|
||||
// 决定外壳与页面布局走哪一套。用 defaultTargetPlatform(web 安全,不依赖 dart:io)
|
||||
// + 窗口宽度联合判定:桌面平台优先 desktop,窗口拉极窄时降级 mobile 避免溢出。
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
enum FormFactor { mobile, tablet, desktop }
|
||||
|
||||
bool get _isDesktopPlatform {
|
||||
if (kIsWeb) return false;
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.macOS:
|
||||
case TargetPlatform.windows:
|
||||
case TargetPlatform.linux:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
extension FormFactorContext on BuildContext {
|
||||
/// 当前形态。桌面平台(macOS/Win/Linux)且宽≥680 → desktop;触屏/Web 宽≥600 → tablet;否则 mobile。
|
||||
FormFactor get formFactor {
|
||||
final w = MediaQuery.sizeOf(this).width;
|
||||
if (_isDesktopPlatform) return w >= 680 ? FormFactor.desktop : FormFactor.mobile;
|
||||
if (w >= 600) return FormFactor.tablet;
|
||||
return FormFactor.mobile;
|
||||
}
|
||||
|
||||
bool get isDesktop => formFactor == FormFactor.desktop;
|
||||
bool get isTablet => formFactor == FormFactor.tablet;
|
||||
bool get isMobile => formFactor == FormFactor.mobile;
|
||||
}
|
||||
Reference in New Issue
Block a user