feat: add certifications up and down; Check if wallet exist in wallet_view
This commit is contained in:
parent
1eb966046c
commit
1cd3f74c6c
|
@ -219,11 +219,16 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
.evalJavascript('api.query.cert.storageIdtyCertMeta($idtyIndex)') ??
|
.evalJavascript('api.query.cert.storageIdtyCertMeta($idtyIndex)') ??
|
||||||
[];
|
[];
|
||||||
|
|
||||||
log.d(_certsReceiver['receivedCount']);
|
|
||||||
|
|
||||||
return [_certsReceiver['receivedCount'], _certsReceiver['issuedCount']];
|
return [_certsReceiver['receivedCount'], _certsReceiver['issuedCount']];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> isAccountExit(String address) async {
|
||||||
|
final _accountInfo = await sdk.webView!
|
||||||
|
.evalJavascript('api.query.system.account("$address")');
|
||||||
|
final _randomId = _accountInfo['data']['randomId'];
|
||||||
|
return _randomId == null ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
Future<double> getBalance(String address, {bool isUd = false}) async {
|
Future<double> getBalance(String address, {bool isUd = false}) async {
|
||||||
double balance = 0.0;
|
double balance = 0.0;
|
||||||
if (nodeConnected) {
|
if (nodeConnected) {
|
||||||
|
|
|
@ -108,6 +108,15 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
|
|
||||||
Widget idtyStatus(BuildContext context, String address,
|
Widget idtyStatus(BuildContext context, String address,
|
||||||
{bool isOwner = false}) {
|
{bool isOwner = false}) {
|
||||||
|
_showText(String text, [double size = 18, bool _bold = false]) => Text(
|
||||||
|
text,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: size,
|
||||||
|
color: _bold ? orangeC : Colors.black,
|
||||||
|
fontWeight: _bold ? FontWeight.w500 : FontWeight.w400),
|
||||||
|
);
|
||||||
|
|
||||||
return Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
return Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
||||||
return FutureBuilder(
|
return FutureBuilder(
|
||||||
future: _sub.idtyStatus(address),
|
future: _sub.idtyStatus(address),
|
||||||
|
@ -116,70 +125,39 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
switch (snapshot.data.toString()) {
|
switch (snapshot.data.toString()) {
|
||||||
case 'noid':
|
case 'noid':
|
||||||
{
|
{
|
||||||
return Column(children: const <Widget>[
|
return _showText('Aucune identité');
|
||||||
Text(
|
|
||||||
'Aucune identité',
|
|
||||||
style: TextStyle(fontSize: 18, color: Colors.black),
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
case 'Created':
|
case 'Created':
|
||||||
{
|
{
|
||||||
return Column(children: <Widget>[
|
return isOwner
|
||||||
isOwner
|
? InkWell(
|
||||||
? InkWell(
|
child: _showText(
|
||||||
child: const Text(
|
'Cliquez ici pour confirmer\nvotre nouvelle identité',
|
||||||
'Identité créé, cliquez pour la confirmer',
|
18,
|
||||||
style:
|
true),
|
||||||
TextStyle(fontSize: 18, color: Colors.black),
|
onTap: () async {
|
||||||
),
|
await validateIdentity(context);
|
||||||
onTap: () async {
|
},
|
||||||
await validateIdentity(context);
|
)
|
||||||
},
|
: _showText('Identité créé');
|
||||||
)
|
|
||||||
: const Text(
|
|
||||||
'Identité créé',
|
|
||||||
style: TextStyle(fontSize: 18, color: Colors.black),
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
case 'ConfirmedByOwner':
|
case 'ConfirmedByOwner':
|
||||||
{
|
{
|
||||||
return Column(children: const <Widget>[
|
return _showText('Identité confirmé');
|
||||||
Text(
|
|
||||||
'Identité confirmé',
|
|
||||||
style: TextStyle(fontSize: 18, color: Colors.black),
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'Validated':
|
case 'Validated':
|
||||||
{
|
{
|
||||||
return Column(children: const <Widget>[
|
return _showText('Membre validé !');
|
||||||
Text(
|
|
||||||
'Membre validé !',
|
|
||||||
style: TextStyle(fontSize: 18, color: Colors.black),
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'expired':
|
case 'expired':
|
||||||
{
|
{
|
||||||
return Column(children: const <Widget>[
|
return _showText('Identité expiré');
|
||||||
Text(
|
|
||||||
'Identité expiré',
|
|
||||||
style: TextStyle(fontSize: 18, color: Colors.black),
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
child: Column(children: const <Widget>[
|
child: _showText('Statut inconnu'),
|
||||||
Text(
|
|
||||||
'Statut inconnu',
|
|
||||||
style: TextStyle(fontSize: 18, color: Colors.black),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -198,29 +176,60 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
barrierDismissible: true, // user must tap button!
|
barrierDismissible: true, // user must tap button!
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('Confirmez votre identité'),
|
title: const Text(
|
||||||
|
'Confirmez votre identité',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
height: 100,
|
height: 100,
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
const Text('Nom:'),
|
const SizedBox(height: 20),
|
||||||
|
const Text(
|
||||||
|
'Nom:',
|
||||||
|
style: TextStyle(fontSize: 19),
|
||||||
|
),
|
||||||
TextField(
|
TextField(
|
||||||
|
onChanged: (_) => notifyListeners(),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
controller: idtyName,
|
controller: idtyName,
|
||||||
|
style: const TextStyle(fontSize: 19),
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
Row(
|
||||||
child: const Text("Valider"),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
onPressed: () async {
|
children: [
|
||||||
final _wallet =
|
Consumer<WalletOptionsProvider>(
|
||||||
_myWalletProvider.getWalletDataByAddress(address.text);
|
builder: (context, _wOptions, _) {
|
||||||
await _sub.setCurrentWallet(_wallet!);
|
return TextButton(
|
||||||
_sub.confirmIdentity(_walletOptions.address.text, idtyName.text,
|
key: const Key('infoPopup'),
|
||||||
_myWalletProvider.pinCode);
|
child: Text(
|
||||||
Navigator.pop(context);
|
"Valider",
|
||||||
},
|
style: TextStyle(
|
||||||
|
fontSize: 21,
|
||||||
|
color: idtyName.text.length >= 2
|
||||||
|
? const Color(0xffD80000)
|
||||||
|
: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
if (idtyName.text.length >= 2) {
|
||||||
|
final _wallet = _myWalletProvider
|
||||||
|
.getWalletDataByAddress(address.text);
|
||||||
|
await _sub.setCurrentWallet(_wallet!);
|
||||||
|
_sub.confirmIdentity(_walletOptions.address.text,
|
||||||
|
idtyName.text, _myWalletProvider.pinCode);
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
})
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 20)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -291,42 +300,34 @@ Widget balance(BuildContext context, String address, double size,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> certCache = {};
|
|
||||||
Widget getCerts(BuildContext context, String address, double size,
|
Widget getCerts(BuildContext context, String address, double size,
|
||||||
[Color _color = Colors.black]) {
|
[Color _color = Colors.black]) {
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sdk, _) {
|
Consumer<SubstrateSdk>(builder: (context, _sdk, _) {
|
||||||
return FutureBuilder(
|
return FutureBuilder(
|
||||||
future: _sdk.getCerts(address),
|
future: _sdk.getCerts(address),
|
||||||
builder: (BuildContext context, AsyncSnapshot<List?>? _certs) {
|
builder: (BuildContext context, AsyncSnapshot<List<int>> _certs) {
|
||||||
if (_certs!.connectionState != ConnectionState.done ||
|
// log.d(_certs.data);
|
||||||
_certs.hasError) {
|
|
||||||
if (certCache[address] != null) {
|
|
||||||
return Text(certCache[address]!,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: isTall ? size : size * 0.9, color: _color));
|
|
||||||
} else {
|
|
||||||
return SizedBox(
|
|
||||||
height: 15,
|
|
||||||
width: 15,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
color: orangeC,
|
|
||||||
strokeWidth: 2,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
certCache[address] = _certs.data![0] != 0
|
|
||||||
? "Certifications reçus: ${_certs.data![0].toString()}\nCertifications envoyés: ${_certs.data![1].toString()}"
|
|
||||||
: '';
|
|
||||||
|
|
||||||
return Text(
|
return _certs.data?[0] != 0
|
||||||
certCache[address]!,
|
? Row(
|
||||||
style: TextStyle(
|
children: [
|
||||||
fontSize: isTall ? size : size * 0.9,
|
const Icon(
|
||||||
color: _color,
|
Icons.arrow_drop_down,
|
||||||
),
|
color: Colors.green,
|
||||||
);
|
size: 30,
|
||||||
|
),
|
||||||
|
Text(_certs.data?[0].toString() ?? '0'),
|
||||||
|
const SizedBox(width: 15),
|
||||||
|
const Icon(
|
||||||
|
Icons.arrow_drop_up,
|
||||||
|
color: Colors.blue,
|
||||||
|
size: 30,
|
||||||
|
),
|
||||||
|
Text(_certs.data?[1].toString() ?? '0')
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: const Text('');
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -91,36 +91,27 @@ class WalletOptions extends StatelessWidget {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const Spacer(flex: 5),
|
const Spacer(flex: 1),
|
||||||
avatar(walletProvider),
|
avatar(walletProvider),
|
||||||
// const Spacer(flex: 1),
|
const Spacer(flex: 1),
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
walletName(walletProvider, _walletOptions),
|
walletName(walletProvider, _walletOptions),
|
||||||
SizedBox(height: isTall ? 5 : 0),
|
SizedBox(height: isTall ? 5 : 0),
|
||||||
SizedBox(
|
// SizedBox(height: isTall ? 5 : 0),
|
||||||
width: 350,
|
balance(context, walletProvider.address.text, 21),
|
||||||
child: Row(
|
const SizedBox(width: 30),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
// SizedBox(height: isTall ? 5 : 0),
|
children: [
|
||||||
balance(
|
_walletOptions.idtyStatus(
|
||||||
context, walletProvider.address.text, 21),
|
context, _walletOptions.address.text,
|
||||||
const SizedBox(width: 30),
|
isOwner: true),
|
||||||
Column(
|
getCerts(
|
||||||
crossAxisAlignment:
|
context, walletProvider.address.text, 15),
|
||||||
CrossAxisAlignment.start,
|
]),
|
||||||
children: [
|
|
||||||
_walletOptions.idtyStatus(context,
|
|
||||||
_walletOptions.address.text,
|
|
||||||
isOwner: true),
|
|
||||||
getCerts(context,
|
|
||||||
walletProvider.address.text, 15),
|
|
||||||
]),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
SizedBox(height: 10 * ratio),
|
SizedBox(height: 10 * ratio),
|
||||||
]),
|
]),
|
||||||
const Spacer(flex: 1),
|
const Spacer(flex: 2),
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -59,7 +59,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
headerProfileView(
|
headerProfileView(
|
||||||
context, _walletViewProvider, _cesiumPlusProvider),
|
context, _walletViewProvider, _cesiumPlusProvider),
|
||||||
SizedBox(height: isTall ? 50 : 20),
|
SizedBox(height: isTall ? 10 : 0),
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
@ -570,199 +570,208 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
|
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider _walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
return Column(children: <Widget>[
|
// AsyncSnapshot<bool> isAccountExist;
|
||||||
Container(
|
|
||||||
height: 10,
|
|
||||||
color: yellowC,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
gradient: LinearGradient(
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
colors: [
|
|
||||||
yellowC,
|
|
||||||
const Color(0xFFE7811A),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 30, right: 40),
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
Row(children: [
|
|
||||||
GestureDetector(
|
|
||||||
key: const Key('copyPubkey'),
|
|
||||||
onTap: () {
|
|
||||||
Clipboard.setData(ClipboardData(text: pubkey));
|
|
||||||
snackCopyKey(context);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
getShortPubkey(pubkey!),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 30,
|
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
|
|
||||||
balance(context, pubkey!, 22),
|
return Stack(children: <Widget>[
|
||||||
const SizedBox(height: 10),
|
FutureBuilder(
|
||||||
_walletOptions.idtyStatus(context, pubkey!, isOwner: false),
|
future: _sub.isAccountExit(pubkey!),
|
||||||
getCerts(context, pubkey!, 14),
|
builder: (BuildContext context, AsyncSnapshot<bool> isAccountExist) {
|
||||||
|
final bool _isExit = isAccountExist.data ?? false;
|
||||||
// if (username == null &&
|
return Container(
|
||||||
// g1WalletsBox.get(pubkey)?.username == null)
|
height: 180,
|
||||||
// Query(
|
decoration: BoxDecoration(
|
||||||
// options: QueryOptions(
|
gradient: LinearGradient(
|
||||||
// document: gql(getId),
|
begin: Alignment.topCenter,
|
||||||
// variables: {
|
end: Alignment.bottomCenter,
|
||||||
// 'pubkey': pubkey,
|
colors: [
|
||||||
// },
|
_isExit ? yellowC : Colors.grey[400]!,
|
||||||
// ),
|
_isExit ? const Color(0xFFE7811A) : Colors.grey[600]!,
|
||||||
// builder: (QueryResult result,
|
],
|
||||||
// {VoidCallback? refetch, FetchMore? fetchMore}) {
|
),
|
||||||
// if (result.isLoading || result.hasException) {
|
));
|
||||||
// return const Text('...');
|
}),
|
||||||
// } else if (result.data!['idty'] == null ||
|
Padding(
|
||||||
// result.data!['idty']['username'] == null) {
|
padding: const EdgeInsets.only(left: 30, right: 40),
|
||||||
// g1WalletsBox.get(pubkey)?.username = '';
|
child: Row(children: <Widget>[
|
||||||
// return const Text('');
|
Column(
|
||||||
// } else {
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// g1WalletsBox.get(pubkey)?.username =
|
children: <Widget>[
|
||||||
// result.data!['idty']['username'] ?? '';
|
Container(
|
||||||
// return SizedBox(
|
height: 10,
|
||||||
// width: 230,
|
color: yellowC, // Colors.grey[400],
|
||||||
// child: Text(
|
|
||||||
// result.data!['idty']['username'] ?? '',
|
|
||||||
// style: const TextStyle(
|
|
||||||
// fontSize: 27,
|
|
||||||
// color: Color(0xff814C00),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
if (username == null &&
|
|
||||||
g1WalletsBox.get(pubkey)?.username != null)
|
|
||||||
SizedBox(
|
|
||||||
width: 230,
|
|
||||||
child: Text(
|
|
||||||
g1WalletsBox.get(pubkey)?.username ?? '',
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 27,
|
|
||||||
color: Color(0xff814C00),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (username != null)
|
|
||||||
SizedBox(
|
|
||||||
width: 230,
|
|
||||||
child: Text(
|
|
||||||
username!,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 27,
|
|
||||||
color: Color(0xff814C00),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
//// To get Cs+ name
|
|
||||||
// FutureBuilder(
|
|
||||||
// future: _cesiumPlusProvider.getName(pubkey),
|
|
||||||
// initialData: '...',
|
|
||||||
// builder: (context, snapshot) {
|
|
||||||
// return SizedBox(
|
|
||||||
// width: 230,
|
|
||||||
// child: Text(
|
|
||||||
// snapshot.data.toString(),
|
|
||||||
// style: const TextStyle(
|
|
||||||
// fontSize: 18, color: Colors.black),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }),
|
|
||||||
const SizedBox(height: 30),
|
|
||||||
]),
|
|
||||||
const Spacer(),
|
|
||||||
Column(children: <Widget>[
|
|
||||||
if (avatar == null)
|
|
||||||
ClipOval(
|
|
||||||
child: _cesiumPlusProvider.defaultAvatar(_avatarSize),
|
|
||||||
),
|
),
|
||||||
// FutureBuilder(
|
Row(children: [
|
||||||
// future: _cesiumPlusProvider.getAvatar(pubkey, _avatarSize),
|
GestureDetector(
|
||||||
// builder:
|
key: const Key('copyPubkey'),
|
||||||
// (BuildContext context, AsyncSnapshot<Image?> _avatar) {
|
onTap: () {
|
||||||
// if (_avatar.connectionState != ConnectionState.done) {
|
Clipboard.setData(ClipboardData(text: pubkey));
|
||||||
// return Stack(children: [
|
snackCopyKey(context);
|
||||||
// ClipOval(
|
},
|
||||||
// child:
|
child: Text(
|
||||||
// _cesiumPlusProvider.defaultAvatar(_avatarSize),
|
getShortPubkey(pubkey!),
|
||||||
// ),
|
style: const TextStyle(
|
||||||
// Positioned(
|
fontSize: 30,
|
||||||
// top: 15,
|
fontWeight: FontWeight.w800,
|
||||||
// right: 45,
|
),
|
||||||
// width: 51,
|
|
||||||
// height: 51,
|
|
||||||
// child: CircularProgressIndicator(
|
|
||||||
// strokeWidth: 5,
|
|
||||||
// color: orangeC,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
// if (_avatar.hasData) {
|
|
||||||
// return GestureDetector(
|
|
||||||
// key: const Key('openAvatar'),
|
|
||||||
// onTap: () {
|
|
||||||
// Navigator.push(
|
|
||||||
// context,
|
|
||||||
// MaterialPageRoute(builder: (context) {
|
|
||||||
// return AvatarFullscreen(_avatar.data);
|
|
||||||
// }),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// child: ClipOval(
|
|
||||||
// child: Image(
|
|
||||||
// image: _avatar.data!.image,
|
|
||||||
// height: _avatarSize,
|
|
||||||
// fit: BoxFit.cover,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// return ClipOval(
|
|
||||||
// child: _cesiumPlusProvider.defaultAvatar(_avatarSize),
|
|
||||||
// );
|
|
||||||
// }),
|
|
||||||
if (avatar != null)
|
|
||||||
GestureDetector(
|
|
||||||
key: const Key('openAvatar'),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) {
|
|
||||||
return AvatarFullscreen(avatar);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: ClipOval(
|
|
||||||
child: Image(
|
|
||||||
image: avatar!.image,
|
|
||||||
height: _avatarSize,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
]),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
|
||||||
|
balance(context, pubkey!, 22),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
_walletOptions.idtyStatus(context, pubkey!, isOwner: false),
|
||||||
|
getCerts(context, pubkey!, 14),
|
||||||
|
|
||||||
|
// if (username == null &&
|
||||||
|
// g1WalletsBox.get(pubkey)?.username == null)
|
||||||
|
// Query(
|
||||||
|
// options: QueryOptions(
|
||||||
|
// document: gql(getId),
|
||||||
|
// variables: {
|
||||||
|
// 'pubkey': pubkey,
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// builder: (QueryResult result,
|
||||||
|
// {VoidCallback? refetch, FetchMore? fetchMore}) {
|
||||||
|
// if (result.isLoading || result.hasException) {
|
||||||
|
// return const Text('...');
|
||||||
|
// } else if (result.data!['idty'] == null ||
|
||||||
|
// result.data!['idty']['username'] == null) {
|
||||||
|
// g1WalletsBox.get(pubkey)?.username = '';
|
||||||
|
// return const Text('');
|
||||||
|
// } else {
|
||||||
|
// g1WalletsBox.get(pubkey)?.username =
|
||||||
|
// result.data!['idty']['username'] ?? '';
|
||||||
|
// return SizedBox(
|
||||||
|
// width: 230,
|
||||||
|
// child: Text(
|
||||||
|
// result.data!['idty']['username'] ?? '',
|
||||||
|
// style: const TextStyle(
|
||||||
|
// fontSize: 27,
|
||||||
|
// color: Color(0xff814C00),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
if (username == null &&
|
||||||
|
g1WalletsBox.get(pubkey)?.username != null)
|
||||||
|
SizedBox(
|
||||||
|
width: 230,
|
||||||
|
child: Text(
|
||||||
|
g1WalletsBox.get(pubkey)?.username ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 27,
|
||||||
|
color: Color(0xff814C00),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (username != null)
|
||||||
|
SizedBox(
|
||||||
|
width: 230,
|
||||||
|
child: Text(
|
||||||
|
username!,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 27,
|
||||||
|
color: Color(0xff814C00),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
//// To get Cs+ name
|
||||||
|
// FutureBuilder(
|
||||||
|
// future: _cesiumPlusProvider.getName(pubkey),
|
||||||
|
// initialData: '...',
|
||||||
|
// builder: (context, snapshot) {
|
||||||
|
// return SizedBox(
|
||||||
|
// width: 230,
|
||||||
|
// child: Text(
|
||||||
|
// snapshot.data.toString(),
|
||||||
|
// style: const TextStyle(
|
||||||
|
// fontSize: 18, color: Colors.black),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
]),
|
||||||
|
const Spacer(),
|
||||||
|
Column(children: <Widget>[
|
||||||
|
if (avatar == null)
|
||||||
|
ClipOval(
|
||||||
|
child: _cesiumPlusProvider.defaultAvatar(_avatarSize),
|
||||||
|
),
|
||||||
|
// FutureBuilder(
|
||||||
|
// future: _cesiumPlusProvider.getAvatar(pubkey, _avatarSize),
|
||||||
|
// builder:
|
||||||
|
// (BuildContext context, AsyncSnapshot<Image?> _avatar) {
|
||||||
|
// if (_avatar.connectionState != ConnectionState.done) {
|
||||||
|
// return Stack(children: [
|
||||||
|
// ClipOval(
|
||||||
|
// child:
|
||||||
|
// _cesiumPlusProvider.defaultAvatar(_avatarSize),
|
||||||
|
// ),
|
||||||
|
// Positioned(
|
||||||
|
// top: 15,
|
||||||
|
// right: 45,
|
||||||
|
// width: 51,
|
||||||
|
// height: 51,
|
||||||
|
// child: CircularProgressIndicator(
|
||||||
|
// strokeWidth: 5,
|
||||||
|
// color: orangeC,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
// if (_avatar.hasData) {
|
||||||
|
// return GestureDetector(
|
||||||
|
// key: const Key('openAvatar'),
|
||||||
|
// onTap: () {
|
||||||
|
// Navigator.push(
|
||||||
|
// context,
|
||||||
|
// MaterialPageRoute(builder: (context) {
|
||||||
|
// return AvatarFullscreen(_avatar.data);
|
||||||
|
// }),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// child: ClipOval(
|
||||||
|
// child: Image(
|
||||||
|
// image: _avatar.data!.image,
|
||||||
|
// height: _avatarSize,
|
||||||
|
// fit: BoxFit.cover,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// return ClipOval(
|
||||||
|
// child: _cesiumPlusProvider.defaultAvatar(_avatarSize),
|
||||||
|
// );
|
||||||
|
// }),
|
||||||
|
if (avatar != null)
|
||||||
|
GestureDetector(
|
||||||
|
key: const Key('openAvatar'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return AvatarFullscreen(avatar);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: ClipOval(
|
||||||
|
child: Image(
|
||||||
|
image: avatar!.image,
|
||||||
|
height: _avatarSize,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
),
|
||||||
]),
|
const SizedBox(height: 25),
|
||||||
]),
|
]),
|
||||||
),
|
]),
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue