Code Monkey home page Code Monkey logo

stevia.kt's People

Contributors

s4cha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

stevia.kt's Issues

The specified child already has a parent. You must call removeView() on the child's parent first.

This is the activity layout:

`ConstraintLayout(currentActivity).subviews(
flowStorage.asView(),
bottomNavigation,
blockConstraint
)

when I navigate from notification it gives :

The specified child already has a parent. You must call removeView() on the child's parent first.

How to solve this?
tried this https://stackoverflow.com/questions/28071349/the-specified-child-already-has-a-parent-you-must-call-removeview-on-the-chil but nothing helped
`

Vertical layout behavior

When trying to lay out views, I want to achieve something that looks like this:
Screen Shot 2019-10-01 at 11 07 23 AM

The following code achieves what I want:

    proteinLabel.centerInParent()

    fatLabel
      .constrainRightToRightOf(proteinLabel)
      .constrainBottomToTopOf(proteinLabel, 40)

    carbLabel
      .constrainRightToRightOf(proteinLabel)
      .constrainTopToBottomOf(proteinLabel, 40)

But I like how visually intuitive the layout() function is. I would expect something like

layout(
      "",
      fatLabel.constrainRightToRightOf(proteinLabel),
      40,
      I - proteinLabel.centerVertically() - I,
      40,
      carbLabel.constrainRightToRightOf(proteinLabel),
      ""
    )

would achieve the same result as the first snippet, but that doesn't seem to be the case. Instead, I get the following:
Screen Shot 2019-10-01 at 11 14 35 AM
Is there a way to achieve the layout I'm after using the layout() method? Otherwise, I don't know that I gain a whole lot over the visual design representation, especially as the number of subviews grows and increases the complexity and number of constraints.

For example, creating a view like this doesn't seem to be easy with Stevia:
Screen Shot 2019-10-01 at 12 13 55 PM
Whereas it's simple with the design editor:
Screen Shot 2019-10-01 at 12 16 19 PM

Any plan to improve this library?

Stevia.kt is brilliant for UI layout on Android. However, it is not perfect, for instance, I-password-forgot-I, only layout horizontally for first item.
// code snippet from the lib
// Embedded Horizontal layout.
(item as? Array)?.let { horizontalLayout ->

// Take first "View" type in the array to layout.
var secondItem = if (horizontalLayout.count() > 1) horizontalLayout[1] else null
var firstView = (horizontalLayout.firstOrNull() as? View)
        ?: (secondItem as? View)
firstView?.let {
    layoutView(it)
}

}

The expecting result should be layout horizontally for all item.

Is there any plan to improve this library?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.