@@ -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
200203class _Information extends StatelessWidget {
0 commit comments