feat(platform): 添加桌面端平台能力降级适配
- 新增 PlatformCapabilities 平台能力判断类,统一检测移动端原生插件可用性 - 地图、定位、扫码、相册、拨号、通话录制等入口在桌面端降级为提示 - 系统 UI 配置与 moveTaskToBack 在桌面端跳过,避免插件异常 - 设备信息工具新增 Windows 平台支持,返回 computerName - 百度地图 SDK 初始化增加平台判断,桌面端不再调用 - 新增个人资料编辑页面及路由,从「我的」页头部入口跳转 - 国际化添加 featureUnsupported 提示文案
This commit is contained in:
1 parent
5947fa1f53
commit
5f84a64c3e
18 files changed
+342
-73
No files matched your search
@@ -21,6 +21,9 @@ class DeviceInfoUtil {
|
||||
} else if (Platform.isIOS) {
|
||||
final info = await _plugin.iosInfo;
|
||||
return info.utsname.machine;
|
||||
} else if (Platform.isWindows) {
|
||||
final info = await _plugin.windowsInfo;
|
||||
return info.computerName;
|
||||
}
|
||||
} catch (_) {
|
||||
// 设备信息读取失败时静默回退,不影响主流程。
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
|
||||
import '../platform/platform_capabilities.dart';
|
||||
|
||||
/// 系统 UI(状态栏 / 导航栏)适配工具。
|
||||
///
|
||||
/// 集中处理沉浸式状态栏、edge-to-edge 布局与刘海屏(Display Cutout)适配,
|
||||
@@ -13,6 +15,8 @@ class SystemUiUtil {
|
||||
/// - 使用 edge-to-edge 布局:内容延伸到状态栏与导航栏区域。
|
||||
/// - 系统栏图标亮度由应用主题的 AnnotatedRegion 配置。
|
||||
static Future<void> configure() async {
|
||||
// 桌面端没有系统状态栏 / 导航栏,无需配置。
|
||||
if (!PlatformCapabilities.isMobile) return;
|
||||
// edge-to-edge:App 内容铺满全屏,安全区由 Flutter 的 SafeArea / MediaQuery
|
||||
// 在布局层兜底,系统栏以半透明覆盖层呈现。
|
||||
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
@@ -22,6 +26,8 @@ class SystemUiUtil {
|
||||
///
|
||||
/// 调用原生端的 moveTaskToBack(false),避免 Activity 销毁。
|
||||
static Future<void> moveToBack() async {
|
||||
// 原生 moveTaskToBack 仅 Android 实现,桌面端由窗口管理接管生命周期。
|
||||
if (!PlatformCapabilities.isMobile) return;
|
||||
const channel = MethodChannel('com.ttstd.familycare/app');
|
||||
try {
|
||||
await channel.invokeMethod('moveTaskToBack');
|
||||
|
||||
Reference in new issue
Block a user