Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataRow2 decoration property improvement #262

Open
npateras opened this issue Feb 23, 2024 · 2 comments
Open

DataRow2 decoration property improvement #262

npateras opened this issue Feb 23, 2024 · 2 comments

Comments

@npateras
Copy link

npateras commented Feb 23, 2024

Please make it so the decoration property in DataRow2 to be able to take MaterialStateProperty similar to color.

Reason:
So I came across a problem and I couldn't figure out how to do it with DataTable. I wanted when hovering over a row to show a color around the row. Now you might think this can be achieved with color property, and you are right, but not quite because I wanted the hovered color to have a corner radius! Which can be achieved with decoration, but decoration doesn't have MaterialStateProperty. Additionally, there could be an option to add an animation when the hover effect appears.

@maxim-saplin
Copy link
Owner

Can you demonstrate it in a picture?

@npateras
Copy link
Author

npateras commented Apr 5, 2024

So in DataRow2, you can set a color with MaterialStateProperty which changes the background color of the row when hovering over using the hover property of MaterialStateProperty. Now I am asking if it's possible to be done for decoration too so we can have rounded corners instead, like this:

Current: Left, Suggestion: Right
image

Code example:

DataRow2(
    decoration: MaterialStateProperty.resolveWith(
        if (states.contains(MaterialState.hovered)) {
            return Container(color: Colors.grey)
        }
    )
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants