GestureDetector constructor
GestureDetector({
- required void onTap(),
- required BloomNode child,
Creates a clickable child with keyboard activation and button semantics.
GestureDetector(onTap: save, child: StyledText('Save'));
Implementation
GestureDetector({required void Function() onTap, required BloomNode child})
: super('div',
children: [child],
attrs: const {'role': 'button', 'tabindex': '0'},
style: 'cursor: pointer',
on: {
'click': (_) => onTap(),
'keydown': (event) {
if (event.key == 'Enter' ||
event.key == ' ' ||
event.code == 'Space') {
onTap();
}
},
});