From 23243246955f9dfb05ef5d5a832d59eb00781b31 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Sat, 21 Aug 2021 21:40:33 -0500 Subject: [PATCH] Improving profile preview. Now renders properly when profile image have been properly processed and also with generic avatars when they have not. --- .../instance/asCardElement.st | 4 +- .../instance/gtViewProfileDetailsOn..st | 54 +++++-------------- 2 files changed, 16 insertions(+), 42 deletions(-) diff --git a/Datanalitica.package/TwitterUser.class/instance/asCardElement.st b/Datanalitica.package/TwitterUser.class/instance/asCardElement.st index 6d60c36..05de51a 100644 --- a/Datanalitica.package/TwitterUser.class/instance/asCardElement.st +++ b/Datanalitica.package/TwitterUser.class/instance/asCardElement.st @@ -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] \ No newline at end of file diff --git a/Datanalitica.package/TwitterUser.class/instance/gtViewProfileDetailsOn..st b/Datanalitica.package/TwitterUser.class/instance/gtViewProfileDetailsOn..st index 3704d53..a893262 100644 --- a/Datanalitica.package/TwitterUser.class/instance/gtViewProfileDetailsOn..st +++ b/Datanalitica.package/TwitterUser.class/instance/gtViewProfileDetailsOn..st @@ -4,47 +4,21 @@ gtViewProfileDetailsOn: aView ^ aView explicit 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. - ]. - + stencil: [ + | 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 ]. \ No newline at end of file + c vertical exact: 150. + c horizontal exact: 1000 ]; + elementBuilder: [ self asCardElement margin: (BlInsets all: 20) ]. + container addChild: imageContainer]. \ No newline at end of file