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

View File

@ -5,46 +5,20 @@ gtViewProfileDetailsOn: aView
title: 'Details' translated; title: 'Details' translated;
priority: 5; priority: 5;
stencil: [ stencil: [
|container verticalContainer detailsTextContainer avatarContainer nameTextContainer details| | container imageContainer |
details := String streamContents: [:aStream |
aStream nextPutAll: self name.
aStream cr.
aStream nextPutAll: self description.
].
container := BlElement new 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; background: Color white;
aptitude: BrShadowAptitude;
margin: (BlInsets all: 20); margin: (BlInsets all: 20);
constraintsDo: [ :c | constraintsDo: [ :c |
c horizontal fitContent. c vertical exact: 150.
c vertical fitContent]. c horizontal exact: 1000 ];
avatarContainer := BlElement new elementBuilder: [ self asCardElement margin: (BlInsets all: 20) ].
size: 124@124; container addChild: imageContainer].
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 ].