UI/UX improvements in Twitter User and Tweet.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-08-27 16:35:30 -05:00
parent 3853c3e9fc
commit 3134c006e6
6 changed files with 136 additions and 94 deletions

View File

@ -1,4 +1,61 @@
accessing accessing
asCardElement asCardElement
| aModeLook anEditor textInfoPane |
^ self asTestCardElement aModeLook := BrEditorModeAptitude new
editableFocused: [ :aWidget | aWidget border: (BlBorder paint: BrGlamorousColors focusedEditorBorderColor width: 1) ];
editableUnfocused: [ :aWidget | aWidget border: (BlBorder paint: BrGlamorousColors editorBorderColor width: 1) ];
readOnly: [ :aWidget | aWidget border: BlBorder empty ].
anEditor := BrEditor new
aptitude: BrGlamorousRegularEditorAptitude new + aModeLook;
text: self text;
vFitContent.
textInfoPane := BrVerticalPane new
hMatchParent;
vFitContent;
margin: (BlInsets left: 20);
addChild: (BrLabel new
aptitude: BrGlamorousLabelAptitude;
text: '@' , self user userName , ' | ' , self created asString;
beSmallSize);
addChild: anEditor.
^ BrHorizontalPane new
padding: (BlInsets all: 15);
margin: (BlInsets all: 10);
cellSpacing: 5;
hMatchParent;
vFitContent;
addChildren: {
(self user profileImage asElement asScalableElement size: 64 @ 64).
BrVerticalPane new
cellSpacing: 5;
hMatchParent;
vFitContent;
addChildren: {
textInfoPane.
BrHorizontalPane new
fitContent;
cellSpacing: 5;
addChildren: {
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Toggle subtopics';
action: [ anEditor beEditable ].
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Add subtopic keyword';
action: [ anEditor beReadOnlyWithSelection ].
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Details';
action: [ :e | e phlow spawnObject: self ].
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Web view';
action: [ self webView ].
}
}
}

View File

@ -1,62 +0,0 @@
accessing
asTestCardElement
<gtExample>
| aModeLook anEditor textInfoPane |
aModeLook := BrEditorModeAptitude new
editableFocused: [ :aWidget | aWidget border: (BlBorder paint: BrGlamorousColors focusedEditorBorderColor width: 1) ];
editableUnfocused: [ :aWidget | aWidget border: (BlBorder paint: BrGlamorousColors editorBorderColor width: 1) ];
readOnly: [ :aWidget | aWidget border: BlBorder empty ].
anEditor := BrEditor new
aptitude: BrGlamorousRegularEditorAptitude new + aModeLook;
text: self text;
vFitContent.
textInfoPane := BrVerticalPane new
hMatchParent;
vFitContent;
margin: (BlInsets left: 20);
addChild: (BrLabel new
aptitude: BrGlamorousLabelAptitude;
text: '@' , self user userName , ' | ' , self created asString;
beSmallSize);
addChild: anEditor.
^ BrHorizontalPane new
padding: (BlInsets all: 15);
margin: (BlInsets all: 10);
cellSpacing: 5;
hMatchParent;
vFitContent;
addChildren: {
(self user profileImage asElement asScalableElement size: 64 @ 64).
BrVerticalPane new
cellSpacing: 5;
hMatchParent;
vFitContent;
addChildren: {
textInfoPane.
BrHorizontalPane new
fitContent;
cellSpacing: 5;
addChildren: {
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Toggle subtopics';
action: [ anEditor beEditable ].
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Add subtopic keyword';
action: [ anEditor beReadOnlyWithSelection ].
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Details';
action: [ :e | e phlow spawnObject: self ].
BrButton new
aptitude: BrGlamorousButtonWithLabelAptitude new;
label: 'Web view';
action: [ self webView ].
}
}
}

View File

@ -0,0 +1,16 @@
accessing
gtViewTweetDetailsOn: aView
<gtView>
^ aView explicit
title: 'Tweet Details' translated;
priority: 5;
stencil: [
BlElement new
layout: BlFlowLayout new;
constraintsDo: [ :c |
c vertical fitContent.
c horizontal matchParent ];
padding: (BlInsets all: 10);
addChild: (self asCardElement margin: (BlInsets all: 20))
]

View File

