Skip to content

Commit c5986ce

Browse files
committed
fixup! TW-2099: Fix wrong UI in chat profile info view
1 parent bfa3f44 commit c5986ce

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

lib/pages/chat_details/chat_details_view_style.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ class ChatDetailViewStyle {
1515
EdgeInsets.symmetric(horizontal: 4.0, vertical: 8.0);
1616

1717
// Informations Content
18-
static const double minToolbarHeightSliverAppBar = 340.0;
19-
static const double maxToolbarHeightSliverAppBar = 400.0;
18+
static const double minToolbarHeightSliverAppBar = 300.0;
19+
static const double mediumToolbarHeightSliverAppBar = 386.0;
20+
static const double maxToolbarHeightSliverAppBar = 394.0;
2021
static const double avatarSize = 96;
2122
static double chatDetailsPageViewWebBorderRadius = 16.0;
2223
static double chatDetailsPageViewWebWidth = 640.0;

lib/pages/chat_profile_info/chat_profile_info_view.dart

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -70,32 +70,11 @@ class ChatProfileInfoView extends StatelessWidget {
7070
builder: (context, lookupContact, child) {
7171
return SliverAppBar(
7272
backgroundColor: LinagoraSysColors.material().onPrimary,
73-
toolbarHeight: lookupContact.fold(
74-
(failure) =>
75-
ChatDetailViewStyle.minToolbarHeightSliverAppBar,
76-
(success) {
77-
if (success is LookupMatchContactSuccess) {
78-
return ChatDetailViewStyle
79-
.maxToolbarHeightSliverAppBar;
80-
}
81-
return ChatDetailViewStyle.minToolbarHeightSliverAppBar;
82-
},
83-
),
73+
toolbarHeight: getToolbarHeight(lookupContact),
8474
title: ConstrainedBox(
8575
constraints: BoxConstraints(
8676
maxWidth: ChatProfileInfoStyle.maxWidth,
87-
maxHeight: lookupContact.fold(
88-
(failure) =>
89-
ChatDetailViewStyle.minToolbarHeightSliverAppBar,
90-
(success) {
91-
if (success is LookupMatchContactSuccess) {
92-
return ChatDetailViewStyle
93-
.maxToolbarHeightSliverAppBar;
94-
}
95-
return ChatDetailViewStyle
96-
.minToolbarHeightSliverAppBar;
97-
},
98-
),
77+
maxHeight: getToolbarHeight(lookupContact),
9978
),
10079
child: Builder(
10180
builder: (context) {
@@ -195,6 +174,30 @@ class ChatProfileInfoView extends StatelessWidget {
195174
),
196175
);
197176
}
177+
178+
double getToolbarHeight(Either<Failure, Success> lookupContact) =>
179+
lookupContact.fold(
180+
(failure) => ChatDetailViewStyle.minToolbarHeightSliverAppBar,
181+
(success) {
182+
if (success is LookupContactsLoading) {
183+
return ChatDetailViewStyle.mediumToolbarHeightSliverAppBar;
184+
}
185+
if (success is LookupMatchContactSuccess) {
186+
if (success.contact.email != null &&
187+
success.contact.phoneNumber != null) {
188+
return ChatDetailViewStyle.maxToolbarHeightSliverAppBar;
189+
}
190+
191+
if (success.contact.email != null ||
192+
success.contact.phoneNumber != null) {
193+
return ChatDetailViewStyle.mediumToolbarHeightSliverAppBar;
194+
}
195+
196+
return ChatDetailViewStyle.maxToolbarHeightSliverAppBar;
197+
}
198+
return ChatDetailViewStyle.minToolbarHeightSliverAppBar;
199+
},
200+
);
198201
}
199202

200203
class _Information extends StatelessWidget {

0 commit comments

Comments
 (0)