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
@@ -17,6 +17,7 @@ import '../../features/home/presentation/system_settings_page.dart';
|
||||
import '../../features/home/presentation/wallpaper_page.dart';
|
||||
import '../../features/messages/presentation/messages_tab.dart';
|
||||
import '../../features/profile/presentation/profile_tab.dart';
|
||||
import '../../features/profile/presentation/profile_edit_page.dart';
|
||||
import '../../features/album/presentation/album_page.dart';
|
||||
import '../../features/alarm/presentation/alarm_page.dart';
|
||||
import '../../features/alarm/presentation/alarm_edit_page.dart';
|
||||
@@ -114,6 +115,7 @@ GoRouter buildAppRouter() {
|
||||
path: '/device/scan',
|
||||
builder: (context, state) => const DeviceScanPage(),
|
||||
),
|
||||
GoRoute(path: '/profile/edit', builder: (context, state) => const ProfileEditPage()),
|
||||
GoRoute(
|
||||
path: '/security',
|
||||
builder: (context, state) => const SecurityPage(),
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../widgets/settings_ui.dart';
|
||||
|
||||
/// 平台能力开关。
|
||||
///
|
||||
/// 地图、定位、扫码、相册、拨号与通话录制依赖只提供 Android / iOS 实现的原生插件;
|
||||
/// 桌面端(Windows / Linux / macOS)暂未接入,统一在此判断并在入口处降级为提示,
|
||||
/// 避免插件抛出 MissingPluginException 导致页面异常。
|
||||
class PlatformCapabilities {
|
||||
const PlatformCapabilities._();
|
||||
|
||||
/// 当前平台是否具备移动端原生插件能力。
|
||||
static bool get isMobile =>
|
||||
defaultTargetPlatform == TargetPlatform.android ||
|
||||
defaultTargetPlatform == TargetPlatform.iOS;
|
||||
|
||||
/// 百度地图渲染(flutter_baidu_mapapi_map 仅支持 Android / iOS)。
|
||||
static bool get baiduMap => isMobile;
|
||||
|
||||
/// 百度定位(flutter_bmflocation 仅支持 Android / iOS)。
|
||||
static bool get baiduLocation => isMobile;
|
||||
|
||||
/// 相机 / 相册扫码(mobile_scanner 未提供桌面端实现)。
|
||||
static bool get scanner => isMobile;
|
||||
|
||||
/// 本机相册浏览(photo_manager 未提供桌面端实现)。
|
||||
static bool get photoLibrary => isMobile;
|
||||
|
||||
/// 系统拨号盘(native `dialPhone` 通道仅 Android / iOS 有实现)。
|
||||
static bool get dialer => isMobile;
|
||||
|
||||
/// 通话本地录制(flutter_webrtc 桌面端未实现 startRecordToFile)。
|
||||
static bool get callRecording => isMobile;
|
||||
|
||||
/// 提示当前平台暂不支持该功能。
|
||||
static Future<void> showUnsupported(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return AppDialogs.alert(
|
||||
context,
|
||||
message: l10n.featureUnsupported,
|
||||
confirmText: l10n.commonConfirm,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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');
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
import 'package:ttstd_family_care/core/widgets/app_page_scaffold.dart';
|
||||
|
||||
import '../../../core/platform/platform_capabilities.dart';
|
||||
import '../../device/presentation/device_switcher.dart';
|
||||
import '../data/connection_providers.dart';
|
||||
import '../domain/connection_models.dart' as connection;
|
||||
@@ -371,6 +372,11 @@ class _RemoteControlPageState extends ConsumerState<RemoteControlPage> {
|
||||
isDestructiveAction: recording,
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
// 桌面端 WebRTC 未实现本地录制,入口降级为提示。
|
||||
if (!PlatformCapabilities.callRecording) {
|
||||
PlatformCapabilities.showUnsupported(context);
|
||||
return;
|
||||
}
|
||||
controller.toggleRecord();
|
||||
},
|
||||
child: Row(
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:ttstd_family_care/features/contacts/data/contact_providers.dart'
|
||||
import 'package:ttstd_family_care/l10n/app_localizations.dart';
|
||||
import 'package:ttstd_family_care/app/theme/dark_mode.dart';
|
||||
|
||||
import '../../../core/platform/platform_capabilities.dart';
|
||||
import '../../../core/utils/phone_call_util.dart';
|
||||
import '../../../core/widgets/feature_ui.dart';
|
||||
import '../../device/data/device_providers.dart';
|
||||
@@ -85,6 +86,11 @@ class _ContactDetailDialogState extends ConsumerState<_ContactDetailDialog> {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
final phone = _contact.phoneNumber;
|
||||
if (phone.isEmpty) return;
|
||||
// 系统拨号盘仅移动端有原生实现,桌面端降级为提示。
|
||||
if (!PlatformCapabilities.dialer) {
|
||||
await PlatformCapabilities.showUnsupported(context);
|
||||
return;
|
||||
}
|
||||
final err = await PhoneCallUtil.dial(phone);
|
||||
if (!mounted || err == null) return;
|
||||
AppDialogs.alert(
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart';
|
||||
import 'package:ttstd_family_care/app/theme/dark_mode.dart';
|
||||
import 'package:ttstd_family_care/core/widgets/app_page_scaffold.dart';
|
||||
|
||||
import '../../../core/platform/platform_capabilities.dart';
|
||||
import '../../../core/widgets/feature_ui.dart';
|
||||
import '../../../core/widgets/settings_ui.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
@@ -137,6 +138,11 @@ class _DeviceBindPageState extends ConsumerState<DeviceBindPage> {
|
||||
|
||||
/// 打开扫码页;扫描成功后把 SN 回填输入框。
|
||||
Future<void> _openScanner(AppLocalizations l10n) async {
|
||||
// 相机扫码插件无桌面端实现,入口降级为提示。
|
||||
if (!PlatformCapabilities.scanner) {
|
||||
await PlatformCapabilities.showUnsupported(context);
|
||||
return;
|
||||
}
|
||||
final code = await context.push<String>('/device/scan');
|
||||
if (code == null || code.isEmpty || !mounted) return;
|
||||
setState(() => _snController.text = code);
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import '../../../app/constants/app_constants.dart';
|
||||
import '../../../core/platform/platform_capabilities.dart';
|
||||
|
||||
/// 家属端手机本机定位结果。
|
||||
///
|
||||
@@ -100,6 +101,9 @@ class LocationController extends Notifier<LocationState> {
|
||||
if (_started) return;
|
||||
_started = true;
|
||||
|
||||
// 百度定位插件仅支持 Android / iOS,桌面端不初始化(地图入口已降级为提示)。
|
||||
if (!PlatformCapabilities.baiduLocation) return;
|
||||
|
||||
// 1. 请求运行时定位权限。
|
||||
final granted = await _ensureLocationPermission();
|
||||
if (!granted) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:material_ui/material_ui.dart';
|
||||
import 'package:ttstd_family_care/app/theme/dark_mode.dart';
|
||||
import 'package:ttstd_family_care/core/widgets/app_page_scaffold.dart';
|
||||
|
||||
import '../../../core/platform/platform_capabilities.dart';
|
||||
import '../../../core/utils/time_format.dart';
|
||||
import '../../../core/widgets/feature_ui.dart';
|
||||
import '../../../features/device/data/device_providers.dart';
|
||||
@@ -780,6 +781,14 @@ class _MoreOpItem {
|
||||
class _LocationCard extends ConsumerWidget {
|
||||
const _LocationCard();
|
||||
|
||||
void _openMap(BuildContext context) {
|
||||
if (!PlatformCapabilities.baiduMap) {
|
||||
PlatformCapabilities.showUnsupported(context);
|
||||
return;
|
||||
}
|
||||
context.push('/map');
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
@@ -792,7 +801,7 @@ class _LocationCard extends ConsumerWidget {
|
||||
final hasAddress = location?.displayAddress.isNotEmpty == true;
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => context.push('/map'),
|
||||
onTap: () => _openMap(context),
|
||||
child: CardBox(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -845,7 +854,7 @@ class _LocationCard extends ConsumerWidget {
|
||||
const Spacer(),
|
||||
// 右上角查看详情
|
||||
GestureDetector(
|
||||
onTap: () => context.push('/map'),
|
||||
onTap: () => _openMap(context),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -873,7 +882,9 @@ class _LocationCard extends ConsumerWidget {
|
||||
width: double.infinity,
|
||||
height: 150,
|
||||
child: IgnorePointer(
|
||||
child: LocationMapView(location: location),
|
||||
child: PlatformCapabilities.baiduMap
|
||||
? LocationMapView(location: location)
|
||||
: const _MapUnavailablePlaceholder(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -914,6 +925,32 @@ class _LocationCard extends ConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// 地图不可用时的占位内容(桌面端百度地图插件无实现)。
|
||||
class _MapUnavailablePlaceholder extends StatelessWidget {
|
||||
const _MapUnavailablePlaceholder();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return ColoredBox(
|
||||
color: DarkMode.color(context, AppColors.surface),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(
|
||||
l10n.featureUnsupported,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: DarkMode.color(context, AppColors.sub),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 最近截图卡片(独立 ConsumerWidget)。
|
||||
///
|
||||
/// 自己 `watch` 截图 Provider,截图数据变化时仅重建本卡片,避免连带重建
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart';
|
||||
import 'package:ttstd_family_care/app/theme/dark_mode.dart';
|
||||
import 'package:ttstd_family_care/core/widgets/app_page_scaffold.dart';
|
||||
|
||||
import '../../../core/platform/platform_capabilities.dart';
|
||||
import '../../../core/widgets/feature_ui.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
|
||||
@@ -24,6 +25,7 @@ class MessagesTab extends ConsumerWidget {
|
||||
color: AppColors.blue,
|
||||
label: l10n.menuAlbum,
|
||||
route: '/album',
|
||||
supported: PlatformCapabilities.photoLibrary,
|
||||
),
|
||||
_Menu(
|
||||
emoji: '⏰',
|
||||
@@ -171,7 +173,13 @@ class MessagesTab extends ConsumerWidget {
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: m.route == null
|
||||
? null
|
||||
: () => context.push(m.route!),
|
||||
: () {
|
||||
if (!m.supported) {
|
||||
PlatformCapabilities.showUnsupported(context);
|
||||
return;
|
||||
}
|
||||
context.push(m.route!);
|
||||
},
|
||||
child: Container(
|
||||
width: 80,
|
||||
margin: const EdgeInsets.symmetric(vertical: 8),
|
||||
@@ -320,11 +328,15 @@ class _Menu {
|
||||
required this.color,
|
||||
required this.label,
|
||||
this.route,
|
||||
this.supported = true,
|
||||
});
|
||||
final String emoji;
|
||||
final Color color;
|
||||
final String label;
|
||||
final String? route;
|
||||
|
||||
/// 当前平台是否具备该入口依赖的原生能力。
|
||||
final bool supported;
|
||||
}
|
||||
|
||||
class _Message {
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
import 'package:cupertino_ui/cupertino_ui.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:ttstd_family_care/app/theme/dark_mode.dart';
|
||||
import 'package:ttstd_family_care/core/widgets/app_page_scaffold.dart';
|
||||
|
||||
import '../../../core/widgets/feature_ui.dart';
|
||||
import '../../../l10n/app_localizations.dart';
|
||||
|
||||
/// 个人资料页(我的 → 编辑资料)。
|
||||
///
|
||||
/// 头像、昵称、个性签名的独立展示页面;从「我的」页头部的编辑资料入口进入。
|
||||
class ProfileEditPage extends StatelessWidget {
|
||||
const ProfileEditPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (didPop, _) {
|
||||
if (didPop) return;
|
||||
if (context.canPop()) {
|
||||
context.pop();
|
||||
} else {
|
||||
context.go('/profile');
|
||||
}
|
||||
},
|
||||
child: AppPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text(l10n.profileInfo),
|
||||
leading: CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
child: const Icon(CupertinoIcons.back),
|
||||
onPressed: () => context.pop(),
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.only(bottom: 24),
|
||||
children: [
|
||||
SectionTitle(l10n.profileInfo),
|
||||
CardBox(
|
||||
padding: EdgeInsets.zero,
|
||||
child: Column(
|
||||
children: [
|
||||
_infoRow(
|
||||
context,
|
||||
'🖼️',
|
||||
AppColors.purple,
|
||||
l10n.piAvatar,
|
||||
const _AvatarPreview(),
|
||||
),
|
||||
const AppDivider(),
|
||||
_infoRow(
|
||||
context,
|
||||
'📛',
|
||||
AppColors.blue,
|
||||
l10n.piName,
|
||||
const Text('用户名'),
|
||||
),
|
||||
const AppDivider(),
|
||||
_infoRow(
|
||||
context,
|
||||
'✍️',
|
||||
AppColors.orange,
|
||||
l10n.piSign,
|
||||
const Text('热爱生活'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _infoRow(
|
||||
BuildContext context,
|
||||
String emoji,
|
||||
Color color,
|
||||
String label,
|
||||
Widget trailing,
|
||||
) =>
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration:
|
||||
BoxDecoration(color: color, borderRadius: BorderRadius.circular(11)),
|
||||
child: Center(child: Text(emoji, style: const TextStyle(fontSize: 17))),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 14.5,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: DarkMode.color(context, AppColors.ink),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
DefaultTextStyle.merge(
|
||||
style: TextStyle(fontSize: 13, color: DarkMode.color(context, AppColors.sub)),
|
||||
child: trailing,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 资料页头像预览(与「我的」页头部样式一致)。
|
||||
class _AvatarPreview extends StatelessWidget {
|
||||
const _AvatarPreview();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Container(
|
||||
width: 34,
|
||||
height: 34,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: LinearGradient(
|
||||
colors: [AppColors.green, AppColors.blue],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'U',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: CupertinoColors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -26,28 +26,28 @@ class ProfileTab extends ConsumerWidget {
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.only(bottom: 96),
|
||||
children: [
|
||||
// 个人资料头部
|
||||
Container(
|
||||
padding: const EdgeInsets.fromLTRB(18, 18, 18, 26),
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [AppColors.green, AppColors.blue],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
// 个人资料头部卡片
|
||||
CardBox(
|
||||
padding: const EdgeInsets.all(18),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 62,
|
||||
height: 62,
|
||||
decoration: BoxDecoration(
|
||||
color: CupertinoColors.white.withValues(alpha: 0.25),
|
||||
width: 58,
|
||||
height: 58,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: CupertinoColors.white.withValues(alpha: 0.6), width: 2),
|
||||
gradient: LinearGradient(
|
||||
colors: [AppColors.green, AppColors.blue],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
child: const Center(
|
||||
child: Text('U', style: TextStyle(fontSize: 26, fontWeight: FontWeight.w700, color: CupertinoColors.white)),
|
||||
child: Text('U',
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: CupertinoColors.white)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
@@ -55,24 +55,33 @@ class ProfileTab extends ConsumerWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text('用户名',
|
||||
style: TextStyle(fontSize: 19, fontWeight: FontWeight.w700, color: CupertinoColors.white)),
|
||||
Text('用户名',
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: DarkMode.color(context, AppColors.ink))),
|
||||
const SizedBox(height: 4),
|
||||
Text('ID: u_8821 · 平板管家 Pro',
|
||||
style: TextStyle(fontSize: 12.5, color: CupertinoColors.white.withValues(alpha: 0.92))),
|
||||
style: TextStyle(
|
||||
fontSize: 12.5,
|
||||
color: DarkMode.color(context, AppColors.sub))),
|
||||
],
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {},
|
||||
onTap: () => context.push('/profile/edit'),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 7),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 14, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: CupertinoColors.white.withValues(alpha: 0.2),
|
||||
color: AppColors.green.withValues(alpha: 0.12),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Text(l10n.profileEdit,
|
||||
style: const TextStyle(fontSize: 12.5, fontWeight: FontWeight.w600, color: CupertinoColors.white)),
|
||||
style: const TextStyle(
|
||||
fontSize: 12.5,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.green)),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -86,20 +95,6 @@ class ProfileTab extends ConsumerWidget {
|
||||
),
|
||||
_boundDeviceCard(context, ref, l10n),
|
||||
|
||||
SectionTitle(l10n.profileInfo),
|
||||
CardBox(
|
||||
padding: EdgeInsets.zero,
|
||||
child: Column(
|
||||
children: [
|
||||
_infoRow(context, '🖼️', AppColors.purple, l10n.piAvatar, null),
|
||||
const AppDivider(),
|
||||
_infoRow(context, '📛', AppColors.blue, l10n.piName, '用户名'),
|
||||
const AppDivider(),
|
||||
_infoRow(context, '✍️', AppColors.orange, l10n.piSign, '热爱生活'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SectionTitle(l10n.settingsTitle),
|
||||
CardBox(
|
||||
padding: EdgeInsets.zero,
|
||||
@@ -248,27 +243,6 @@ class ProfileTab extends ConsumerWidget {
|
||||
),
|
||||
);
|
||||
|
||||
Widget _infoRow(BuildContext context, String emoji, Color color, String label, String? value) => Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(color: color, borderRadius: BorderRadius.circular(11)),
|
||||
child: Center(child: Text(emoji, style: const TextStyle(fontSize: 17))),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(label, style: TextStyle(fontSize: 14.5, fontWeight: FontWeight.w600, color: DarkMode.color(context, AppColors.ink))),
|
||||
const Spacer(),
|
||||
if (value != null)
|
||||
Text(value, style: TextStyle(fontSize: 13, color: DarkMode.color(context, AppColors.sub))),
|
||||
const SizedBox(width: 6),
|
||||
const Text('›', style: TextStyle(fontSize: 16, color: Color(0xFFCBD2DC))),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Widget _settingRow(BuildContext context, String emoji, Color color, String label, String? sub,
|
||||
{VoidCallback? onTap}) {
|
||||
final row = Padding(
|
||||
|
||||
@@ -2281,6 +2281,12 @@ abstract class AppLocalizations {
|
||||
/// In zh, this message translates to:
|
||||
/// **'加载更多'**
|
||||
String get albumLoadMore;
|
||||
|
||||
/// 通用:当前平台不支持该功能
|
||||
///
|
||||
/// In zh, this message translates to:
|
||||
/// **'当前平台暂不支持该功能'**
|
||||
String get featureUnsupported;
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
|
||||
@@ -1140,4 +1140,8 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get albumLoadMore => 'Load more';
|
||||
|
||||
@override
|
||||
String get featureUnsupported =>
|
||||
'This feature is not supported on this platform yet';
|
||||
}
|
||||
@@ -1115,4 +1115,7 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
|
||||
@override
|
||||
String get albumLoadMore => '加载更多';
|
||||
|
||||
@override
|
||||
String get featureUnsupported => '当前平台暂不支持该功能';
|
||||
}
|
||||
@@ -375,5 +375,6 @@
|
||||
"commonSave": "Save",
|
||||
"commonRetry": "Retry",
|
||||
"commonLoadFailed": "Failed to load",
|
||||
"albumLoadMore": "Load more"
|
||||
"albumLoadMore": "Load more",
|
||||
"featureUnsupported": "This feature is not supported on this platform yet"
|
||||
}
|
||||
@@ -1485,5 +1485,9 @@
|
||||
"@commonLoadFailed": {
|
||||
"description": "通用:加载失败"
|
||||
},
|
||||
"albumLoadMore": "加载更多"
|
||||
"albumLoadMore": "加载更多",
|
||||
"featureUnsupported": "当前平台暂不支持该功能",
|
||||
"@featureUnsupported": {
|
||||
"description": "通用:当前平台不支持该功能"
|
||||
}
|
||||
}
|
||||
+13
-9
@@ -11,6 +11,7 @@ import 'package:liquid_glass_widgets/liquid_glass_widgets.dart'
|
||||
import 'app/app.dart';
|
||||
import 'app/constants/app_constants.dart';
|
||||
import 'app/router/app_router.dart';
|
||||
import 'core/platform/platform_capabilities.dart';
|
||||
import 'core/storage/token_storage.dart';
|
||||
import 'core/utils/device_info_util.dart';
|
||||
import 'core/utils/display_mode_util.dart';
|
||||
@@ -26,15 +27,18 @@ void main() async {
|
||||
// 提升动画与滚动流畅度。iOS ProMotion 由系统自动匹配,无需处理。
|
||||
await DisplayModeUtil.enableBestDisplayMode();
|
||||
|
||||
// 初始化百度地图 SDK(需申请 AK;坐标类型使用 BD09LL,设备 GPS 坐标在展示前转换)。
|
||||
BMFMapSDK.setAgreePrivacy(true);
|
||||
BMFMapSDK.setApiKeyAndCoordType(
|
||||
AppConstants.kBaiduMapAk,
|
||||
BMF_COORD_TYPE.BD09LL,
|
||||
);
|
||||
// 初始化 Android 版本适配:Android 10+ 使用 surfaceMapView(比默认 textureMapView 更稳定),
|
||||
// 避免百度 SDK 在模拟器 / 部分机型上因 textureView + EGL 渲染冲突触发原生崩溃(SIGSEGV / EGL_BAD_MATCH)。
|
||||
await BMFAndroidVersion.initAndroidVersion();
|
||||
// 百度地图插件仅支持 Android / iOS,桌面端跳过初始化(地图入口已降级为提示)。
|
||||
if (PlatformCapabilities.baiduMap) {
|
||||
// 初始化百度地图 SDK(需申请 AK;坐标类型使用 BD09LL,设备 GPS 坐标在展示前转换)。
|
||||
BMFMapSDK.setAgreePrivacy(true);
|
||||
BMFMapSDK.setApiKeyAndCoordType(
|
||||
AppConstants.kBaiduMapAk,
|
||||
BMF_COORD_TYPE.BD09LL,
|
||||
);
|
||||
// 初始化 Android 版本适配:Android 10+ 使用 surfaceMapView(比默认 textureMapView 更稳定),
|
||||
// 避免百度 SDK 在模拟器 / 部分机型上因 textureView + EGL 渲染冲突触发原生崩溃(SIGSEGV / EGL_BAD_MATCH)。
|
||||
await BMFAndroidVersion.initAndroidVersion();
|
||||
}
|
||||
|
||||
// 沉浸式状态栏 / edge-to-edge / 刘海屏适配(不影响启动主流程)。
|
||||
await SystemUiUtil.configure();
|
||||
|
||||
Reference in new issue
Block a user