improve certs view

This commit is contained in:
poka 2022-06-04 15:08:22 +02:00
parent 1cd3f74c6c
commit 6280517f8d
6 changed files with 63 additions and 68 deletions

BIN
assets/medal.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -139,7 +139,10 @@ class HomeProvider with ChangeNotifier {
// // size: Size(size.width, 110), // // size: Size(size.width, 110),
// // painter: CustomRoundedButton(), // // painter: CustomRoundedButton(),
// // ), // // ),
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Row(mainAxisAlignment: MainAxisAlignment.start, children: [
// SizedBox(width: 0),
const Spacer(),
const SizedBox(width: 11),
IconButton( IconButton(
iconSize: 40, iconSize: 40,
icon: const Image(image: AssetImage('assets/loupe-noire.png')), icon: const Image(image: AssetImage('assets/loupe-noire.png')),
@ -156,6 +159,8 @@ class HomeProvider with ChangeNotifier {
); );
}, },
), ),
const SizedBox(width: 22),
const Spacer(),
IconButton( IconButton(
iconSize: 70, iconSize: 70,
icon: const Image(image: AssetImage('assets/qrcode-scan.png')), icon: const Image(image: AssetImage('assets/qrcode-scan.png')),
@ -167,6 +172,8 @@ class HomeProvider with ChangeNotifier {
_historyProvider.scan(homeContext); _historyProvider.scan(homeContext);
}, },
), ),
const Spacer(),
const SizedBox(width: 15),
IconButton( IconButton(
iconSize: 60, iconSize: 60,
icon: const Image(image: AssetImage('assets/wallet.png')), icon: const Image(image: AssetImage('assets/wallet.png')),
@ -198,6 +205,7 @@ class HomeProvider with ChangeNotifier {
} }
}, },
), ),
const Spacer(),
]), ]),
), ),
); );

View File

@ -222,12 +222,12 @@ class SubstrateSdk with ChangeNotifier {
return [_certsReceiver['receivedCount'], _certsReceiver['issuedCount']]; return [_certsReceiver['receivedCount'], _certsReceiver['issuedCount']];
} }
Future<bool> isAccountExit(String address) async { // Future<bool> isAccountExit(String address) async {
final _accountInfo = await sdk.webView! // final _accountInfo = await sdk.webView!
.evalJavascript('api.query.system.account("$address")'); // .evalJavascript('api.query.system.account("$address")');
final _randomId = _accountInfo['data']['randomId']; // final _randomId = _accountInfo['data']['randomId'];
return _randomId == null ? false : true; // 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;

View File

@ -312,19 +312,15 @@ Widget getCerts(BuildContext context, String address, double size,
return _certs.data?[0] != 0 return _certs.data?[0] != 0
? Row( ? Row(
children: [ children: [
const Icon( Image.asset('assets/medal.png', height: 20),
Icons.arrow_drop_down, const SizedBox(width: 1),
color: Colors.green, Text(_certs.data?[0].toString() ?? '0',
size: 30, style: const TextStyle(fontSize: 20)),
), const SizedBox(width: 5),
Text(_certs.data?[0].toString() ?? '0'), Text(
const SizedBox(width: 15), "(${_certs.data?[1].toString() ?? '0'})",
const Icon( style: const TextStyle(fontSize: 14),
Icons.arrow_drop_up, )
color: Colors.blue,
size: 30,
),
Text(_certs.data?[1].toString() ?? '0')
], ],
) )
: const Text(''); : const Text('');

View File

@ -88,29 +88,30 @@ class WalletOptions extends StatelessWidget {
], ],
)), )),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[ children: <Widget>[
const Spacer(flex: 1), const Spacer(flex: 1),
avatar(walletProvider), avatar(walletProvider),
const Spacer(flex: 1), const Spacer(flex: 1),
Column(children: <Widget>[ Column(
walletName(walletProvider, _walletOptions), crossAxisAlignment: CrossAxisAlignment.center,
SizedBox(height: isTall ? 5 : 0), children: <Widget>[
// SizedBox(height: isTall ? 5 : 0), walletName(walletProvider, _walletOptions),
balance(context, walletProvider.address.text, 21), SizedBox(height: isTall ? 5 : 0),
const SizedBox(width: 30), // SizedBox(height: isTall ? 5 : 0),
Column( balance(context, walletProvider.address.text, 21),
crossAxisAlignment: CrossAxisAlignment.center, const SizedBox(width: 30),
children: [ Column(
_walletOptions.idtyStatus( crossAxisAlignment: CrossAxisAlignment.center,
context, _walletOptions.address.text, children: [
isOwner: true), _walletOptions.idtyStatus(
getCerts( context, _walletOptions.address.text,
context, walletProvider.address.text, 15), isOwner: true),
]), getCerts(context,
SizedBox(height: 10 * ratio), walletProvider.address.text, 15),
]), ]),
SizedBox(height: 10 * ratio),
]),
const Spacer(flex: 2), const Spacer(flex: 2),
]), ]),
); );

View File

@ -381,21 +381,14 @@ class WalletViewScreen extends StatelessWidget {
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,
// height: 25,
decoration: BoxDecoration( decoration: BoxDecoration(
// border: OutlineInputBorder(
// borderSide:
// BorderSide(color: Colors.grey[500], width: 2),
// borderRadius: BorderRadius.circular(8)),
border: Border.all( border: Border.all(
color: Colors.blueAccent color: Colors.blueAccent.shade200,
.shade200, // Set border color width: 2),
width: 2), // Set border width
borderRadius: const BorderRadius.all( borderRadius: const BorderRadius.all(
Radius.circular(10.0)), // Set ro Radius.circular(10.0)),
), ),
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Row(children: [ child: Row(children: [
Text(defaultWallet.name!), Text(defaultWallet.name!),
const Spacer(), const Spacer(),
@ -570,28 +563,25 @@ 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); // SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
// AsyncSnapshot<bool> isAccountExist; bool isAccountExist = balanceCache[pubkey] != '0.0 $currencyName';
return Stack(children: <Widget>[ return Stack(children: <Widget>[
FutureBuilder( Consumer<SubstrateSdk>(builder: (context, _sub, _) {
future: _sub.isAccountExit(pubkey!), return Container(
builder: (BuildContext context, AsyncSnapshot<bool> isAccountExist) { height: 180,
final bool _isExit = isAccountExist.data ?? false; decoration: BoxDecoration(
return Container( gradient: LinearGradient(
height: 180, begin: Alignment.topCenter,
decoration: BoxDecoration( end: Alignment.bottomCenter,
gradient: LinearGradient( colors: [
begin: Alignment.topCenter, isAccountExist ? yellowC : Colors.grey[400]!,
end: Alignment.bottomCenter, isAccountExist ? const Color(0xFFE7811A) : Colors.grey[600]!,
colors: [ ],
_isExit ? yellowC : Colors.grey[400]!, ),
_isExit ? const Color(0xFFE7811A) : Colors.grey[600]!, ));
], }),
),
));
}),
Padding( Padding(
padding: const EdgeInsets.only(left: 30, right: 40), padding: const EdgeInsets.only(left: 30, right: 40),
child: Row(children: <Widget>[ child: Row(children: <Widget>[