wrapWithInkWell function
Implementation
List<Widget> wrapWithInkWell(
BuildContext context,
BaseNode node,
List<Widget> children,
) {
if (node is! ReactionMixin) return children;
final InkWellModel? inkWell = node is BlendMixin ? node.inkWell : null;
if (inkWell == null) return children;
final List<Reaction> onClickReactions = (node as ReactionMixin)
.reactions
.where((reaction) => reaction.trigger.type == TriggerType.click)
.toList();
final List<Reaction> onLongPressReactions = (node as ReactionMixin)
.reactions
.where((reaction) => reaction.trigger.type == TriggerType.longPress)
.toList();
final widget = Material(
type: MaterialType.transparency,
child: InkWell(
onTap: onClickReactions.isEmpty
? null
: () => FunctionsRepository.triggerAction(
context,
TriggerType.click,
reactions: onClickReactions,
),
onLongPress: onLongPressReactions.isEmpty
? null
: () => FunctionsRepository.triggerAction(
context,
TriggerType.longPress,
reactions: onLongPressReactions,
),
borderRadius: getBorderRadius(node),
overlayColor: inkWell.overlayColor != null
? MaterialStatePropertyAll<Color>(
inkWell.overlayColor!.toFlutterColor(),
)
: null,
splashColor: inkWell.splashColor?.toFlutterColor(),
highlightColor: inkWell.highlightColor?.toFlutterColor(),
hoverColor: inkWell.hoverColor?.toFlutterColor(),
focusColor: inkWell.focusColor?.toFlutterColor(),
child: Stack(
children: children,
),
),
);
return [widget];
}