From 54a4e0dae37190ea9359267a4371920f1b74d652 Mon Sep 17 00:00:00 2001
From: poka <poka@p2p.legal>
Date: Sun, 7 Feb 2021 17:25:51 +0100
Subject: [PATCH] Use hasPreviousPage correctly to check if we are on beginning
 of history

---
 lib/models/history.dart  | 3 ---
 lib/screens/history.dart | 4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/models/history.dart b/lib/models/history.dart
index 663e3d06..a82a4b4c 100644
--- a/lib/models/history.dart
+++ b/lib/models/history.dart
@@ -12,7 +12,6 @@ class HistoryProvider with ChangeNotifier {
   String pubkey = '';
   HistoryProvider(this.pubkey);
   final TextEditingController outputPubkey = TextEditingController();
-  bool isTheEnd = false;
   List transBC;
   bool isFirstBuild = true;
   String fetchMoreCursor;
@@ -158,10 +157,8 @@ class HistoryProvider with ChangeNotifier {
         "###### DEBUG H Parse blockchainTX list. Cursor: $fetchMoreCursor ######");
     if (fetchMoreCursor != null) {
       transBC = parseHistory(blockchainTX, _pubkey);
-      isTheEnd = false;
     } else {
       print("###### DEBUG H - Début de l'historique");
-      isTheEnd = true;
     }
 
     return opts;
diff --git a/lib/screens/history.dart b/lib/screens/history.dart
index 1b3f66e7..883068ca 100644
--- a/lib/screens/history.dart
+++ b/lib/screens/history.dart
@@ -233,7 +233,6 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
                       indent: 0,
                       endIndent: 0,
                     ),
-                    // !_historyProvider.pageInfo['hasPreviousPage'] //TODO: fix value of hasPreviousPage
                     _historyProvider.transBC == null
                         ? Text('Aucune transaction à afficher.')
                         : loopTransactions(context, result),
@@ -292,7 +291,8 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
             CircularProgressIndicator(),
           ],
         ),
-      if (_historyProvider.isTheEnd)
+      // if (_historyProvider.isTheEnd) // What I did before ...
+      if (!_historyProvider.pageInfo['hasPreviousPage'])
         Column(children: <Widget>[
           SizedBox(height: 15),
           Text("Début de l'historique.",
-- 
GitLab