-
Using the WhatsApp theme it would be convenient to apply a selected filter by simply tapping on a point of the image and not necessarily closing the filters section by hand. I tried to implement by listening to the onTap callback on the mainEditor but I was unable to apply the filter and consequently close the filters section. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You just need to wrap the content from the editor with a customWidgets: ImageEditorCustomWidgets(
mainEditor: CustomWidgetsMainEditor(
wrapBody: (editor, rebuildStream, content) {
return Stack(
alignment: Alignment.center,
fit: StackFit.expand,
clipBehavior: Clip.none,
children: [
Transform.scale(
transformHitTests: false,
scale: 1 /
constraints.maxHeight *
(constraints.maxHeight -
_whatsAppHelper.filterShowHelper * 2),
/// TODO: Add gestureDetector like below
child: GestureDetector(
onTap: () async {
while (_whatsAppHelper.filterShowHelper > 0) {
_whatsAppHelper.filterShowHelper -= 4;
setState(() {});
await Future.delayed(
const Duration(milliseconds: 1));
}
},
child: content),
), |
Beta Was this translation helpful? Give feedback.
You just need to wrap the content from the editor with a
GestureDetector
and set thefilterShowHelper
from theWhatsAppHelper
class to0
. In the code below, I demonstrate how to do this with animation in a loop, but you can also implement it without animation.