Commit 3174d80c70d073d0e6c7f9e3202bdb0740aa57fc

Authored by 刘宏哲
1 parent ed605492

feat(app): bug fixed

... ... @@ -12,7 +12,6 @@ import 'package:doublefeel_flutter/core/util/app_toast.dart';
import 'package:doublefeel_flutter/data/models/health/health_v2_models.dart';
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import 'package:doublefeel_flutter/pigeon/platform_api.g.dart';
import 'package:doublefeel_flutter/pigeon/wear_engine_api.g.dart';
import 'package:get/get.dart';
import '../data/friends_repository.dart';
... ... @@ -139,8 +138,7 @@ class FriendsController extends GetxController {
if (userId == null) return;
try {
await _repository.updateRemark(userId, remark);
final index = friends.indexOf(friend);
if (index >= 0) friends[index] = friend.copyWith(remark: remark);
await loadFriends();
} catch (error, stackTrace) {
if (error is AppError) {
AppToast.show(error.displayMessage);
... ... @@ -161,14 +159,7 @@ class FriendsController extends GetxController {
}
try {
await _repository.selectWatchFaceFriend(friendUserId);
final updatedFriends = friends
.map(
(friend) => friend.userId == friendUserId
? friend.copyWith(isOnWatchFace: true)
: friend,
)
.toList(growable: false);
friends.assignAll(updatedFriends);
await loadFriends();
await _updateWatchOtherUserInfo(
WatchAppOtherInfo(
userId: friendUserId,
... ...
import 'package:doublefeel_flutter/app/modules/hrv_report/models/hrv_report_models.dart';
import 'package:doublefeel_flutter/app/modules/home/widgets/df_tab_bar.dart';
import 'package:doublefeel_flutter/app/routes/app_pages.dart';
import 'package:doublefeel_flutter/core/constants/intent_keys.dart';
import 'package:doublefeel_flutter/core/util/size_extensions.dart';
import 'package:doublefeel_flutter/data/local/user_preferences_storage.dart';
import 'package:doublefeel_flutter/l10n/l10n_extensions.dart';
import 'package:doublefeel_flutter/r.dart';
... ... @@ -16,6 +16,8 @@ import '../widgets/friend_health_card.dart';
class FriendsTab extends GetView<FriendsController> {
const FriendsTab({super.key});
static const double _floatingAddButtonGap = 23;
@override
Widget build(BuildContext context) {
final userPreferences = Get.find<UserPreferencesStorage>();
... ... @@ -161,7 +163,12 @@ class FriendsTab extends GetView<FriendsController> {
onRefresh: controller.refreshData,
child: ListView(
physics: const AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.fromLTRB(0, 0, 0, 188.dp),
padding: EdgeInsets.fromLTRB(
0,
0,
0,
_friendsListBottomPadding(context, isFull: isFull),
),
children: [
selfHealthCard,
const SizedBox(height: 12),
... ... @@ -213,23 +220,28 @@ class FriendsTab extends GetView<FriendsController> {
}
double _floatingAddButtonBottom(BuildContext context) {
return _tabBarAvoidanceBottom(context) + 23.dp;
return _tabBarAvoidanceBottom(context) + _floatingAddButtonGap;
}
double _tabBarAvoidanceBottom(BuildContext context) {
const tabBarHeight = 56.0;
const tabBarBottomPadding = 8.0;
return MediaQuery.viewPaddingOf(context).bottom +
tabBarHeight +
tabBarBottomPadding;
DfTabBar.height +
DfTabBar.bottomMargin;
}
double _friendsListBottomPadding(
BuildContext context, {
required bool isFull,
}) {
return _floatingAddButtonBottom(context) + (isFull ? 100 : 72);
}
Future<void> _handleAddFriend() async {
final Type type = FriendsTab;
final String name = type.toString();
final didAddFriend = await Get.toNamed(AppRoutes.bindPartner,
await Get.toNamed(AppRoutes.bindPartner,
arguments: {IntentKeys.keyFrom: name});
if (didAddFriend == true) await controller.loadFriends();
await controller.loadFriends();
}
void _openFriendHome(FriendHealthData friend) {
... ...
... ... @@ -12,6 +12,9 @@ class DfTabBar extends StatelessWidget {
required this.onTap,
});
static const double height = 56;
static const double bottomMargin = 8;
static const _selectedBgColor = Color(0xFFF3F3F3);
static const _tabIcons = [
... ... @@ -41,9 +44,9 @@ class DfTabBar extends StatelessWidget {
return SafeArea(
top: false,
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
padding: const EdgeInsets.fromLTRB(16, 0, 16, bottomMargin),
child: Container(
height: 56,
height: height,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(28),
... ...
... ... @@ -389,9 +389,9 @@
"friendsWaitingForData": "Waiting for data",
"friendsSleepQuality": "Sleep quality",
"friendsTodaySteps": "Steps today",
"friendsSleepQualityExcellent": "Excellent",
"friendsSleepQualityNormal": "Normal",
"friendsSleepQualityAttention": "Needs attention",
"friendsSleepQualityExcellent": "Slept great",
"friendsSleepQualityNormal": "Slept well",
"friendsSleepQualityAttention": "Slept poorly",
"friendsRemove": "Remove",
"friendsEditRemark": "Edit nickname",
"friendsShowOnWatchFace": "Show on watch face",
... ... @@ -495,4 +495,4 @@
"appReviewFeedbackSendAction": "Send Feedback",
"appReviewFeedbackLaterAction": "Maybe Later",
"appReviewIllustrationPlaceholder": "Illustration Placeholder"
}
\ No newline at end of file
}
... ...
... ... @@ -653,9 +653,9 @@
"friendsWaitingForData": "等待数据",
"friendsSleepQuality": "睡眠质量",
"friendsTodaySteps": "今日步数",
"friendsSleepQualityExcellent": "优秀",
"friendsSleepQualityNormal": "正常",
"friendsSleepQualityAttention": "注意",
"friendsSleepQualityExcellent": "睡的很棒",
"friendsSleepQualityNormal": "睡得不错",
"friendsSleepQualityAttention": "睡得差",
"friendsRemove": "删除Ta",
"friendsEditRemark": "修改备注",
"friendsShowOnWatchFace": "在表盘显示",
... ... @@ -780,4 +780,4 @@
"appReviewFeedbackSendAction": "发送反馈",
"appReviewFeedbackLaterAction": "稍后再说",
"appReviewIllustrationPlaceholder": "插图占位"
}
\ No newline at end of file
}
... ...
... ... @@ -2436,19 +2436,19 @@ abstract class AppLocalizations {
/// No description provided for @friendsSleepQualityExcellent.
///
/// In zh, this message translates to:
/// **'优秀'**
/// **'睡的很棒'**
String get friendsSleepQualityExcellent;
/// No description provided for @friendsSleepQualityNormal.
///
/// In zh, this message translates to:
/// **'正常'**
/// **'睡得不错'**
String get friendsSleepQualityNormal;
/// No description provided for @friendsSleepQualityAttention.
///
/// In zh, this message translates to:
/// **'注意'**
/// **'睡得差'**
String get friendsSleepQualityAttention;
/// No description provided for @friendsRemove.
... ...
... ... @@ -1343,13 +1343,13 @@ class AppLocalizationsEn extends AppLocalizations {
String get friendsTodaySteps => 'Steps today';
@override
String get friendsSleepQualityExcellent => 'Excellent';
String get friendsSleepQualityExcellent => 'Slept great';
@override
String get friendsSleepQualityNormal => 'Normal';
String get friendsSleepQualityNormal => 'Slept well';
@override
String get friendsSleepQualityAttention => 'Needs attention';
String get friendsSleepQualityAttention => 'Slept poorly';
@override
String get friendsRemove => 'Remove';
... ...
... ... @@ -1280,13 +1280,13 @@ class AppLocalizationsZh extends AppLocalizations {
String get friendsTodaySteps => '今日步数';
@override
String get friendsSleepQualityExcellent => '优秀';
String get friendsSleepQualityExcellent => '睡的很棒';
@override
String get friendsSleepQualityNormal => '正常';
String get friendsSleepQualityNormal => '睡得不错';
@override
String get friendsSleepQualityAttention => '注意';
String get friendsSleepQualityAttention => '睡得差';
@override
String get friendsRemove => '删除Ta';
... ...