-
Notifications
You must be signed in to change notification settings - Fork 3k
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 InkResponse
, Material
and fix Opacity
#6199
Changes from 7 commits
ad5b352
d0361d5
f23677c
212102e
559ae8f
b356b03
f74cd13
54adf1e
51a5447
f9bf799
cfd3a43
06d2761
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
|
||
import 'package:flutter/gestures.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/rendering.dart'; | ||
|
||
import 'argument_decoders.dart'; | ||
import 'runtime.dart'; | ||
|
@@ -30,9 +31,11 @@ import 'runtime.dart'; | |
/// * [DropdownButton] | ||
/// * [ElevatedButton] | ||
/// * [FloatingActionButton] | ||
/// * [InkResponse] | ||
/// * [InkWell] | ||
/// * [LinearProgressIndicator] | ||
/// * [ListTile] | ||
/// * [Material] | ||
/// * [OutlinedButton] | ||
/// * [Scaffold] | ||
/// * [TextButton] | ||
|
@@ -337,6 +340,42 @@ Map<String, LocalWidgetBuilder> get _materialWidgetsDefinitions => <String, Loca | |
); | ||
}, | ||
|
||
'InkResponse': (BuildContext context, DataSource source) { | ||
// not implemented: mouseCursor, overlayColor, splashFactory, focusNode. | ||
return InkResponse( | ||
onTap: source.voidHandler(['onTap']), | ||
onTapDown: source.handler(['onTapDown'], (VoidCallback trigger) => (TapDownDetails details) => trigger()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we want to expose the details in the event? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filed the issue #144175. We should expose the details for all the tap events. |
||
onTapUp: source.handler(['onTapUp'], (VoidCallback trigger) => (TapUpDetails details) => trigger()), | ||
onTapCancel: source.voidHandler(['onTapCancel']), | ||
onDoubleTap: source.voidHandler(['onDoubleTap']), | ||
onLongPress: source.voidHandler(['onLongPress']), | ||
onSecondaryTap: source.voidHandler(['onSecondaryTap']), | ||
onSecondaryTapUp: source.handler(['onSecondaryTapUp'], (VoidCallback trigger) => (TapUpDetails details) => trigger()), | ||
onSecondaryTapDown: source.handler(['onSecondaryTapDown'], (VoidCallback trigger) => (TapDownDetails details) => trigger()), | ||
onSecondaryTapCancel: source.voidHandler(['onSecondaryTapCancel']), | ||
onHighlightChanged: source.handler(['onHighlightChanged'], (VoidCallback trigger) => (bool highlighted) => trigger()), | ||
onHover: source.handler(['onHover'], (VoidCallback trigger) => (bool hovered) => trigger()), | ||
containedInkWell: source.v<bool>(['containedInkWell']) ?? false, | ||
highlightShape: ArgumentDecoders.enumValue<BoxShape>(BoxShape.values, source, ['highlightShape']) ?? BoxShape.circle, | ||
radius: source.v<double>(['radius']), | ||
borderRadius: ArgumentDecoders.borderRadius(source, ['borderRadius']) | ||
?.resolve(Directionality.of(context)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. weird wrapping There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. |
||
customBorder: ArgumentDecoders.shapeBorder(source, ['customBorder']), | ||
focusColor: ArgumentDecoders.color(source, ['focusColor']), | ||
hoverColor: ArgumentDecoders.color(source, ['hoverColor']), | ||
highlightColor: ArgumentDecoders.color(source, ['highlightColor']), | ||
splashColor: ArgumentDecoders.color(source, ['splashColor']), | ||
enableFeedback: source.v<bool>(['enableFeedback']) ?? true, | ||
excludeFromSemantics: source.v<bool>(['excludeFromSemantics']) ?? false, | ||
canRequestFocus: source.v<bool>(['canRequestFocus']) ?? true, | ||
onFocusChange: source.handler(['onFocusChange'], (VoidCallback trigger) => (bool focus) => trigger()), | ||
autofocus: source.v<bool>(['autofocus']) ?? false, | ||
hoverDuration: | ||
ArgumentDecoders.duration(source, ['hoverDuration'], context), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. weird wrapping There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. |
||
child: source.child(['child']), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pretty sure this one can be optional There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. |
||
); | ||
}, | ||
|
||
'InkWell': (BuildContext context, DataSource source) { | ||
// not implemented: onHighlightChanged, onHover; mouseCursor; focusColor, hoverColor, highlightColor, overlayColor, splashColor; splashFactory; focusNode, onFocusChange | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since you've implemented some of these for InkResponse, we might as well add them here too for consistency There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
return InkWell( | ||
|
@@ -395,6 +434,23 @@ Map<String, LocalWidgetBuilder> get _materialWidgetsDefinitions => <String, Loca | |
); | ||
}, | ||
|
||
'Material': (BuildContext context, DataSource source) { | ||
return Material( | ||
type: ArgumentDecoders.enumValue<MaterialType>(MaterialType.values,source, ['type']) ?? MaterialType.canvas, | ||
elevation: source.v<double>(['elevation']) ?? 0.0, | ||
color: ArgumentDecoders.color(source, ['color']), | ||
shadowColor: ArgumentDecoders.color(source, ['shadowColor']), | ||
surfaceTintColor: ArgumentDecoders.color(source, ['surfaceTintColor']), | ||
textStyle: ArgumentDecoders.textStyle(source, ['textStyle']), | ||
borderRadius: ArgumentDecoders.borderRadius(source, ['borderRadius']), | ||
shape: ArgumentDecoders.shapeBorder(source, ['shape']), | ||
borderOnForeground: source.v<bool>(['borderOnForeground']) ?? true, | ||
clipBehavior: ArgumentDecoders.enumValue<Clip>(Clip.values, source, ['clipBehavior']) ?? Clip.none, | ||
animationDuration: ArgumentDecoders.duration(source, ['animationDuration'], context), | ||
child: source.child(['child']), | ||
); | ||
}, | ||
|
||
'OutlinedButton': (BuildContext context, DataSource source) { | ||
// not implemented: buttonStyle, focusNode | ||
return OutlinedButton( | ||
|
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.
we should document what was fixed
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.
Updated.