-
Notifications
You must be signed in to change notification settings - Fork 29.7k
The Ink widget #13900
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
The Ink widget #13900
Conversation
HansMuller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still working through this, just an update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh, i still think of it as "quantum paper"...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed -> material
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Container and DecoratedBox aren't necessarily opaque, so the unqualified parenthetical statement is a little confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaced with "maybe using a ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice short name. It's also a bit of a misnomer if we're going to say that splashes and ripples are drawn with "ink". A longer more horrible but more apt name would be MaterialAncestorDecorator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as we discussed, i agree that the name is a bit sketchy but i think we want this to be more attractive than Container or BoxDecoration or even Image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... because in that case ink well and ink response descendants will draw their splashes on the otherwise transparent material
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want DecoratedBox.image and Container.image.
Maybe if we had BoxDecoration.image then one could just write new Ink(decoration: new BoxDecoration.image(...))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you think we want DecoratedBox.image and Container.image? I mean, I don't know if we do, but maybe we do, if this works out well here...
The problem with only having BoxDecoration.image is that it's still pretty verbose, c.f.:
new Ink.image(
image: new AssetImage('cat.jpeg'),
fit: BoxFit.cover,
width: 300.0,
height: 200.0,
)
new Ink(
decoration: new BoxDecoration.image(
image: new AssetImage('cat.jpeg'),
fit: BoxFit.cover,
),
width: 300.0,
height: 200.0,
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO we'd want DecoratedBox.image and Container.image constructors for the sake symmetry (because that makes the APIs easier to understand) and we wouldn't want Ink.image, et al because less API is more.
IMHO BoxDecoration.image balances the API weight than the other 3 constructors, but I defer to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might want DecoratedBox.image and Container.image, I just think we should see how Ink.image goes before doing it. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
video_player provide a Texture, not a Image.
Do you have a solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when a Material widget has more than one Ink descendant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added some prose about this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scaffold creates a Material widget, so don't most transitions occur "inside Material"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. I clarified this a bit to say that it's specifically a problem if you move ink features around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the advice we want to provide is: don't allow the layout to be defined by the image's actual size. Either constrain the size of the image or specify it explicitly with width and height.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this:
/// Either the [width] and [height] arguments should be specified, or the
/// widget should be placed in a context that sets tight layout constraints.
/// Otherwise, the image dimensions will change as the image is loaded, which
/// will result in ugly layout changes. ```
|
Updated per comments, PTAL. |
a5f66c9 to
d56374e
Compare
|
LGTM. There's merging to be done because of the ripple changes (sorry). |
|
Merged. Will land on green. Thanks for the review. |
This provides a way to draw colors, images, and general decorations on Material widgets, without interfering with InkWells that are further descendants of the widget. This thus provides a cleaner way to solve the issue of FlatButtons and InkWells not working when placed over Image widgets than the old hack of introducing a transparency Material. Fixes flutter#3782. Also, some fixes to documentation, and remove a redundant property on the Image widget.
This provides a way to draw colors, images, and general decorations on Material widgets, without interfering with InkWells that are further descendants of the widget. This thus provides a cleaner way to solve the issue of FlatButtons and InkWells not working when placed over Image widgets than the old hack of introducing a transparency Material. Fixes flutter#3782. Also, some fixes to documentation, and remove a redundant property on the Image widget.
This provides a way to draw colors, images, and general decorations on Material widgets, without interfering with InkWells that are further descendants of the widget.
This thus provides a cleaner way to solve the issue of FlatButtons and InkWells not working when placed over Image widgets than the old hack of introducing a transparency Material.
Fixes #3782.
Also, some fixes to documentation, and remove a redundant property on the Image widget.