diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 005abcd..836c4a3 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -26,6 +26,10 @@
+
+
+
+
diff --git a/android/app/src/main/java/com/ttstd/familycare/MainActivity.java b/android/app/src/main/java/com/ttstd/familycare/MainActivity.java
index 80c18ed..89e5b6c 100644
--- a/android/app/src/main/java/com/ttstd/familycare/MainActivity.java
+++ b/android/app/src/main/java/com/ttstd/familycare/MainActivity.java
@@ -1,5 +1,8 @@
package com.ttstd.familycare;
+import android.content.Intent;
+import android.net.Uri;
+
import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.FlutterEngine;
@@ -18,6 +21,23 @@ public class MainActivity extends FlutterActivity {
// 将应用退到后台而不销毁 Engine,实现热启动优化
moveTaskToBack(false);
result.success(true);
+ } else if (call.method.equals("dialPhone")) {
+ // 打开系统拨号盘拨打指定号码(ACTION_DIAL 无需拨号权限)
+ String phone = call.argument("phone");
+ if (phone == null || phone.isEmpty()) {
+ result.error("INVALID_PHONE", "电话号码为空", null);
+ return;
+ }
+ try {
+ Intent intent = new Intent(
+ Intent.ACTION_DIAL,
+ Uri.parse("tel:" + Uri.encode(phone)));
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(intent);
+ result.success(true);
+ } catch (Exception e) {
+ result.error("DIAL_FAILED", e.getMessage(), null);
+ }
} else {
result.notImplemented();
}
diff --git a/android/build/reports/problems/problems-report.html b/android/build/reports/problems/problems-report.html
new file mode 100644
index 0000000..1c1eecb
--- /dev/null
+++ b/android/build/reports/problems/problems-report.html
@@ -0,0 +1,663 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Gradle Configuration Cache
+
+
+
+
+
+
+ Loading...
+
+
+
+
+
+
+
diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts
index 774b49e..bead1a0 100644
--- a/android/settings.gradle.kts
+++ b/android/settings.gradle.kts
@@ -27,7 +27,7 @@ pluginManagement {
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.11.1" apply false
- id("org.jetbrains.kotlin.android") version "2.2.20" apply false
+ id("org.jetbrains.kotlin.android") version "2.3.20" apply false
}
include(":app")
diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift
index c30b367..07abfef 100644
--- a/ios/Runner/AppDelegate.swift
+++ b/ios/Runner/AppDelegate.swift
@@ -12,5 +12,33 @@ import UIKit
func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) {
GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry)
+ // 拨号 MethodChannel:与 Android 侧保持一致(com.ttstd.familycare/app)
+ guard let registrar = engineBridge.pluginRegistry.registrar(forPlugin: "PhoneDialer") else {
+ return
+ }
+ let channel = FlutterMethodChannel(
+ name: "com.ttstd.familycare/app",
+ binaryMessenger: registrar.messenger()
+ )
+ channel.setMethodCallHandler { call, result in
+ if call.method == "dialPhone" {
+ guard let args = call.arguments as? [String: Any],
+ let phone = args["phone"] as? String else {
+ result(FlutterError(code: "INVALID_PHONE", message: "电话号码为空", details: nil))
+ return
+ }
+ // 仅保留数字与 +,避免空格/括号等字符导致 URL 解析失败
+ let cleaned = phone.filter { $0.isNumber || $0 == "+" }
+ guard !cleaned.isEmpty, let url = URL(string: "tel:\(cleaned)") else {
+ result(FlutterError(code: "INVALID_PHONE", message: "电话号码为空", details: nil))
+ return
+ }
+ UIApplication.shared.open(url) { success in
+ result(success)
+ }
+ } else {
+ result(FlutterMethodNotImplemented)
+ }
+ }
}
}
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 9cdc51a..e7ccb67 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -80,7 +80,7 @@
NSCameraUsageDescription
用于扫描设备二维码完成绑定
NSPhotoLibraryUsageDescription
- 用于从相册选取二维码图片完成设备绑定
+ 用于查看本机相册照片并按文件夹浏览,以及从相册选取二维码图片完成设备绑定
io.flutter.embedded_views_preview
diff --git a/lib/app/app.dart b/lib/app/app.dart
index 445d64d..07cbaba 100644
--- a/lib/app/app.dart
+++ b/lib/app/app.dart
@@ -2,6 +2,9 @@ import 'package:cupertino_ui/cupertino_ui.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
+// GlobalMaterialLocalizations 须用 material_ui 自带的(vendored 框架副本),
+// 若整体导入 flutter_localizations 会与 material_ui 导出的同名类冲突。
+import 'package:material_ui/material_ui.dart' show GlobalMaterialLocalizations;
import '../l10n/app_localizations.dart';
import 'theme/app_theme.dart';
@@ -28,6 +31,9 @@ class App extends StatelessWidget {
// cupertino_ui 的 delegate,否则 CupertinoTabBar 等组件会在运行时
// 抛 "could not find a CupertinoLocalizations ancestor" 异常。
...GlobalCupertinoLocalizations.delegates,
+ // easy_image_viewer 的关闭按钮使用 Material Tooltip,需要
+ // MaterialLocalizations 兜底(用 material_ui 自带的多语言副本)。
+ GlobalMaterialLocalizations.delegate,
],
supportedLocales: AppLocalizations.supportedLocales,
debugShowCheckedModeBanner: false,
diff --git a/lib/app/router/app_router.dart b/lib/app/router/app_router.dart
index 51a1ab0..6e08d23 100644
--- a/lib/app/router/app_router.dart
+++ b/lib/app/router/app_router.dart
@@ -11,12 +11,15 @@ import '../../features/home/presentation/home_page.dart';
import '../../features/home/presentation/home_tab.dart';
import '../../features/home/presentation/map_page.dart';
import '../../features/home/presentation/screenshot_page.dart';
+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/album/presentation/album_page.dart';
import '../../features/alarm/presentation/alarm_page.dart';
+import '../../features/alarm/presentation/alarm_edit_page.dart';
+import '../../features/alarm/domain/alarm_models.dart';
import '../../features/contacts/presentation/contacts_page.dart';
-import '../../features/contacts/presentation/contact_detail_page.dart';
import '../../features/contacts/presentation/contact_edit_page.dart';
import '../../features/contacts/domain/contact_models.dart';
import '../../features/apps/presentation/apps_page.dart';
@@ -74,16 +77,14 @@ GoRouter buildAppRouter() {
builder: (context, state) => const AlarmPage(),
),
GoRoute(
- path: '/contacts',
- builder: (context, state) => const ContactsPage(),
+ path: '/alarm/edit',
+ builder: (context, state) => AlarmEditPage(
+ alarm: state.extra is AlarmModel ? state.extra as AlarmModel : null,
+ ),
),
GoRoute(
- path: '/contacts/detail',
- builder: (context, state) => ContactDetailPage(
- contact: state.extra is Contact
- ? state.extra as Contact
- : const Contact(id: 0, name: '', phoneNumber: ''),
- ),
+ path: '/contacts',
+ builder: (context, state) => const ContactsPage(),
),
GoRoute(
path: '/contacts/edit',
@@ -145,6 +146,14 @@ GoRouter buildAppRouter() {
path: '/connection',
builder: (context, state) => _RemoteControlRoute(),
),
+ GoRoute(
+ path: '/settings',
+ builder: (context, state) => const SystemSettingsPage(),
+ ),
+ GoRoute(
+ path: '/wallpaper',
+ builder: (context, state) => const WallpaperPage(),
+ ),
StatefulShellRoute.indexedStack(
builder: (context, state, shell) => HomePage(child: shell),
branches: [
diff --git a/lib/core/network/dio_client.dart b/lib/core/network/dio_client.dart
index d84343d..54b6210 100644
--- a/lib/core/network/dio_client.dart
+++ b/lib/core/network/dio_client.dart
@@ -107,7 +107,7 @@ class DioClient {
try {
// 对接 open 模块刷新接口,路径需带 v1/open/ 前缀。
final response = await _refreshDio.post(
- 'v1/open/refresh-token',
+ 'v1/open/auth/refresh-token',
queryParameters: {'refreshToken': refreshToken},
);
debugPrint('[DioClient] _refreshToken: response status=${response.statusCode} body=${response.data}');
@@ -155,6 +155,25 @@ class DioClient {
}) =>
_request(() => instance.put(path, data: data));
+ /// 统一 POST 请求(multipart 文件上传),返回解析后的 data。
+ static Future postMultipart(
+ String path, {
+ required FormData formData,
+ Map? queryParameters,
+ }) =>
+ _request(() => instance.post(
+ path,
+ data: formData,
+ queryParameters: queryParameters,
+ ));
+
+ /// 下载静态资源文件到本地路径(图片等二进制内容,不走 JSON 业务解析)。
+ ///
+ /// [url] 支持相对路径(如 `/static/wallpaper/xxx.jpg`),会基于 baseUrl 拼接。
+ static Future downloadToFile(String url, String savePath) async {
+ await instance.download(url, savePath);
+ }
+
/// 统一 DELETE 请求,返回解析后的 data。
static Future delete(String path) =>
_request(() => instance.delete(path));
@@ -252,7 +271,11 @@ class _AuthInterceptor extends Interceptor {
class _ResponseInterceptor extends Interceptor {
/// 解析响应体,提取 data 字段;code != "00000" 时抛出业务错误。
static dynamic parse(Response response) {
- final body = response.data as Map?;
+ // 下载等场景响应体可能是二进制(ResponseBody 等),先做类型判定再强转,
+ // 避免对非 JSON 数据直接 `as Map` 抛 TypeError。
+ final body = response.data is Map
+ ? response.data as Map
+ : null;
if (body == null) {
throw const ApiException(code: '-1', message: '响应为空');
}
@@ -283,7 +306,9 @@ class _ErrorInterceptor extends Interceptor {
void onError(DioException err, ErrorInterceptorHandler handler) {
final response = err.response;
final statusCode = response?.statusCode;
- final body = response?.data as Map?;
+ // 响应体可能是二进制(ResponseBody 等),先类型判定再取业务码,避免强转抛错。
+ final data = response?.data;
+ final body = data is Map ? data : null;
final code = body?['code']?.toString();
// 访问权限异常(A0300):通常意味着当前令牌的端标识不符(如旧令牌未携带
diff --git a/lib/core/utils/phone_call_util.dart b/lib/core/utils/phone_call_util.dart
new file mode 100644
index 0000000..399f2ed
--- /dev/null
+++ b/lib/core/utils/phone_call_util.dart
@@ -0,0 +1,27 @@
+import 'package:flutter/services.dart';
+
+/// 拨打电话工具。
+///
+/// 通过原生 MethodChannel(channel 名与系统 UI 工具共用 `com.ttstd.familycare/app`)
+/// 调起系统拨号盘:
+/// - Android:`Intent.ACTION_DIAL`(`tel:` 号码),无需拨号权限;
+/// - iOS:`UIApplication.open` 打开 `tel:` URL,系统弹确认后拨号。
+class PhoneCallUtil {
+ const PhoneCallUtil._();
+
+ static const MethodChannel _channel = MethodChannel('com.ttstd.familycare/app');
+
+ /// 打开系统拨号盘拨打 [phone]。
+ ///
+ /// 成功返回 null;失败返回错误信息(如号码为空、设备无拨号能力)。
+ static Future dial(String phone) async {
+ if (phone.isEmpty) return '电话号码为空';
+ try {
+ final ok = await _channel
+ .invokeMethod('dialPhone', {'phone': phone});
+ return ok == true ? null : '无法打开拨号盘';
+ } on PlatformException catch (e) {
+ return e.message ?? '拨号失败';
+ }
+ }
+}
diff --git a/lib/core/widgets/settings_ui.dart b/lib/core/widgets/settings_ui.dart
index 059ee85..624bc0a 100644
--- a/lib/core/widgets/settings_ui.dart
+++ b/lib/core/widgets/settings_ui.dart
@@ -107,6 +107,7 @@ class LabeledField extends StatelessWidget {
this.maxLength,
this.enabled = true,
this.suffix,
+ this.labelTrailing,
super.key,
});
@@ -121,19 +122,36 @@ class LabeledField extends StatelessWidget {
/// 输入框右侧控件(如「获取验证码」按钮)。
final Widget? suffix;
+ /// 标签右侧的小字提示(如「区分大小写」),可为空。
+ final String? labelTrailing;
+
@override
Widget build(BuildContext context) => Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
- label,
- style: const TextStyle(
- fontSize: 12.5,
- fontWeight: FontWeight.w600,
- color: AppColors.sub,
- ),
+ Row(
+ children: [
+ Text(
+ label,
+ style: const TextStyle(
+ fontSize: 12.5,
+ fontWeight: FontWeight.w600,
+ color: AppColors.sub,
+ ),
+ ),
+ if (labelTrailing != null) ...[
+ const SizedBox(width: 6),
+ Text(
+ labelTrailing!,
+ style: const TextStyle(
+ fontSize: 11,
+ color: AppColors.orange,
+ ),
+ ),
+ ],
+ ],
),
const SizedBox(height: 6),
Row(
diff --git a/lib/features/alarm/data/alarm_api.dart b/lib/features/alarm/data/alarm_api.dart
new file mode 100644
index 0000000..35dbef9
--- /dev/null
+++ b/lib/features/alarm/data/alarm_api.dart
@@ -0,0 +1,74 @@
+import 'package:cupertino_ui/cupertino_ui.dart';
+import 'package:ttstd_family_care/core/network/api_exception.dart';
+import 'package:ttstd_family_care/core/network/dio_client.dart';
+import 'package:ttstd_family_care/features/alarm/domain/alarm_models.dart';
+
+/// 家属端闹钟接口访问层。
+///
+/// 对应后台 `/api/v1/client/sn/alarm`(GET 列表 / POST 新增 / PUT 修改 / DELETE 删除)。
+class AlarmApi {
+ const AlarmApi();
+
+ /// 查询设备闹钟列表(按时间升序)。
+ Future> getAlarms(String sn) async {
+ try {
+ final data = await DioClient.get(
+ 'v1/client/sn/alarm',
+ queryParameters: {'sn': sn},
+ );
+ final list = data is List ? data : const [];
+ return list
+ .whereType