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),
// // painter: CustomRoundedButton(),
// // ),
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
Row(mainAxisAlignment: MainAxisAlignment.start, children: [
// SizedBox(width: 0),
const Spacer(),
const SizedBox(width: 11),
IconButton(
iconSize: 40,
icon: const Image(image: AssetImage('assets/loupe-noire.png')),
@ -156,6 +159,8 @@ class HomeProvider with ChangeNotifier {
);
},
),
const SizedBox(width: 22),
const Spacer(),
IconButton(
iconSize: 70,
icon: const Image(image: AssetImage('assets/qrcode-scan.png')),
@ -167,6 +172,8 @@ class HomeProvider with ChangeNotifier {
_historyProvider.scan(homeContext);
},
),
const Spacer(),
const SizedBox(width: 15),
IconButton(
iconSize: 60,
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']];
}
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<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 {
double balance = 0.0;

View File

@ -312,19 +312,15 @@ Widget getCerts(BuildContext context, String address, double size,
return _certs.data?[0] != 0
? Row(
children: [
const Icon(
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')
Image.asset('assets/medal.png', height: 20),
const SizedBox(width: 1),
Text(_certs.data?[0].toString() ?? '0',
style: const TextStyle(fontSize: 20)),
const SizedBox(width: 5),
Text(
"(${_certs.data?[1].toString() ?? '0'})",
style: const TextStyle(fontSize: 14),
)
],
)
: const Text('');

View File

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

View File

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