Add debug for history Query state
This commit is contained in:
parent
d80b1190ae
commit
4d9730739c
|
@ -11,10 +11,11 @@ import 'package:intl/intl.dart';
|
|||
class HistoryProvider with ChangeNotifier {
|
||||
String pubkey = '';
|
||||
HistoryProvider(this.pubkey);
|
||||
final TextEditingController outputPubkey = new TextEditingController();
|
||||
final TextEditingController outputPubkey = TextEditingController();
|
||||
bool isTheEnd = false;
|
||||
List transBC;
|
||||
bool isFirstBuild = true;
|
||||
String fetchMoreCursor;
|
||||
|
||||
Future scan() async {
|
||||
await Permission.camera.request();
|
||||
|
@ -131,7 +132,9 @@ class HistoryProvider with ChangeNotifier {
|
|||
|
||||
final Map pageInfo = result.data['txsHistoryBc']['both']['pageInfo'];
|
||||
|
||||
final String fetchMoreCursor = pageInfo['endCursor'];
|
||||
fetchMoreCursor = pageInfo['endCursor'];
|
||||
print(pageInfo['hasPreviousPage']);
|
||||
print(pageInfo['hasNextPage']);
|
||||
|
||||
if (fetchMoreCursor != null) {
|
||||
opts = FetchMoreOptions(
|
||||
|
|
|
@ -90,6 +90,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
CesiumPlusProvider _cesiumPlusProvider =
|
||||
Provider.of<CesiumPlusProvider>(context);
|
||||
print("I'M HERE 1");
|
||||
bool _isFirstExec = true;
|
||||
return Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
|
@ -105,8 +106,8 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
},
|
||||
),
|
||||
builder: (QueryResult result, {fetchMore, refetch}) {
|
||||
print("I'M HERE 2 !");
|
||||
print(result.source.isEager);
|
||||
print("I'M HERE 2 ! $_isFirstExec");
|
||||
// print(result.source.isEager);
|
||||
|
||||
if (result.isLoading && result.data == null) {
|
||||
print("I'M HERE 3 !");
|
||||
|
@ -136,6 +137,8 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
opts = _historyProvider.checkQueryResult(
|
||||
result, opts, _outputPubkey.text);
|
||||
|
||||
// _historyProvider.transBC = null;
|
||||
|
||||
// Build history list
|
||||
return NotificationListener(
|
||||
child: Expanded(
|
||||
|
@ -149,45 +152,48 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.only(left: 30),
|
||||
child: FutureBuilder(
|
||||
future: _cesiumPlusProvider
|
||||
.getAvatar(_historyProvider.pubkey),
|
||||
initialData: [
|
||||
File(appPath.path + '/default_avatar.png')
|
||||
],
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List> _avatar) {
|
||||
cesiumData = _avatar.data;
|
||||
// _cesiumPlusProvider.isComplete = true;
|
||||
if (_avatar.connectionState !=
|
||||
ConnectionState.done) {
|
||||
if (_isFirstExec)
|
||||
Container(
|
||||
padding: const EdgeInsets.only(left: 30),
|
||||
child: FutureBuilder(
|
||||
future: _cesiumPlusProvider
|
||||
.getAvatar(_historyProvider.pubkey),
|
||||
initialData: [
|
||||
File(appPath.path +
|
||||
'/default_avatar.png')
|
||||
],
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List> _avatar) {
|
||||
cesiumData = _avatar.data;
|
||||
// _cesiumPlusProvider.isComplete = true;
|
||||
if (_avatar.connectionState !=
|
||||
ConnectionState.done) {
|
||||
return Image.file(
|
||||
File(appPath.path +
|
||||
'/default_avatar.png'),
|
||||
height: 65);
|
||||
}
|
||||
if (_avatar.hasError) {
|
||||
return Image.file(
|
||||
File(appPath.path +
|
||||
'/default_avatar.png'),
|
||||
height: 65);
|
||||
}
|
||||
if (_avatar.hasData) {
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.all(0.0),
|
||||
child: Image.file(_avatar.data[0],
|
||||
height: 65));
|
||||
}
|
||||
return Image.file(
|
||||
File(appPath.path +
|
||||
'/default_avatar.png'),
|
||||
height: 65);
|
||||
}
|
||||
if (_avatar.hasError) {
|
||||
return Image.file(
|
||||
File(appPath.path +
|
||||
'/default_avatar.png'),
|
||||
height: 65);
|
||||
}
|
||||
if (_avatar.hasData) {
|
||||
return SingleChildScrollView(
|
||||
padding: EdgeInsets.all(0.0),
|
||||
child: Image.file(_avatar.data[0],
|
||||
height: 65));
|
||||
}
|
||||
return Image.file(
|
||||
File(appPath.path +
|
||||
'/default_avatar.png'),
|
||||
height: 65);
|
||||
})),
|
||||
Text(balance.toString() + ' Ğ1',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 30.0)),
|
||||
})),
|
||||
if (_isFirstExec)
|
||||
Text(balance.toString() + ' Ğ1',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 30.0)),
|
||||
Container(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
30, 0, 15, 0), // .only(right: 15),
|
||||
|
@ -204,20 +210,21 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
|||
color: Color(0xFFB16E16)))
|
||||
]),
|
||||
SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
// padding: const EdgeInsets.,
|
||||
child: FutureBuilder(
|
||||
future: _cesiumPlusProvider
|
||||
.getName(_historyProvider.pubkey),
|
||||
initialData: '',
|
||||
builder: (context, snapshot) {
|
||||
return Text(snapshot.data);
|
||||
}))
|
||||
]),
|
||||
if (_isFirstExec)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
// padding: const EdgeInsets.,
|
||||
child: FutureBuilder(
|
||||
future: _cesiumPlusProvider
|
||||
.getName(_historyProvider.pubkey),
|
||||
initialData: '',
|
||||
builder: (context, snapshot) {
|
||||
return Text(snapshot.data);
|
||||
}))
|
||||
]),
|
||||
SizedBox(height: 20),
|
||||
const Divider(
|
||||
color: Colors.grey,
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:gecko/models/generateWallets.dart';
|
||||
import 'package:gecko/models/walletOptions.dart';
|
||||
import 'package:gecko/screens/myWallets/confirmWalletStorage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:printing/printing.dart';
|
||||
|
@ -21,6 +23,8 @@ class GenerateWalletsScreen extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
GenerateWalletsProvider _generateWalletProvider =
|
||||
Provider.of<GenerateWalletsProvider>(context);
|
||||
WalletOptionsProvider _walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context);
|
||||
_generateWalletProvider.generateMnemonic();
|
||||
print('IS GENERATED ? : ' +
|
||||
_generateWalletProvider.walletIsGenerated.toString());
|
||||
|
@ -45,103 +49,112 @@ class GenerateWalletsScreen extends StatelessWidget {
|
|||
backgroundColor: Color(
|
||||
0xffEFEFBF), //Color(0xffFFD68E), //Color.fromARGB(500, 204, 255, 255),
|
||||
))),
|
||||
body: SafeArea(
|
||||
child: Column(children: <Widget>[
|
||||
SizedBox(height: 20),
|
||||
toolTips(_toolTipPubkey, 'Clé publique:',
|
||||
"C'est votre RIB en Ğ1, les gens l'utiliseront pour vous payer"),
|
||||
TextField(
|
||||
enabled: false,
|
||||
controller: _generateWalletProvider.pubkey,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
decoration: InputDecoration(),
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Monospace')),
|
||||
SizedBox(height: 8),
|
||||
toolTips(_toolTipSentence, 'Phrase de restauration:',
|
||||
"Notez et gardez cette phrase précieusement sur un papier, elle vous servira à restaurer votre portefeuille sur un autre appareil"),
|
||||
TextField(
|
||||
enabled: false,
|
||||
controller: _generateWalletProvider.mnemonicController,
|
||||
maxLines: 3,
|
||||
textAlign: TextAlign.center,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.all(15.0),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 22.0,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w400)),
|
||||
SizedBox(height: 8),
|
||||
toolTips(_toolTipSecret, 'Code secret:',
|
||||
"Retenez bien votre code secret, il vous sera demandé à chaque paiement, ainsi que pour configurer votre portefeuille"),
|
||||
Container(
|
||||
child: Stack(
|
||||
alignment: Alignment.centerRight,
|
||||
children: <Widget>[
|
||||
TextField(
|
||||
enabled: false,
|
||||
controller: _generateWalletProvider.pin,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
decoration: InputDecoration(),
|
||||
style: TextStyle(
|
||||
fontSize: 30.0,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold)),
|
||||
IconButton(
|
||||
icon: Icon(Icons.replay),
|
||||
color: Color(0xffD28928),
|
||||
onPressed: () {
|
||||
_generateWalletProvider.changePinCode();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
new ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Color(0xffFFD68E), // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: _generateWalletProvider.walletIsGenerated
|
||||
? () {
|
||||
_generateWalletProvider.nbrWord =
|
||||
_generateWalletProvider.getRandomInt();
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return ConfirmStoreWallet(
|
||||
generatedMnemonic:
|
||||
_generateWalletProvider.generatedMnemonic,
|
||||
generatedWallet:
|
||||
_generateWalletProvider.actualWallet);
|
||||
}),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: Text('Enregistrer ce portefeuille',
|
||||
style: TextStyle(fontSize: 20))),
|
||||
SizedBox(height: 20),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return PrintWallet(
|
||||
_generateWalletProvider.generatedMnemonic,
|
||||
_generateWalletProvider.actualWallet.publicKey);
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.print))
|
||||
]),
|
||||
));
|
||||
body: Builder(
|
||||
builder: (ctx) => SafeArea(
|
||||
child: Column(children: <Widget>[
|
||||
SizedBox(height: 20),
|
||||
toolTips(_toolTipPubkey, 'Clé publique:',
|
||||
"C'est votre RIB en Ğ1, les gens l'utiliseront pour vous payer"),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: _generateWalletProvider.pubkey.text));
|
||||
_walletOptions.snackCopyKey(ctx);
|
||||
},
|
||||
child: TextField(
|
||||
enabled: false,
|
||||
controller: _generateWalletProvider.pubkey,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
decoration: InputDecoration(),
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontFamily: 'Monospace'))),
|
||||
SizedBox(height: 8),
|
||||
toolTips(_toolTipSentence, 'Phrase de restauration:',
|
||||
"Notez et gardez cette phrase précieusement sur un papier, elle vous servira à restaurer votre portefeuille sur un autre appareil"),
|
||||
TextField(
|
||||
enabled: false,
|
||||
controller: _generateWalletProvider.mnemonicController,
|
||||
maxLines: 3,
|
||||
textAlign: TextAlign.center,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.all(15.0),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 22.0,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w400)),
|
||||
SizedBox(height: 8),
|
||||
toolTips(_toolTipSecret, 'Code secret:',
|
||||
"Retenez bien votre code secret, il vous sera demandé à chaque paiement, ainsi que pour configurer votre portefeuille"),
|
||||
Container(
|
||||
child: Stack(
|
||||
alignment: Alignment.centerRight,
|
||||
children: <Widget>[
|
||||
TextField(
|
||||
enabled: false,
|
||||
controller: _generateWalletProvider.pin,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
decoration: InputDecoration(),
|
||||
style: TextStyle(
|
||||
fontSize: 30.0,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold)),
|
||||
IconButton(
|
||||
icon: Icon(Icons.replay),
|
||||
color: Color(0xffD28928),
|
||||
onPressed: () {
|
||||
_generateWalletProvider.changePinCode();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
new ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Color(0xffFFD68E), // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: _generateWalletProvider.walletIsGenerated
|
||||
? () {
|
||||
_generateWalletProvider.nbrWord =
|
||||
_generateWalletProvider.getRandomInt();
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return ConfirmStoreWallet(
|
||||
generatedMnemonic:
|
||||
_generateWalletProvider
|
||||
.generatedMnemonic,
|
||||
generatedWallet: _generateWalletProvider
|
||||
.actualWallet);
|
||||
}),
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: Text('Enregistrer ce portefeuille',
|
||||
style: TextStyle(fontSize: 20))),
|
||||
SizedBox(height: 20),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return PrintWallet(
|
||||
_generateWalletProvider.generatedMnemonic,
|
||||
_generateWalletProvider
|
||||
.actualWallet.publicKey);
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.print))
|
||||
]),
|
||||
)));
|
||||
}
|
||||
|
||||
Widget toolTips(_key, _text, _message) {
|
||||
|
|
Loading…
Reference in New Issue