Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize {
- ASStackLayoutSpec *nameWithDateSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:0 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStart children:@[self.fullName, self.date]];
- ASStackLayoutSpec *textWithImage = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:8 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsCenter children:@[self.profileImage, nameWithDateSpec]];
- ASStackLayoutSpec *lastCommentCellSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:0 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStart children:@[textWithImage, self.lastCommentTextNode]];
- ASStackLayoutSpec *titleWithCommentStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:4 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStart children:@[self.titleNode, self.commentCount]];
- titleWithCommentStack.style.flexGrow = 1;
- titleWithCommentStack.style.flexShrink = 1;
- NSMutableArray *tempArray = [NSMutableArray arrayWithObject:titleWithCommentStack];
- VFDGroup *group = [VFDGroup objectForPrimaryKey:@(-self.discussion.updatedBy.integerValue)];
- if (group.is_admin.boolValue) {
- [tempArray addObject:self.dotButton];
- }
- ASStackLayoutSpec *labelWithDotButtonStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:0 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsCenter children:tempArray];
- ASBackgroundLayoutSpec *mainBackground = [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:labelWithDotButtonStack background:self.themeNode];
- mainBackground.style.alignSelf = ASStackLayoutAlignSelfStretch;
- ASStackLayoutSpec *mainStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:8 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStart children:@[mainBackground, self.separatorNode, [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:lastCommentCellSpec background:self.lastCommentNode]]];
- return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(8, 8, 8, 0) child:mainStack];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement