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
Add support for a new kind of InkSplash: the "ripple" #13986
Conversation
That won't make sense for the InkDecoration feature. |
We could introduce an |
/// gestures (such as tap and long-press) to trigger ink splashes. | ||
/// gestures (such as tap and long-press) to trigger ink splashes. This class | ||
/// is used when the [Theme]'s [ThemeData.splashType] is [InkSplashType.drop] | ||
/// (which is the theme's default splash type). |
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.
"the theme's default splash type" is unclear; i'd probably just say "which is the default splash type" or some such.
} // else we're probably in deactivate() | ||
} | ||
|
||
switch(widget.splashType ?? Theme.of(context).splashType) { |
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.
nit: space after switch
final BorderRadius borderRadius = widget.borderRadius ?? BorderRadius.zero; | ||
|
||
InkFeature splash; | ||
void onRemoved () { |
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.
nit: no space before (
/// | ||
/// * [ThemeData.splashType], which defines the splash type for a Material | ||
/// [Theme]. | ||
enum InkSplashType { |
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 i wouldn't give for metaclasses.
How about we put a static function on the two classes, each implementing the same signature as the constructors and each just redirecting to the respective constructor, and then instead of this enum we point to one of those functions?
Then if someone wants to make a third kind of splash, it's easy to do.
It's ugly as heck, but InkSplashType is BoxShape all over again...
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 defined an InteractiveInkFeatureFactory
(yow) abstract class that just has a create method. It's the value of InkSplash.splashFactory
and InkRipple.splashFactory
_color = value; | ||
controller.markNeedsPaint(); | ||
} | ||
|
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 should have an abstract class between InkFeature and InkSplash/InkRipple(/InkHighlight?) that hosts these three.
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 added an abstract class called InteractiveInkFeature
Found: center == $center radius == $radius alpha == ${paint.color.alpha}'''; | ||
})); | ||
|
||
// At this point the splash radius has expanded to its limit: 5 passed the |
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.
passed -> past
/// The [InkWell] and [InkResponse] widgets generate instances of this | ||
/// class. | ||
abstract class InteractiveInkFeature extends InkFeature { | ||
/// Creates an InteractiveInkFeature. |
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.
should talk about what arguments have got to be non-null
/// Defines the appearance of ink splashes produces by [InkWell] | ||
/// and [InkResponse]. | ||
/// | ||
/// See Also |
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.
See also:
Added the
InkRipple
InkFeature and an InkSplashType enum to the material library.Added
InkSplashType splashType
to material's theme data.InkWell and InkResponse now have a
InkSplashType splashType
parameter that determines what kind of ink feature is displayed in reponse to user input. This parameter defaults toTheme.of(..).splashType
.Hoisted
color
confirm()
andcancel()
from theInkFeature
subclasses toInkFeature
.