@ -18,8 +18,8 @@ gtTweetsFor: aView
background: Color white; background: Color white;
margin: (BlInsets all: 10); margin: (BlInsets all: 10);
constraintsDo: [ :c | constraintsDo: [ :c |
c vertical exact: 135. c vertical exact: 145.
c horizontal matchParent ]; c horizontal matchParent ];
elementBuilder: [ each asTestCardElement margin: (BlInsets all: 20) ]. elementBuilder: [ each asCardElement margin: (BlInsets all: 20) ].
container addChild: imageContainer]. container addChild: imageContainer].
container asScrollableElement ] container asScrollableElement ]

View File

@ -1,29 +1,60 @@
ui accessing
asCardElement asCardElement
^ BrHorizontalPane new | aModeLook anEditor textInfoPane |
hFitContent;
aModeLook := BrEditorModeAptitude new
editableFocused: [ :aWidget | aWidget border: (BlBorder paint: BrGlamorousColors focusedEditorBorderColor width: 1) ];
editableUnfocused: [ :aWidget | aWidget border: (BlBorder paint: BrGlamorousColors editorBorderColor width: 1) ];
readOnly: [ :aWidget | aWidget border: BlBorder empty ].
anEditor := BrEditor new
aptitude: BrGlamorousRegularEditorAptitude new + aModeLook;
text: self description;
vFitContent.
textInfoPane := BrVerticalPane new
hMatchParent;
vFitContent;
margin: (BlInsets left: 20);
addChild: (BrLabel new
aptitude: BrGlamorousLabelAptitude;
text: '@' , self userName ;
beHugeSize);
addChild: (BrLabel new
aptitude: BrGlamorousLabelAptitude;
text: self name;
beLargeSize);
addChild: (BrLabel new
aptitude: BrGlamorousLabelAptitude;
text: 'Joined: ' , self createdAtShorted );
addChild: anEditor.
^ BrHorizontalPane new
padding: (BlInsets all: 15);
margin: (BlInsets all: 10);
cellSpacing: 5;
hMatchParent;
vFitContent; vFitContent;
padding: (BlInsets all: 20); addChildren: {
margin: (BlInsets all: 10); (self profileImage asElement asScalableElement size: 124 @ 124).
addChild: (self profileImage asElement asScalableElement size: 124@124); BrVerticalPane new
addChild: (BrVerticalPane new cellSpacing: 5;
fitContent; hMatchParent;
margin: (BlInsets left: 20); vFitContent;
addChild: (BlTextElement new addChildren: {
constraintsDo: [ :c | textInfoPane.
c horizontal fitContent ]; BrHorizontalPane new
margin: (BlInsets top: 5 right: 0 bottom: 5 left: 5); fitContent;
text: (('@', self userName) asRopedText glamorousRegularFont cellSpacing: 5;
fontSize: 20; addChildren: {
foreground: Color black)); BrButton new
addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: self name; beLargeSize); aptitude: BrGlamorousButtonWithLabelAptitude new;
addChild: (BrLabel new label: 'Tweets';
aptitude: BrGlamorousLabelAptitude; text: 'joined: ', self createdAtShorted); action: [ :e | e phlow spawnObject: self tweets ].
addChild: (BrLabel new aptitude: BrGlamorousLabelAptitude; text: self description); BrButton new
addChild: (BrEditor new aptitude: BrGlamorousButtonWithLabelAptitude new;
constraintsDo: [ :c | label: 'Web view';
c horizontal matchParent ]; action: [ self webView ].
aptitude: BrGlamorousRegularEditorAptitude new; }
beReadOnlyWithSelection; }
text: String loremIpsum)); }
when: BlClickEvent do: [:e | e target phlow spawnObject: self tweets]

View File

@ -1,4 +1,4 @@
accessing ui
gtViewProfileDetailsOn: aView gtViewProfileDetailsOn: aView
<gtView> <gtView>
^ aView explicit ^ aView explicit
@ -18,7 +18,7 @@ gtViewProfileDetailsOn: aView
background: Color white; background: Color white;
margin: (BlInsets all: 20); margin: (BlInsets all: 20);
constraintsDo: [ :c | constraintsDo: [ :c |
c vertical exact: 150. c vertical exact: 175.
c horizontal matchParent ]; c horizontal matchParent ];
elementBuilder: [ self asCardElement margin: (BlInsets all: 20) ]. elementBuilder: [ self asCardElement margin: (BlInsets all: 20) ].
container addChild: imageContainer]. container addChild: imageContainer].