Need to track time on current Item position in view by user ,in ListView.builder ,Flutter2019 Community Moderator ElectionAndroid: combining text & image on a Button or ImageButtonListView with text and imagesFlutter - How to pass user data to all viewsScrolling jank with nested Columns and Rows inside ListView itemsadd an item to ListView.builder flutter firebasePrepend list view items while maintaining scroll view offset in Flutterflutter listView.Builder hide the divider on last list itemListView.builder scroll item by item in flutterHow to prevent widget re-render on ListView scrollKeep position in list with new items Flutter ListView

Why isn't P and P/poly trivially the same?

Should I file my taxes? No income, unemployed, but paid 2k in student loan interest

What is Tony Stark injecting into himself in Iron Man 3?

What should I do when a paper is published similar to my PhD thesis without citation?

Is it appropriate to ask a former professor to order a library book for me through ILL?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

How does learning spells work when leveling a multiclass character?

Vector-transposing function

Will the concrete slab in a partially heated shed conduct a lot of heat to the unconditioned area?

What do you call someone who likes to pick fights?

Can I negotiate a patent idea for a raise, under French law?

How can I portion out frozen cookie dough?

How to make sure I'm assertive enough in contact with subordinates?

Create chunks from an array

ESPP--any reason not to go all in?

Was this cameo in Captain Marvel computer generated?

What would be the most expensive material to an intergalactic society?

Boss Telling direct supervisor I snitched

Is divide-by-zero a security vulnerability?

Does an unused member variable take up memory?

An Undercover Army

Are brahmins allowed to drink alcohol?

Can I challenge the interviewer to give me a proper technical feedback?

Why aren't there more Gauls like Obelix?



Need to track time on current Item position in view by user ,in ListView.builder ,Flutter



2019 Community Moderator ElectionAndroid: combining text & image on a Button or ImageButtonListView with text and imagesFlutter - How to pass user data to all viewsScrolling jank with nested Columns and Rows inside ListView itemsadd an item to ListView.builder flutter firebasePrepend list view items while maintaining scroll view offset in Flutterflutter listView.Builder hide the divider on last list itemListView.builder scroll item by item in flutterHow to prevent widget re-render on ListView scrollKeep position in list with new items Flutter ListView










0















Need to track how much time spend by user on Item in a ListView Builder.
If user see that post more than 2sec, record that postID.



Issue is:



  1. how to know Current Item in View in List so I can start timer

  2. In List, current Item and above n below items also renders so how to avoid their tracking


  3. The In List current Item and above n below items also renders so how to avoid their tracking


  4. Height of each item might differ, i.e either like Instagram Post(Image +Text) or Only Text(almost half size of above image item)


I was using



 RenderObject listViewObject = globalKey.currentContext.findRenderObject();
