skip to Main Content
Listener(
        onPointerUp: (event) {
                   LogUtil.v('++++++onPointerUp++++');
},
        child: ListView.builder(
               itemCount:10,
                itemBuilder:(context, index) {
                   return GestureDetector(
                          onTap:() {
                              LogUtil.v('++++++GestureDetector++++');
                          },
                          child:Container(
                             height:200
                          )
                    )
                }
))

When I click listview item, print ‘++++++GestureDetector++++’ ,’++++++onPointerUp++++’ also printed. How can I make ‘++++++onPointerUp++++’ not print?

2

Answers


  1. If you don’t need the log inside the Listener, why don’t you just remove the line:

    LogUtil.v('++++++onPointerUp++++');
    
    Login or Signup to reply.
  2. Maybe something like this is a possibility

    bool tapped = false;
    
    Listener(
            onPointerUp: (event) {
                     if (!tapped ) {
                       LogUtil.v('++++++onPointerUp++++');
                     } else {
                       tapped = false;
                     }
    },
            child: ListView.builder(
                   itemCount:10,
                    itemBuilder:(context, index) {
                       return GestureDetector(
                              onTap:() {
                                  tapped = true;
                                  LogUtil.v('++++++GestureDetector++++');
                              },
                              child:Container(
                                 height:200
                              )
                        )
                    }
    ))
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search