Commit e5db8555 by Zac Chan

Added cancel toast on tap

parent 7e4ef594
...@@ -106,7 +106,9 @@ public class FluttertoastPlugin implements MethodCallHandler { ...@@ -106,7 +106,9 @@ public class FluttertoastPlugin implements MethodCallHandler {
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
handler.removeCallbacks(run); handler.removeCallbacks(run);
toastView.setOnTouchListener(null); toastView.setOnTouchListener(null);
toast.cancel();
try { try {
result.success(true); result.success(true);
} catch (Exception e){ } catch (Exception e){
...@@ -122,7 +124,7 @@ public class FluttertoastPlugin implements MethodCallHandler { ...@@ -122,7 +124,7 @@ public class FluttertoastPlugin implements MethodCallHandler {
} }
toast.show(); toast.show();
handler.postDelayed(run,4000); handler.postDelayed(run,toast.getDuration()*1000);
} else { } else {
result.notImplemented(); result.notImplemented();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment