Advertisement
Guest User

Untitled

a guest
Nov 10th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize {
  2.     ASStackLayoutSpec *nameWithDateSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:0 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStart children:@[self.fullName, self.date]];
  3.    
  4.     ASStackLayoutSpec *textWithImage = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:8 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsCenter children:@[self.profileImage, nameWithDateSpec]];
  5.    
  6.     ASStackLayoutSpec *lastCommentCellSpec = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:0 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStart children:@[textWithImage, self.lastCommentTextNode]];
  7.    
  8.     ASStackLayoutSpec *titleWithCommentStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:4 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStart children:@[self.titleNode, self.commentCount]];
  9.     titleWithCommentStack.style.flexGrow = 1;
  10.     titleWithCommentStack.style.flexShrink = 1;
  11.    
  12.     NSMutableArray *tempArray = [NSMutableArray arrayWithObject:titleWithCommentStack];
  13.     VFDGroup *group = [VFDGroup objectForPrimaryKey:@(-self.discussion.updatedBy.integerValue)];
  14.     if (group.is_admin.boolValue) {
  15.         [tempArray addObject:self.dotButton];
  16.     }
  17.     ASStackLayoutSpec *labelWithDotButtonStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionHorizontal spacing:0 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsCenter children:tempArray];
  18.    
  19.     ASBackgroundLayoutSpec *mainBackground = [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:labelWithDotButtonStack background:self.themeNode];
  20.     mainBackground.style.alignSelf = ASStackLayoutAlignSelfStretch;
  21.    
  22.     ASStackLayoutSpec *mainStack = [ASStackLayoutSpec stackLayoutSpecWithDirection:ASStackLayoutDirectionVertical spacing:8 justifyContent:ASStackLayoutJustifyContentStart alignItems:ASStackLayoutAlignItemsStart children:@[mainBackground, self.separatorNode, [ASBackgroundLayoutSpec backgroundLayoutSpecWithChild:lastCommentCellSpec background:self.lastCommentNode]]];
  23.    
  24.     return [ASInsetLayoutSpec insetLayoutSpecWithInsets:UIEdgeInsetsMake(8, 8, 8, 0) child:mainStack];
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement