title: How can I implement a lazy-loading PageView in Flutter?
body: <p><strong>Background</strong></p>
  <p>I currently have a home screen where you can see a list of diary entries for a given date. This is done using a <code>ListView</code>. To navigate through different dates, I've implemented a skip left and right button which subtracts a day and adds a day respectively. Whenever the date changes, I use the new date to retrieve the saved diary entries from Firestore and call <code>setState</code> to rebuild the screen.</p>
  <p><strong>Objective</strong></p>
  <p>I would like to change the implementation so that the user can swipe the <code>ListView</code> to the left or to the right to navigate through the dates.</p>
  <p><strong>Problem</strong></p>
  <p>I've tried using <code>PageView</code> to accomplish this by pre-loading diary entries for the day before and after the current date. I kept track of 3 days of entries in a list with which I built the <code>PageView</code>. When the date changes (i.e. when the user swipes left or right), I load in a new date and remove the farthest date. Doing so calls <code>setState</code>, which in turn makes the screen refresh, cutting off the smooth scroll into the new date.</p>
  <p>How can I change my approach to make this work?</p>
  <p><a href="https://i.stack.imgur.com/xHhln.gif" rel="nofollow noreferrer">How the app currently works</a></p>
  <p><a href="https://i.stack.imgur.com/KZiSN.gif" rel="nofollow noreferrer">How the app is having with <code>PageView</code> (slower animation)</a></p>