@OnCreateLayout static Component onCreateLayout( ComponentContext c, @Prop Component child, @State Optional<Exception> error) { if (error.isPresent()) { return Column.create(c) .marginDip(YogaEdge.ALL, 16) .child( DebugErrorComponent.create(c) .message("Error Boundary") .throwable(error.get()) .build()) .build(); } return child; }
.transitionKey(TRANSITION_KEY_CONTAINER_4) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .marginDip(YogaEdge.TOP, 24) .heightDip(60 * 2 + 3 * 8) .paddingDip(YogaEdge.ALL, 8) .transitionKey(TRANSITION_KEY_CHILD_4_1_1) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .marginDip(YogaEdge.RIGHT, 6) .flex(1) .backgroundColor(Color.RED)) .transitionKey(TRANSITION_KEY_CHILD_4_2_1) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .marginDip(YogaEdge.RIGHT, 6) .widthDip(100) .backgroundColor(Color.RED))
private static Component affectedChildren(ComponentContext c, boolean flag1) { return Row.create(c) .transitionKey(TRANSITION_KEY_CONTAINER_1) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .heightDip(60 + 2 * 8) .widthDip((3 * 60) * (flag1 ? 0.5f : 1) + 4 * 8) .paddingDip(YogaEdge.ALL, 8) .backgroundColor(Color.YELLOW) .child( Column.create(c) .transitionKey(TRANSITION_KEY_CHILD_1_1) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .flex(1) .backgroundColor(Color.RED)) .child( Column.create(c) .transitionKey(TRANSITION_KEY_CHILD_1_2) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .flex(1) .backgroundColor(Color.RED) .marginDip(YogaEdge.HORIZONTAL, 8)) .child( Column.create(c) .flex(1) .transitionKey(TRANSITION_KEY_CHILD_1_3) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .backgroundColor(Color.RED)) .clickHandler(BoundsAnimationComponent.onFirstComponentClick(c)) .build(); }
private static Component affectedSiblings(ComponentContext c, boolean flag2) { return Row.create(c) .transitionKey(TRANSITION_KEY_CONTAINER_2) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .heightDip(60 + 2 * 8) .widthDip(3 * 60 + 3 * 8) .paddingDip(YogaEdge.ALL, 8) .backgroundColor(Color.LTGRAY) .child( Column.create(c) .transitionKey(TRANSITION_KEY_CHILD_2_1) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .flex(1) .backgroundColor(Color.RED)) .child( Column.create(c) .transitionKey(TRANSITION_KEY_CHILD_2_2) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .flex(flag2 ? 1 : 2) .backgroundColor(Color.YELLOW) .marginDip(YogaEdge.LEFT, 8)) .clickHandler(BoundsAnimationComponent.onSecondComponentClick(c)) .build(); }
@OnCreateLayout static Component onCreateLayout(ComponentContext c, @Prop ListRow row) { return Column.create(c) .paddingDip(YogaEdge.VERTICAL, 8) .paddingDip(YogaEdge.HORIZONTAL, 32) .child( Card.create(c) .content( Column.create(c) .marginDip(YogaEdge.ALL, 32) .child(TitleComponent.create(c).title(row.title)) .child(PossiblyCrashingSubTitleComponent.create(c).subtitle(row.subtitle)) .build()) .build()) .build(); } }
private static Component buildCell(ComponentContext c, int color, String key) { return Column.create(c) .flexGrow(1f) .aspectRatio(0.75f) .marginDip(YogaEdge.ALL, 8) .background(buildRoundedRect(c, color, 8)) .transitionKey(key) .transitionKeyType(Transition.TransitionKeyType.GLOBAL) .build(); }