RenderObject animatedBoxObject =
globalKey.currentContext.findRenderObject();
print('---11 didChangeDependencies $listViewObject $animatedBoxObject');
if (listViewObject != null || animatedBoxObject != null) {
print('---11 didChangeDependencies');
final listViewHeight = listViewObject.paintBounds.height;
print('---22 didChangeDependencies');
final animatedObjectTop =
animatedBoxObject.getTransformTo(listViewObject).getTranslation().y;

print('---33 didChangeDependencies');
final animatedBoxVisible =
(animatedObjectTop + globalKey.currentContext.size.height <
listViewHeight);

print('---$widget.index $animatedBoxVisible');

print('---$widget.index $globalKey.currentContext.size.height');
print('---$widget.index $MediaQuery.of(context).size.height');
print('---$widget.index $globalKey.currentContext.size.height < listViewHeight');
print('---$widget.index $Util.scrollController.offset');
print('---$widget.index $Util.scrollController.position.extentAfter');
print('---$widget.index $Util.scrollController.position.extentBefore');
print('---$widget.index $Util.scrollController.position.extentInside');


And to track time



 if (Util.timer != null && Util.timer.isActive) 
Util.timer.cancel();
Util.timer = Timer(Duration(seconds: 3), ()
// if(widget.index==0)
API.trackPost(Util.postList[widget.index].id, widget.index);
// API.trackPost(Util.postList[widget.index].id, widget.index);
);
else
Util.timer = Timer(Duration(seconds: 3), ()
API.trackPost(Util.postList[widget.index].id, widget.index);
);



enter image description here



enter image description here










share|improve this question




























    0















    Need to track how much time spend by user on Item in a ListView Builder.
    If user see that post more than 2sec, record that postID.



    Issue is:



    1. how to know Current Item in View in List so I can start timer

    2. In List, current Item and above n below items also renders so how to avoid their tracking


    3. The In List current Item and above n below items also renders so how to avoid their tracking


    4. Height of each item might differ, i.e either like Instagram Post(Image +Text) or Only Text(almost half size of above image item)


    I was using



     RenderObject listViewObject = globalKey.currentContext.findRenderObject();
    RenderObject animatedBoxObject =
    globalKey.currentContext.findRenderObject();
    print('---11 didChangeDependencies $listViewObject $animatedBoxObject');
    if (listViewObject != null || animatedBoxObject != null) {
    print('---11 didChangeDependencies');
    final listViewHeight = listViewObject.paintBounds.height;
    print('---22 didChangeDependencies');
    final animatedObjectTop =
    animatedBoxObject.getTransformTo(listViewObject).getTranslation().y;

    print('---33 didChangeDependencies');
    final animatedBoxVisible =
    (animatedObjectTop + globalKey.currentContext.size.height <
    listViewHeight);

    print('---$widget.index $animatedBoxVisible');

    print('---$widget.index $globalKey.currentContext.size.height');
    print('---$widget.index $MediaQuery.of(context).size.height');
    print('---$widget.index $globalKey.currentContext.size.height < listViewHeight');
    print('---$widget.index $Util.scrollController.offset');
    print('---$widget.index $Util.scrollController.position.extentAfter');
    print('---$widget.index $Util.scrollController.position.extentBefore');
    print('---$widget.index $Util.scrollController.position.extentInside');


    And to track time



     if (Util.timer != null && Util.timer.isActive) 
    Util.timer.cancel();
    Util.timer = Timer(Duration(seconds: 3), ()
    // if(widget.index==0)
    API.trackPost(Util.postList[widget.index].id, widget.index);
    // API.trackPost(Util.postList[widget.index].id, widget.index);
    );
    else
    Util.timer = Timer(Duration(seconds: 3), ()
    API.trackPost(Util.postList[widget.index].id, widget.index);
    );



    enter image description here



    enter image description here










    share|improve this question


























      0












      0








      0








      Need to track how much time spend by user on Item in a ListView Builder.
      If user see that post more than 2sec, record that postID.



      Issue is:



      1. how to know Current Item in View in List so I can start timer

      2. In List, current Item and above n below items also renders so how to avoid their tracking


      3. The In List current Item and above n below items also renders so how to avoid their tracking


      4. Height of each item might differ, i.e either like Instagram Post(Image +Text) or Only Text(almost half size of above image item)


      I was using



       RenderObject listViewObject = globalKey.currentContext.findRenderObject();
      RenderObject animatedBoxObject =
      globalKey.currentContext.findRenderObject();
      print('---11 didChangeDependencies $listViewObject $animatedBoxObject');
      if (listViewObject != null || animatedBoxObject != null) {
      print('---11 didChangeDependencies');
      final listViewHeight = listViewObject.paintBounds.height;
      print('---22 didChangeDependencies');
      final animatedObjectTop =
      animatedBoxObject.getTransformTo(listViewObject).getTranslation().y;

      print('---33 didChangeDependencies');
      final animatedBoxVisible =
      (animatedObjectTop + globalKey.currentContext.size.height <
      listViewHeight);

      print('---$widget.index $animatedBoxVisible');

      print('---$widget.index $globalKey.currentContext.size.height');
      print('---$widget.index $MediaQuery.of(context).size.height');
      print('---$widget.index $globalKey.currentContext.size.height < listViewHeight');
      print('---$widget.index $Util.scrollController.offset');
      print('---$widget.index $Util.scrollController.position.extentAfter');
      print('---$widget.index $Util.scrollController.position.extentBefore');
      print('---$widget.index $Util.scrollController.position.extentInside');


      And to track time



       if (Util.timer != null && Util.timer.isActive) 
      Util.timer.cancel();
      Util.timer = Timer(Duration(seconds: 3), ()
      // if(widget.index==0)
      API.trackPost(Util.postList[widget.index].id, widget.index);
      // API.trackPost(Util.postList[widget.index].id, widget.index);
      );
      else
      Util.timer = Timer(Duration(seconds: 3), ()
      API.trackPost(Util.postList[widget.index].id, widget.index);
      );



      enter image description here



      enter image description here










      share|improve this question
















      Need to track how much time spend by user on Item in a ListView Builder.
      If user see that post more than 2sec, record that postID.



      Issue is:



      1. how to know Current Item in View in List so I can start timer

      2. In List, current Item and above n below items also renders so how to avoid their tracking


      3. The In List current Item and above n below items also renders so how to avoid their tracking


      4. Height of each item might differ, i.e either like Instagram Post(Image +Text) or Only Text(almost half size of above image item)


      I was using



       RenderObject listViewObject = globalKey.currentContext.findRenderObject();
      RenderObject animatedBoxObject =
      globalKey.currentContext.findRenderObject();
      print('---11 didChangeDependencies $listViewObject $animatedBoxObject');
      if (listViewObject != null || animatedBoxObject != null) {
      print('---11 didChangeDependencies');
      final listViewHeight = listViewObject.paintBounds.height;
      print('---22 didChangeDependencies');
      final animatedObjectTop =
      animatedBoxObject.getTransformTo(listViewObject).getTranslation().y;

      print('---33 didChangeDependencies');
      final animatedBoxVisible =
      (animatedObjectTop + globalKey.currentContext.size.height <
      listViewHeight);

      print('---$widget.index $animatedBoxVisible');

      print('---$widget.index $globalKey.currentContext.size.height');
      print('---$widget.index $MediaQuery.of(context).size.height');
      print('---$widget.index $globalKey.currentContext.size.height < listViewHeight');
      print('---$widget.index $Util.scrollController.offset');
      print('---$widget.index $Util.scrollController.position.extentAfter');
      print('---$widget.index $Util.scrollController.position.extentBefore');
      print('---$widget.index $Util.scrollController.position.extentInside');


      And to track time



       if (Util.timer != null && Util.timer.isActive) 
      Util.timer.cancel();
      Util.timer = Timer(Duration(seconds: 3), ()
      // if(widget.index==0)
      API.trackPost(Util.postList[widget.index].id, widget.index);
      // API.trackPost(Util.postList[widget.index].id, widget.index);
      );
      else
      Util.timer = Timer(Duration(seconds: 3), ()
      API.trackPost(Util.postList[widget.index].id, widget.index);
      );



      enter image description here



      enter image description here







      android listview dart flutter






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 days ago









      Kiran Benny Joseph

      4,41712247




      4,41712247










      asked 2 days ago









      ShivamShivam

      11




      11






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023419%2fneed-to-track-time-on-current-item-position-in-view-by-user-in-listview-builder%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023419%2fneed-to-track-time-on-current-item-position-in-view-by-user-in-listview-builder%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко