|
|
|
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) {
|
...
|
...
|
|