fuck git. start to implement certs screen
This commit is contained in:
parent
413c3c708e
commit
9a9bc6788c
|
@ -13,6 +13,7 @@ import 'package:gecko/providers/my_wallets.dart';
|
||||||
import 'package:gecko/models/wallet_data.dart';
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
import 'package:gecko/providers/substrate_sdk.dart';
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
import 'package:gecko/screens/animated_text.dart';
|
import 'package:gecko/screens/animated_text.dart';
|
||||||
|
import 'package:gecko/screens/certifications.dart';
|
||||||
import 'package:gecko/screens/common_elements.dart';
|
import 'package:gecko/screens/common_elements.dart';
|
||||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||||
import 'package:gecko/screens/transaction_in_progress.dart';
|
import 'package:gecko/screens/transaction_in_progress.dart';
|
||||||
|
@ -590,18 +591,29 @@ Widget getCerts(BuildContext context, String address, double size,
|
||||||
// log.d(_certs.data);
|
// log.d(_certs.data);
|
||||||
|
|
||||||
return certs.data?[0] != 0 && certs.data != null
|
return certs.data?[0] != 0 && certs.data != null
|
||||||
? Row(
|
? InkWell(
|
||||||
children: [
|
onTap: () => {
|
||||||
Image.asset('assets/medal.png', height: 20),
|
Navigator.push(
|
||||||
const SizedBox(width: 1),
|
context,
|
||||||
Text(certs.data?[0].toString() ?? '0',
|
MaterialPageRoute(builder: (context) {
|
||||||
style: const TextStyle(fontSize: 20)),
|
return CertificationsScreen(
|
||||||
const SizedBox(width: 5),
|
address: address, username: '');
|
||||||
Text(
|
}),
|
||||||
"(${certs.data?[1].toString() ?? '0'})",
|
),
|
||||||
style: const TextStyle(fontSize: 14),
|
},
|
||||||
)
|
child: Row(
|
||||||
],
|
children: [
|
||||||
|
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('');
|
: const Text('');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,21 +1,13 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
|
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/g1_wallets_list.dart';
|
import 'package:gecko/models/g1_wallets_list.dart';
|
||||||
import 'package:gecko/models/widgets_keys.dart';
|
|
||||||
import 'package:gecko/providers/cesium_plus.dart';
|
|
||||||
import 'package:gecko/providers/substrate_sdk.dart';
|
|
||||||
import 'package:gecko/providers/wallet_options.dart';
|
|
||||||
import 'package:gecko/screens/common_elements.dart';
|
|
||||||
import 'package:gecko/screens/wallet_view.dart';
|
import 'package:gecko/screens/wallet_view.dart';
|
||||||
import 'package:jdenticon_dart/jdenticon_dart.dart';
|
import 'package:jdenticon_dart/jdenticon_dart.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
// import 'package:qrscan/qrscan.dart' as scanner;
|
// import 'package:qrscan/qrscan.dart' as scanner;
|
||||||
import 'package:barcode_scan2/barcode_scan2.dart';
|
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
class WalletsProfilesProvider with ChangeNotifier {
|
class WalletsProfilesProvider with ChangeNotifier {
|
||||||
WalletsProfilesProvider(this.address);
|
WalletsProfilesProvider(this.address);
|
||||||
|
@ -130,101 +122,6 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
return _balance;
|
return _balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget headerProfileView(
|
|
||||||
BuildContext context, String address, String? username) {
|
|
||||||
const double avatarSize = 140;
|
|
||||||
|
|
||||||
final walletOptions =
|
|
||||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
|
||||||
final cesiumPlusProvider =
|
|
||||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
|
||||||
|
|
||||||
return Stack(children: <Widget>[
|
|
||||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
|
||||||
bool isAccountExist = balanceCache[address] != 0;
|
|
||||||
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>[
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
Container(
|
|
||||||
height: 10,
|
|
||||||
color: yellowC, // Colors.grey[400],
|
|
||||||
),
|
|
||||||
Row(children: [
|
|
||||||
GestureDetector(
|
|
||||||
key: keyCopyAddress,
|
|
||||||
onTap: () {
|
|
||||||
Clipboard.setData(ClipboardData(text: address));
|
|
||||||
snackCopyKey(context);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
getShortPubkey(address),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 30,
|
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
balance(context, address, 22),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
walletOptions.idtyStatus(context, address,
|
|
||||||
isOwner: false, color: Colors.black),
|
|
||||||
getCerts(context, address, 14),
|
|
||||||
// if (username == null &&
|
|
||||||
// g1WalletsBox.get(address)?.username != null)
|
|
||||||
// SizedBox(
|
|
||||||
// width: 230,
|
|
||||||
// child: Text(
|
|
||||||
// g1WalletsBox.get(address)?.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: 55),
|
|
||||||
]),
|
|
||||||
const Spacer(),
|
|
||||||
Column(children: <Widget>[
|
|
||||||
ClipOval(
|
|
||||||
child: cesiumPlusProvider.defaultAvatar(avatarSize),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
]),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
CommonElements().offlineInfo(context),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isContact(String address) {
|
bool isContact(String address) {
|
||||||
return contactsBox.containsKey(address);
|
return contactsBox.containsKey(address);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ import 'package:gecko/providers/cesium_plus.dart';
|
||||||
import 'package:gecko/providers/duniter_indexer.dart';
|
import 'package:gecko/providers/duniter_indexer.dart';
|
||||||
import 'package:gecko/providers/home.dart';
|
import 'package:gecko/providers/home.dart';
|
||||||
import 'package:gecko/providers/substrate_sdk.dart';
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
import 'package:gecko/providers/wallets_profiles.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/screens/wallet_view.dart';
|
import 'package:gecko/screens/wallet_view.dart';
|
||||||
|
import 'package:gecko/widgets/header_profile.dart';
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
@ -31,8 +31,6 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
WalletsProfilesProvider walletProfile =
|
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
|
||||||
HomeProvider homeProvider =
|
HomeProvider homeProvider =
|
||||||
Provider.of<HomeProvider>(context, listen: false);
|
Provider.of<HomeProvider>(context, listen: false);
|
||||||
|
|
||||||
|
@ -48,7 +46,7 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
),
|
),
|
||||||
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||||
body: Column(children: <Widget>[
|
body: Column(children: <Widget>[
|
||||||
walletProfile.headerProfileView(context, address, username),
|
HeaderProfile(address: address, username: username),
|
||||||
historyQuery(context),
|
historyQuery(context),
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,11 @@ import 'package:gecko/widgets/certs_sent.dart';
|
||||||
import 'package:gecko/widgets/header_profile.dart';
|
import 'package:gecko/widgets/header_profile.dart';
|
||||||
|
|
||||||
class CertificationsScreen extends StatelessWidget {
|
class CertificationsScreen extends StatelessWidget {
|
||||||
const CertificationsScreen({Key? key, required this.address})
|
const CertificationsScreen(
|
||||||
|
{Key? key, required this.address, required this.username})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
final String address;
|
final String address;
|
||||||
|
final String username;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -16,6 +18,7 @@ class CertificationsScreen extends StatelessWidget {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
elevation: 0,
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
height: 22,
|
height: 22,
|
||||||
|
@ -23,8 +26,7 @@ class CertificationsScreen extends StatelessWidget {
|
||||||
)),
|
)),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
const SizedBox(height: 20),
|
HeaderProfile(address: address, username: username),
|
||||||
HeaderProfile(address: address),
|
|
||||||
CertsReceived(address: address),
|
CertsReceived(address: address),
|
||||||
CertsSent(address: address),
|
CertsSent(address: address),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
|
|
@ -20,6 +20,7 @@ import 'package:gecko/screens/myWallets/choose_wallet.dart';
|
||||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||||
import 'package:gecko/screens/qrcode_fullscreen.dart';
|
import 'package:gecko/screens/qrcode_fullscreen.dart';
|
||||||
import 'package:gecko/screens/transaction_in_progress.dart';
|
import 'package:gecko/screens/transaction_in_progress.dart';
|
||||||
|
import 'package:gecko/widgets/header_profile.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:qr_flutter/qr_flutter.dart';
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
walletProfile.headerProfileView(context, address, username),
|
HeaderProfile(address: address, username: username),
|
||||||
SizedBox(height: isTall ? 10 : 0),
|
SizedBox(height: isTall ? 10 : 0),
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
|
|
|
@ -6,6 +6,6 @@ class CertsReceived extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Text('tatataaaaaaaaaa');
|
return const Text('received');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,6 @@ class CertsSent extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Text('tatataaaaaaaaaa');
|
return const Text('sent');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,116 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:gecko/models/widgets_keys.dart';
|
||||||
|
import 'package:gecko/providers/cesium_plus.dart';
|
||||||
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
|
import 'package:gecko/providers/wallet_options.dart';
|
||||||
|
import 'package:gecko/providers/wallets_profiles.dart';
|
||||||
|
import 'package:gecko/screens/common_elements.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class HeaderProfile extends StatelessWidget {
|
class HeaderProfile extends StatelessWidget {
|
||||||
const HeaderProfile({Key? key, required this.address}) : super(key: key);
|
const HeaderProfile({
|
||||||
|
Key? key,
|
||||||
|
required this.address,
|
||||||
|
required this.username,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
final String address;
|
final String address;
|
||||||
|
final String? username;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Text('tatataaaaaaaaaa');
|
const double avatarSize = 140;
|
||||||
|
|
||||||
|
final walletOptions =
|
||||||
|
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
|
final cesiumPlusProvider =
|
||||||
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
|
|
||||||
|
return Stack(children: <Widget>[
|
||||||
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
|
bool isAccountExist = balanceCache[address] != 0;
|
||||||
|
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>[
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Container(
|
||||||
|
height: 10,
|
||||||
|
color: yellowC, // Colors.grey[400],
|
||||||
|
),
|
||||||
|
Row(children: [
|
||||||
|
GestureDetector(
|
||||||
|
key: keyCopyAddress,
|
||||||
|
onTap: () {
|
||||||
|
Clipboard.setData(ClipboardData(text: address));
|
||||||
|
snackCopyKey(context);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
getShortPubkey(address),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 30,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
balance(context, address, 22),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
walletOptions.idtyStatus(context, address,
|
||||||
|
isOwner: false, color: Colors.black),
|
||||||
|
getCerts(context, address, 14),
|
||||||
|
// if (username == null &&
|
||||||
|
// g1WalletsBox.get(address)?.username != null)
|
||||||
|
// SizedBox(
|
||||||
|
// width: 230,
|
||||||
|
// child: Text(
|
||||||
|
// g1WalletsBox.get(address)?.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: 55),
|
||||||
|
]),
|
||||||
|
const Spacer(),
|
||||||
|
Column(children: <Widget>[
|
||||||
|
ClipOval(
|
||||||
|
child: cesiumPlusProvider.defaultAvatar(avatarSize),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
CommonElements().offlineInfo(context),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue