Improving profile preview. Now renders properly when profile image have been properly processed and also with generic avatars when they have not.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-08-21 21:40:33 -05:00
parent a8fca8f6a6
commit 2324324695
2 changed files with 16 additions and 42 deletions

View File

@ -5,7 +5,7 @@ asCardElement
vFitContent;
padding: (BlInsets all: 20);
margin: (BlInsets all: 10);
addChild: (self profileImage asElement asScalableElement size: 64@64);
addChild: (self profileImage asElement asScalableElement size: 124@124);
addChild: (BrVerticalPane new
fitContent;
margin: (BlInsets left: 20);
@ -16,7 +16,7 @@ asCardElement
text: (('@', self userName) asRopedText glamorousRegularFont
fontSize: 20;
foreground: Color black));
addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: self name);
addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: self name; beLargeSize);
addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: 'joined: ', self createdAtShorted);
addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: self description));
when: BlClickEvent do: [:e | e target phlow spawnObject: self]

View File

@ -5,46 +5,20 @@ gtViewProfileDetailsOn: aView
title: 'Details' translated;
priority: 5;
stencil: [
|container verticalContainer detailsTextContainer avatarContainer nameTextContainer details|
details := String streamContents: [:aStream |
aStream nextPutAll: self name.
aStream cr.
aStream nextPutAll: self description.
].
| container imageContainer |
container := BlElement new
layout: BlLinearLayout horizontal;
layout: BlFlowLayout new;
constraintsDo: [ :c |
c vertical fitContent.
c horizontal matchParent ];
padding: (BlInsets all: 10).
imageContainer := BlLazyElement new
withGlamorousPreview;
aptitude: BrShadowAptitude new;
background: Color white;
aptitude: BrShadowAptitude;
margin: (BlInsets all: 20);
constraintsDo: [ :c |
c horizontal fitContent.
c vertical fitContent].
avatarContainer := BlElement new
size: 124@124;
background: (self profileImage scaledToSize: 124@124);
margin: (BlInsets all: 10).
nameTextContainer := BlTextElement new
constraintsDo: [ :c |
c horizontal matchParent ];
margin: (BlInsets top: 5 right: 0 bottom: 20 left: 5);
text: (('@', self userName) asRopedText glamorousRegularFont
fontSize: 30;
foreground: Color black).
detailsTextContainer := BrEditor new
aptitude: (BrGlamorousRegularEditorAptitude new fontSize: 16);
text: details;
constraintsDo: [ :c |
c horizontal matchParent.
c vertical matchParent ].
verticalContainer := BlElement new
layout: BlLinearLayout vertical;
margin: (BlInsets all: 10);
constraintsDo: [ :c |
c horizontal matchParent.
c vertical matchParent].
verticalContainer addChild: nameTextContainer.
verticalContainer addChild: detailsTextContainer.
container addChild: avatarContainer.
container addChild: verticalContainer.
container ].
c vertical exact: 150.
c horizontal exact: 1000 ];
elementBuilder: [ self asCardElement margin: (BlInsets all: 20) ].
container addChild: imageContainer].