Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ğecko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
Ğecko
Commits
82a17df4
Commit
82a17df4
authored
4 years ago
by
poka
Browse files
Options
Downloads
Patches
Plain Diff
More split between history view and model
parent
267a3e0b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/models/history.dart
+42
-0
42 additions, 0 deletions
lib/models/history.dart
lib/screens/history.dart
+4
-41
4 additions, 41 deletions
lib/screens/history.dart
with
46 additions
and
41 deletions
lib/models/history.dart
+
42
−
0
View file @
82a17df4
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:graphql_flutter/graphql_flutter.dart'
;
import
'package:permission_handler/permission_handler.dart'
;
import
'package:sentry/sentry.dart'
as
sentry
;
import
'package:qrscan/qrscan.dart'
as
scanner
;
...
...
@@ -10,6 +11,9 @@ class HistoryProvider with ChangeNotifier {
String
pubkey
=
''
;
HistoryProvider
(
this
.
pubkey
);
final
TextEditingController
_outputPubkey
=
new
TextEditingController
();
bool
isTheEnd
=
false
;
List
transBC
;
// String pubkey = 'D2meevcAHFTS2gQMvmRW5Hzi25jDdikk4nC4u1FkwRaU'; // For debug
Future
scan
()
async
{
...
...
@@ -105,6 +109,44 @@ class HistoryProvider with ChangeNotifier {
return
transBC
;
}
FetchMoreOptions
checkQueryResult
(
result
,
opts
)
{
final
List
<
dynamic
>
blockchainTX
=
(
result
.
data
[
'txsHistoryBc'
][
'both'
][
'edges'
]
as
List
<
dynamic
>);
final
Map
pageInfo
=
result
.
data
[
'txsHistoryBc'
][
'both'
][
'pageInfo'
];
final
String
fetchMoreCursor
=
pageInfo
[
'endCursor'
];
if
(
fetchMoreCursor
!=
null
)
{
opts
=
FetchMoreOptions
(
variables:
{
'cursor'
:
fetchMoreCursor
},
updateQuery:
(
previousResultData
,
fetchMoreResultData
)
{
final
List
<
dynamic
>
repos
=
[
..
.
previousResultData
[
'txsHistoryBc'
][
'both'
][
'edges'
]
as
List
<
dynamic
>,
..
.
fetchMoreResultData
[
'txsHistoryBc'
][
'both'
][
'edges'
]
as
List
<
dynamic
>
];
fetchMoreResultData
[
'txsHistoryBc'
][
'both'
][
'edges'
]
=
repos
;
return
fetchMoreResultData
;
},
);
}
print
(
"###### DEBUG H Parse blockchainTX list. Cursor:
$fetchMoreCursor
######"
);
if
(
fetchMoreCursor
!=
null
)
{
transBC
=
parseHistory
(
blockchainTX
);
isTheEnd
=
false
;
}
else
{
print
(
"###### DEBUG H - Début de l'historique"
);
isTheEnd
=
true
;
}
return
opts
;
}
void
resetdHistory
()
{
this
.
_outputPubkey
.
text
=
''
;
notifyListeners
();
...
...
This diff is collapsed.
Click to expand it.
lib/screens/history.dart
+
4
−
41
View file @
82a17df4
...
...
@@ -14,8 +14,6 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
ScrollController
scrollController
=
ScrollController
();
final
nRepositories
=
20
;
// HistoryProvider _historyProvider;
bool
isTheEnd
=
false
;
List
_transBC
;
final
_formKey
=
GlobalKey
<
FormState
>();
FocusNode
_pubkeyFocus
=
FocusNode
();
...
...
@@ -114,45 +112,10 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
return
const
Text
(
'Aucune donnée à afficher.'
);
}
final
List
<
dynamic
>
blockchainTX
=
(
result
.
data
[
'txsHistoryBc'
][
'both'
][
'edges'
]
as
List
<
dynamic
>);
final
Map
pageInfo
=
result
.
data
[
'txsHistoryBc'
][
'both'
][
'pageInfo'
];
final
String
fetchMoreCursor
=
pageInfo
[
'endCursor'
];
final
num
balance
=
_historyProvider
.
removeDecimalZero
(
result
.
data
[
'balance'
][
'amount'
]
/
100
);
if
(
fetchMoreCursor
!=
null
)
{
opts
=
FetchMoreOptions
(
variables:
{
'cursor'
:
fetchMoreCursor
},
updateQuery:
(
previousResultData
,
fetchMoreResultData
)
{
final
List
<
dynamic
>
repos
=
[
..
.
previousResultData
[
'txsHistoryBc'
][
'both'
][
'edges'
]
as
List
<
dynamic
>,
..
.
fetchMoreResultData
[
'txsHistoryBc'
][
'both'
][
'edges'
]
as
List
<
dynamic
>
];
fetchMoreResultData
[
'txsHistoryBc'
][
'both'
][
'edges'
]
=
repos
;
return
fetchMoreResultData
;
},
);
}
print
(
"###### DEBUG H Parse blockchainTX list. Cursor:
$fetchMoreCursor
######"
);
if
(
fetchMoreCursor
!=
null
)
{
_transBC
=
_historyProvider
.
parseHistory
(
blockchainTX
);
isTheEnd
=
false
;
}
else
{
print
(
"###### DEBUG H - Début de l'historique"
);
isTheEnd
=
true
;
}
// _historyProvider.resetdHistory();
opts
=
_historyProvider
.
checkQueryResult
(
result
,
opts
);
// Build history list
return
NotificationListener
(
...
...
@@ -191,7 +154,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
indent:
0
,
endIndent:
0
,
),
_transBC
==
null
_
historyProvider
.
transBC
==
null
?
Text
(
'Aucune transaction à afficher.'
)
:
loopTransactions
(
context
,
result
),
],
...
...
@@ -214,7 +177,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
HistoryProvider
_historyProvider
=
Provider
.
of
<
HistoryProvider
>(
context
);
return
Column
(
children:
<
Widget
>[
for
(
var
repository
in
_transBC
)
for
(
var
repository
in
_
historyProvider
.
transBC
)
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
8.0
),
child:
ListTile
(
...
...
@@ -249,7 +212,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
CircularProgressIndicator
(),
],
),
if
(
isTheEnd
)
if
(
_historyProvider
.
isTheEnd
)
Column
(
children:
<
Widget
>[
SizedBox
(
height:
15
),
Text
(
"Début de l'historique."
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment