Commit bd8250af36aa14221830cf0256173fb65c887a2b

Authored by 刘宏哲
1 parent 81b89067

feat(app): update ui

... ... @@ -3,6 +3,7 @@ import 'dart:math' as math;
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:doublefeel_flutter/app/utils/platform_compact.dart';
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import '../../../../r.dart';
... ... @@ -42,6 +43,7 @@ class ActivityBurnMonthReportView extends StatelessWidget {
static const _h3 = Color(0xFFB0B0B6);
static const _active = Color(0xFFFF5279);
static const _exercise = Color(0xFF3BD49D);
static const _ohosExercise = Color(0xFFFF9A6E);
static const _stand = Color(0xFF7B9BFB);
@override
... ... @@ -135,7 +137,9 @@ class _MonthlySummary extends StatelessWidget {
context, context.l10n.activityWeeklyExerciseTitle),
value: exercise.value,
unit: exercise.unit,
color: ActivityBurnMonthReportView._exercise,
color: isOhos()
? ActivityBurnMonthReportView._ohosExercise
: ActivityBurnMonthReportView._exercise,
),
const SizedBox(width: 34),
_SummaryMetric(
... ...
... ... @@ -66,18 +66,18 @@ class _OhosActivityBurnRing extends StatelessWidget {
items: [
ArcProgressItem(
ratio: hasData ? report?.activeEnergy?.rawProgress : null,
color: const Color(0xFFF84C38),
backgroundColor: const Color(0xFFFEE6E4),
color: const Color(0xFFF35033),
backgroundColor: const Color(0x33F35033),
),
ArcProgressItem(
ratio: hasData ? report?.exerciseMinutes?.rawProgress : null,
color: const Color(0xFFF6A523),
backgroundColor: const Color(0xFFFDF2E2),
color: const Color(0xFFF9B12B),
backgroundColor: const Color(0x33F9B12B),
),
ArcProgressItem(
ratio: hasData ? report?.standHours?.rawProgress : null,
color: const Color(0xFF3A9BFB),
backgroundColor: const Color(0xFFE3F1FD),
color: const Color(0xFF4B9FF0),
backgroundColor: const Color(0x334B9FF0),
),
],
);
... ...
import 'package:doublefeel_flutter/app/utils/platform_compact.dart';
import 'package:doublefeel_flutter/core/util/size_extensions.dart';
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import 'package:flutter/material.dart';
... ... @@ -15,6 +16,7 @@ class ActivityBurnSummaryCard extends StatelessWidget {
static const _active = Color(0xFFFF5279);
static const _exercise = Color(0xFF3BD49D);
static const _ohosExercise = Color(0xFFFF9A6E);
static const _stand = Color(0xFF7B9BFB);
@override
... ... @@ -50,7 +52,7 @@ class ActivityBurnSummaryCard extends StatelessWidget {
flex: 1,
child: _MetricColumn(
title: context.l10n.activityExercise,
color: _exercise,
color: isOhos() ? _ohosExercise : _exercise,
value: exercise.value,
unit: exercise.unit,
),
... ...
... ... @@ -3,6 +3,7 @@ import 'dart:math' as math;
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:doublefeel_flutter/app/utils/platform_compact.dart';
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import '../../../../r.dart';
... ... @@ -41,6 +42,7 @@ class ActivityBurnWeekReportView extends StatelessWidget {
static const _h3 = Color(0xFFB0B0B6);
static const _active = Color(0xFFFF5279);
static const _exercise = Color(0xFF3BD49D);
static const _ohosExercise = Color(0xFFFF9A6E);
static const _stand = Color(0xFF7B9BFB);
@override
... ... @@ -136,7 +138,9 @@ class _WeeklySummary extends StatelessWidget {
context, context.l10n.activityWeeklyExerciseTitle),
value: exercise.value,
unit: exercise.unit,
color: ActivityBurnWeekReportView._exercise,
color: isOhos()
? ActivityBurnWeekReportView._ohosExercise
: ActivityBurnWeekReportView._exercise,
),
const SizedBox(width: 34),
_SummaryMetric(
... ...
... ... @@ -140,7 +140,10 @@ class FriendHealthCard extends StatelessWidget {
],
),
),
if (isOnWatchFace)
// OHOS does not support showing a friend on the watch face. The
// backend may still return a legacy `isShowInDial` value, so avoid
// exposing the corresponding status badge on that platform.
if (isOnWatchFace && !isOhos())
const Positioned(
right: 0,
top: 0,
... ...
... ... @@ -53,7 +53,7 @@ class _OhosSleepQualityRing extends StatelessWidget {
ratio: durationRatio,
color: const Color(0xFF7B59EE),
backgroundColor: const Color(0xFFECE7FB),
noDataBackgroundColor: const Color(0xFFF0F1F5),
noDataBackgroundColor: Colors.white,
),
ArcProgressItem(
ratio: qualityScore == null
... ... @@ -61,7 +61,7 @@ class _OhosSleepQualityRing extends StatelessWidget {
: (qualityScore.clamp(0, 100) / 100).toDouble(),
color: const Color(0xFF638BFB),
backgroundColor: const Color(0xFFE8EFFD),
noDataBackgroundColor: const Color(0xFFF0F1F5),
noDataBackgroundColor: Colors.white,
),
],
);
... ...
... ... @@ -117,10 +117,7 @@ class AppPlatformHostApi extends _AppPigeonApiFacade {
});
Future<bool> requestAppReview() => dispatch(
ios: () => _api.requestAppReview(),
ohos: () async {
return false;
});
ios: () => _api.requestAppReview(), ohos: () => _api.requestAppReview());
Future<bool> jumpAppSetting() => dispatch(
ios: () => _api.jumpAppSetting(),
... ...
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:doublefeel_flutter/core/config/app_environment_config.dart';
import 'package:doublefeel_flutter/core/services/raw_data_service/health_raw_data_core_service.dart';
import 'package:doublefeel_flutter/core/services/raw_data_service/platform_ohos/huawei_health_data_type.dart';
... ... @@ -52,7 +53,9 @@ class UserStateService {
await initializeSdks();
_trackLogin();
_setUserProfile();
_healthRawDataCoreService.openDatabase();
// The WebSocket handler can immediately start a calculation. Ensure its
// local result store is ready before subscribing and connecting.
await _healthRawDataCoreService.openDatabase();
// Push Kit may wait for its service/network. The token is still reported
// after login, but must not delay the rest of the authenticated session.
unawaited(_pushService.registerPushToken());
... ... @@ -96,11 +99,17 @@ class UserStateService {
return;
}
final processing = _healthRawDataCoreService.onHealthDataUpdated(
dataTypes: <int>[dataType.dataType],
);
final processing = defaultTargetPlatform == TargetPlatform.iOS
? _healthRawDataCoreService.onHealthDataUpdated(
dataTypes: <int>[dataType.dataType],
)
: _healthRawDataCoreService.startCoreCaculate();
unawaited(processing.catchError((Object error, StackTrace stackTrace) {
AppLogger.w('Failed to process health_data_update', error, stackTrace);
AppLogger.w(
'Failed to calculate health data after health_data_update',
error,
stackTrace,
);
}));
}
... ...
... ... @@ -5,12 +5,12 @@
"name": "auto",
"type": "HarmonyOS",
"material": {
"certpath": "/Users/quanhai/Developer/doublefeel_flutter/.ohos/config/debug_ohos_WWjJA4uV69RmLVhj0o_rA0VEMyuWGcKp7RSWudtmCR0=.cer",
"certpath": "/Users/liuhongzhe/.ohos/config/debug_ohos_WWjJA4uV69RmLVhj0o_rA0VEMyuWGcKp7RSWudtmCR0=.cer",
"keyAlias": "debugKey",
"keyPassword": "00000019084446C3F235D890CFE9AC6015D14270D13D370ACF44FEDD89097E1ABBBDE3810C8FEBFFFD",
"profile": "/Users/quanhai/Developer/doublefeel_flutter/.ohos/config/debug_ohos_WWjJA4uV69RmLVhj0o_rA0VEMyuWGcKp7RSWudtmCR0=.p7b",
"profile": "/Users/liuhongzhe/.ohos/config/debug_ohos_WWjJA4uV69RmLVhj0o_rA0VEMyuWGcKp7RSWudtmCR0=.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "/Users/quanhai/Developer/doublefeel_flutter/.ohos/config/debug_ohos_WWjJA4uV69RmLVhj0o_rA0VEMyuWGcKp7RSWudtmCR0=.p12",
"storeFile": "/Users/liuhongzhe/.ohos/config/debug_ohos_WWjJA4uV69RmLVhj0o_rA0VEMyuWGcKp7RSWudtmCR0=.p12",
"storePassword": "00000019D85309732E0C3572D434400BA13D429AE5A182B54C1EA6F2C9D7DB5AE81BD9A64F12ACC681"
}
},
... ... @@ -18,33 +18,33 @@
"name": "release",
"type": "HarmonyOS",
"material": {
"storeFile": "/Users/quanhai/Developer/doublefeel_flutter/ohos/keystore/doublefeel.p12",
"storeFile": "/Users/liuhongzhe/Work/DD/Project/GitLab/doublefeel_flutter/ohos/keystore/doublefeel.p12",
"storePassword": "0000001E8F02C32C2D5431F31FC368F020D891F18E6DC45A5913C60CACC1074B11282B3527F3E7D420F00B21B13A",
"keyAlias": "DoubleFeel",
"keyPassword": "0000001ECC963DD8029FC0957D403D334E6A864BA98BD1ABF0F96E41AEB1002C3CBAFE12680A33902C1D5C61E7C9",
"signAlg": "SHA256withECDSA",
"profile": "/Users/quanhai/Developer/doublefeel_flutter/ohos/keystore/release/DoubleFeel_hm_releaseRelease.p7b",
"certpath": "/Users/quanhai/Developer/doublefeel_flutter/ohos/keystore/release/DoubleFeelWatch_Release.cer"
"profile": "/Users/liuhongzhe/Work/DD/Project/GitLab/doublefeel_flutter/ohos/keystore/release/DoubleFeel_hm_releaseRelease.p7b",
"certpath": "/Users/liuhongzhe/Work/DD/Project/GitLab/doublefeel_flutter/ohos/keystore/release/DoubleFeelWatch_Release.cer"
}
},
{
"name": "debug",
"type": "HarmonyOS",
"material": {
"storeFile": "/Users/quanhai/Developer/doublefeel_flutter/ohos/keystore/doublefeel.p12",
"storeFile": "/Users/liuhongzhe/Work/DD/Project/GitLab/doublefeel_flutter/ohos/keystore/doublefeel.p12",
"storePassword": "0000001E1BE8542E4E9F7969905217A5421D89506648518A33A93BE1045A511094FF10805EC4686172CC000ED9FA",
"keyAlias": "DoubleFeel",
"keyPassword": "0000001EFBAD9B2C408962C5BF2044ED8A57E4E192D171CAC3EBFF8D648684E52A690DFD6B8BDD7DC28AF8D6174C",
"signAlg": "SHA256withECDSA",
"profile": "/Users/quanhai/Developer/doublefeel_flutter/ohos/keystore/debug/DoubleFeel_hm_debugDebug.p7b",
"certpath": "/Users/quanhai/Developer/doublefeel_flutter/ohos/keystore/debug/DoubleFeel_hm_debug.cer"
"profile": "/Users/liuhongzhe/Work/DD/Project/GitLab/doublefeel_flutter/ohos/keystore/debug/DoubleFeel_hm_debugDebug.p7b",
"certpath": "/Users/liuhongzhe/Work/DD/Project/GitLab/doublefeel_flutter/ohos/keystore/debug/DoubleFeel_hm_debug.cer"
}
}
],
"products": [
{
"name": "default",
"signingConfig": "debug",
"signingConfig": "auto",
"targetSdkVersion": "6.0.0(20)",
"compatibleSdkVersion": "6.0.0(20)",
"runtimeOS": "HarmonyOS",
... ...