Upgrade dependencies; apply new lints infos
This commit is contained in:
parent
4fb40ff3f1
commit
fad6ebd878
|
@ -65,7 +65,7 @@ android {
|
||||||
release {
|
release {
|
||||||
// TODO: Add your own signing config for the release build.
|
// TODO: Add your own signing config for the release build.
|
||||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||||
signingConfig signingConfigs.release //poka: comment this to build unsigned release, or set to signingConfigs.debug to sign with debug keys
|
signingConfig signingConfigs.debug //poka: comment this to build unsigned release, or set to signingConfigs.debug to sign with debug keys
|
||||||
useProguard true
|
useProguard true
|
||||||
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// ignore_for_file: avoid_print
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
@ -44,7 +42,6 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:responsive_framework/responsive_framework.dart';
|
import 'package:responsive_framework/responsive_framework.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:window_size/window_size.dart';
|
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
|
||||||
|
@ -53,17 +50,12 @@ const bool enableSentry = true;
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await EasyLocalization.ensureInitialized();
|
await EasyLocalization.ensureInitialized();
|
||||||
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
|
|
||||||
setWindowTitle('Ğecko');
|
|
||||||
setWindowMinSize(const Size(400, 700));
|
|
||||||
setWindowMaxSize(const Size(800, 1000));
|
|
||||||
}
|
|
||||||
|
|
||||||
HomeProvider _homeProvider = HomeProvider();
|
HomeProvider homeProvider = HomeProvider();
|
||||||
// DuniterIndexer _duniterIndexer = DuniterIndexer();
|
// DuniterIndexer _duniterIndexer = DuniterIndexer();
|
||||||
await initHiveForFlutter();
|
await initHiveForFlutter();
|
||||||
await _homeProvider.initHive();
|
await homeProvider.initHive();
|
||||||
appVersion = await _homeProvider.getAppVersion();
|
appVersion = await homeProvider.getAppVersion();
|
||||||
prefs = await SharedPreferences.getInstance();
|
prefs = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
// Reset GraphQL cache
|
// Reset GraphQL cache
|
||||||
|
@ -82,7 +74,7 @@ Future<void> main() async {
|
||||||
await Hive.deleteBoxFromDisk('g1WalletsBox');
|
await Hive.deleteBoxFromDisk('g1WalletsBox');
|
||||||
g1WalletsBox = await Hive.openBox<G1WalletsList>("g1WalletsBox");
|
g1WalletsBox = await Hive.openBox<G1WalletsList>("g1WalletsBox");
|
||||||
|
|
||||||
await _homeProvider.getValidEndpoints();
|
await homeProvider.getValidEndpoints();
|
||||||
// await configBox.delete('isCacheChecked');
|
// await configBox.delete('isCacheChecked');
|
||||||
if (configBox.get('isCacheChecked') == null) {
|
if (configBox.get('isCacheChecked') == null) {
|
||||||
configBox.put('isCacheChecked', false);
|
configBox.put('isCacheChecked', false);
|
||||||
|
@ -117,7 +109,7 @@ Future<void> main() async {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
print('Debug mode enabled: No sentry alerte');
|
log.i('Debug mode enabled: No sentry alerte');
|
||||||
|
|
||||||
runApp(
|
runApp(
|
||||||
EasyLocalization(
|
EasyLocalization(
|
||||||
|
|
|
@ -6,10 +6,10 @@ class StatefulWrapper extends StatefulWidget {
|
||||||
const StatefulWrapper({Key? key, required this.onInit, required this.child})
|
const StatefulWrapper({Key? key, required this.onInit, required this.child})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
@override
|
@override
|
||||||
_StatefulWrapperState createState() => _StatefulWrapperState();
|
StatefulWrapperState createState() => StatefulWrapperState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _StatefulWrapperState extends State<StatefulWrapper> {
|
class StatefulWrapperState extends State<StatefulWrapper> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
widget.onInit();
|
widget.onInit();
|
||||||
|
|
|
@ -13,18 +13,18 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
|
|
||||||
CancelToken avatarCancelToken = CancelToken();
|
CancelToken avatarCancelToken = CancelToken();
|
||||||
|
|
||||||
Future<List> _buildQuery(_pubkey) async {
|
Future<List> _buildQuery(pubkey) async {
|
||||||
var queryGetAvatar = json.encode({
|
var queryGetAvatar = json.encode({
|
||||||
"query": {
|
"query": {
|
||||||
"bool": {
|
"bool": {
|
||||||
"should": [
|
"should": [
|
||||||
{
|
{
|
||||||
"match": {
|
"match": {
|
||||||
'_id': {"query": _pubkey, "boost": 2}
|
'_id': {"query": pubkey, "boost": 2}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"prefix": {'_id': _pubkey}
|
"prefix": {'_id': pubkey}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -60,14 +60,14 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
return [podRequest, queryGetAvatar, headers];
|
return [podRequest, queryGetAvatar, headers];
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> getName(String? _pubkey) async {
|
Future<String> getName(String? pubkey) async {
|
||||||
String? _name;
|
String? name;
|
||||||
|
|
||||||
if (g1WalletsBox.get(_pubkey)?.csName != null) {
|
if (g1WalletsBox.get(pubkey)?.csName != null) {
|
||||||
return g1WalletsBox.get(_pubkey)!.csName!;
|
return g1WalletsBox.get(pubkey)!.csName!;
|
||||||
}
|
}
|
||||||
|
|
||||||
List queryOptions = await _buildQuery(_pubkey);
|
List queryOptions = await _buildQuery(pubkey);
|
||||||
|
|
||||||
var dio = Dio();
|
var dio = Dio();
|
||||||
late Response response;
|
late Response response;
|
||||||
|
@ -90,28 +90,28 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
if (response.data['hits']['hits'].toString() == '[]') {
|
if (response.data['hits']['hits'].toString() == '[]') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
final bool _nameExist =
|
final bool nameExist =
|
||||||
response.data['hits']['hits'][0]['_source'].containsKey("title");
|
response.data['hits']['hits'][0]['_source'].containsKey("title");
|
||||||
if (!_nameExist) {
|
if (!nameExist) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
_name = response.data['hits']['hits'][0]['_source']['title'];
|
name = response.data['hits']['hits'][0]['_source']['title'];
|
||||||
|
|
||||||
_name ??= '';
|
name ??= '';
|
||||||
g1WalletsBox.get(_pubkey)!.csName = _name;
|
g1WalletsBox.get(pubkey)!.csName = name;
|
||||||
|
|
||||||
return _name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Image?> getAvatar(String? _pubkey, double size) async {
|
Future<Image?> getAvatar(String? pubkey, double size) async {
|
||||||
if (g1WalletsBox.get(_pubkey)?.avatar != null) {
|
if (g1WalletsBox.get(pubkey)?.avatar != null) {
|
||||||
return g1WalletsBox.get(_pubkey)!.avatar;
|
return g1WalletsBox.get(pubkey)!.avatar;
|
||||||
}
|
}
|
||||||
var dio = Dio();
|
var dio = Dio();
|
||||||
|
|
||||||
// log.d(_pubkey);
|
// log.d(_pubkey);
|
||||||
|
|
||||||
List queryOptions = await _buildQuery(_pubkey);
|
List queryOptions = await _buildQuery(pubkey);
|
||||||
|
|
||||||
late Response response;
|
late Response response;
|
||||||
try {
|
try {
|
||||||
|
@ -138,12 +138,12 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
return defaultAvatar(size);
|
return defaultAvatar(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
final _avatar =
|
final avatar =
|
||||||
response.data['hits']['hits'][0]['_source']['avatar']['_content'];
|
response.data['hits']['hits'][0]['_source']['avatar']['_content'];
|
||||||
|
|
||||||
var avatarFile =
|
var avatarFile =
|
||||||
File('${(await getTemporaryDirectory()).path}/avatar_$_pubkey.png');
|
File('${(await getTemporaryDirectory()).path}/avatar_$pubkey.png');
|
||||||
await avatarFile.writeAsBytes(base64.decode(_avatar));
|
await avatarFile.writeAsBytes(base64.decode(avatar));
|
||||||
|
|
||||||
final finalAvatar = Image.file(
|
final finalAvatar = Image.file(
|
||||||
avatarFile,
|
avatarFile,
|
||||||
|
@ -151,7 +151,7 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
fit: BoxFit.fitWidth,
|
fit: BoxFit.fitWidth,
|
||||||
);
|
);
|
||||||
|
|
||||||
g1WalletsBox.get(_pubkey)!.avatar = finalAvatar;
|
g1WalletsBox.get(pubkey)!.avatar = finalAvatar;
|
||||||
|
|
||||||
return finalAvatar;
|
return finalAvatar;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,16 +13,16 @@ class ChestProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future deleteChest(context, ChestData _chest) async {
|
Future deleteChest(context, ChestData chest) async {
|
||||||
final bool? _answer = await (_confirmDeletingChest(context, _chest.name));
|
final bool? answer = await (_confirmDeletingChest(context, chest.name));
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
if (_answer ?? false) {
|
if (answer ?? false) {
|
||||||
await _sub.deleteAccounts(getChestWallets(_chest));
|
await sub.deleteAccounts(getChestWallets(chest));
|
||||||
await chestBox.delete(_chest.key);
|
await chestBox.delete(chest.key);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
_myWalletProvider.pinCode = '';
|
myWalletProvider.pinCode = '';
|
||||||
|
|
||||||
if (chestBox.isEmpty) {
|
if (chestBox.isEmpty) {
|
||||||
await configBox.put('currentChest', 0);
|
await configBox.put('currentChest', 0);
|
||||||
|
@ -39,24 +39,24 @@ class ChestProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> getChestWallets(ChestData _chest) {
|
List<String> getChestWallets(ChestData chest) {
|
||||||
List<String> toDelete = [];
|
List<String> toDelete = [];
|
||||||
log.d(_chest.key);
|
log.d(chest.key);
|
||||||
walletBox.toMap().forEach((key, WalletData value) {
|
walletBox.toMap().forEach((key, WalletData value) {
|
||||||
if (value.chest == _chest.key) {
|
if (value.chest == chest.key) {
|
||||||
toDelete.add(value.address!);
|
toDelete.add(value.address!);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return toDelete;
|
return toDelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool?> _confirmDeletingChest(context, String? _walletName) async {
|
Future<bool?> _confirmDeletingChest(context, String? walletName) async {
|
||||||
return showDialog<bool>(
|
return showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: true, // user must tap button!
|
barrierDismissible: true, // user must tap button!
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text('areYouSureToDeleteWallet'.tr(args: [_walletName!])),
|
title: Text('areYouSureToDeleteWallet'.tr(args: [walletName!])),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text("no".tr(), key: const Key('cancelDeleting')),
|
child: Text("no".tr(), key: const Key('cancelDeleting')),
|
||||||
|
|
|
@ -33,10 +33,10 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
Future<bool> checkIndexerEndpoint(String endpoint) async {
|
Future<bool> checkIndexerEndpoint(String endpoint) async {
|
||||||
isLoadingIndexer = true;
|
isLoadingIndexer = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
final _client = HttpClient();
|
final client = HttpClient();
|
||||||
_client.connectionTimeout = const Duration(milliseconds: 4000);
|
client.connectionTimeout = const Duration(milliseconds: 4000);
|
||||||
try {
|
try {
|
||||||
final request = await _client.postUrl(Uri.parse('$endpoint/v1/graphql'));
|
final request = await client.postUrl(Uri.parse('$endpoint/v1/graphql'));
|
||||||
final response = await request.close();
|
final response = await request.close();
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
log.d('INDEXER IS OFFILINE');
|
log.d('INDEXER IS OFFILINE');
|
||||||
|
@ -102,10 +102,10 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
// String _endpoint = '';
|
// String _endpoint = '';
|
||||||
int _statusCode = 0;
|
int statusCode = 0;
|
||||||
|
|
||||||
final _client = HttpClient();
|
final client = HttpClient();
|
||||||
_client.connectionTimeout = const Duration(milliseconds: 3000);
|
client.connectionTimeout = const Duration(milliseconds: 3000);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
int listLenght = listIndexerEndpoints.length;
|
int listLenght = listIndexerEndpoints.length;
|
||||||
|
@ -114,8 +114,7 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
indexerEndpoint = '';
|
indexerEndpoint = '';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
log.d((i + 1).toString() +
|
log.d('${i + 1}n indexer endpoint try: ${listIndexerEndpoints[i]}');
|
||||||
'n indexer endpoint try: ${listIndexerEndpoints[i]}');
|
|
||||||
|
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
await Future.delayed(const Duration(milliseconds: 300));
|
await Future.delayed(const Duration(milliseconds: 300));
|
||||||
|
@ -124,33 +123,33 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
try {
|
try {
|
||||||
String endpointPath = '${listIndexerEndpoints[i]}/v1/graphql';
|
String endpointPath = '${listIndexerEndpoints[i]}/v1/graphql';
|
||||||
|
|
||||||
final request = await _client.postUrl(Uri.parse(endpointPath));
|
final request = await client.postUrl(Uri.parse(endpointPath));
|
||||||
final response = await request.close();
|
final response = await request.close();
|
||||||
|
|
||||||
indexerEndpoint = listIndexerEndpoints[i];
|
indexerEndpoint = listIndexerEndpoints[i];
|
||||||
await configBox.put('indexerEndpoint', listIndexerEndpoints[i]);
|
await configBox.put('indexerEndpoint', listIndexerEndpoints[i]);
|
||||||
|
|
||||||
_statusCode = response.statusCode;
|
statusCode = response.statusCode;
|
||||||
i++;
|
i++;
|
||||||
} on TimeoutException catch (_) {
|
} on TimeoutException catch (_) {
|
||||||
log.e('This endpoint is timeout, next');
|
log.e('This endpoint is timeout, next');
|
||||||
_statusCode = 50;
|
statusCode = 50;
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
} on SocketException catch (_) {
|
} on SocketException catch (_) {
|
||||||
log.e('This endpoint is a bad endpoint, next');
|
log.e('This endpoint is a bad endpoint, next');
|
||||||
_statusCode = 70;
|
statusCode = 70;
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
} on Exception {
|
} on Exception {
|
||||||
log.e('Unknown error');
|
log.e('Unknown error');
|
||||||
_statusCode = 60;
|
statusCode = 60;
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} while (_statusCode != 200);
|
} while (statusCode != 200);
|
||||||
|
|
||||||
log.i('INDEXER: ' + indexerEndpoint);
|
log.i('INDEXER: $indexerEndpoint');
|
||||||
return indexerEndpoint;
|
return indexerEndpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,34 +157,34 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
[WalletData? wallet,
|
[WalletData? wallet,
|
||||||
double size = 20,
|
double size = 20,
|
||||||
bool canEdit = false,
|
bool canEdit = false,
|
||||||
Color _color = Colors.black,
|
Color color = Colors.black,
|
||||||
FontWeight fontWeight = FontWeight.w400,
|
FontWeight fontWeight = FontWeight.w400,
|
||||||
FontStyle fontStyle = FontStyle.italic]) {
|
FontStyle fontStyle = FontStyle.italic]) {
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
if (indexerEndpoint == '') {
|
if (indexerEndpoint == '') {
|
||||||
if (wallet == null) {
|
if (wallet == null) {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
} else {
|
} else {
|
||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
return _walletOptions.walletName(context, wallet, size, _color);
|
return walletOptions.walletName(context, wallet, size, color);
|
||||||
} else {
|
} else {
|
||||||
return _walletOptions.walletNameController(context, wallet, size);
|
return walletOptions.walletNameController(context, wallet, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final _httpLink = HttpLink(
|
final httpLink = HttpLink(
|
||||||
'$indexerEndpoint/v1/graphql',
|
'$indexerEndpoint/v1/graphql',
|
||||||
);
|
);
|
||||||
|
|
||||||
final _client = ValueNotifier(
|
final client = ValueNotifier(
|
||||||
GraphQLClient(
|
GraphQLClient(
|
||||||
cache: GraphQLCache(store: HiveStore()),
|
cache: GraphQLCache(store: HiveStore()),
|
||||||
link: _httpLink,
|
link: httpLink,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return GraphQLProvider(
|
return GraphQLProvider(
|
||||||
client: _client,
|
client: client,
|
||||||
child: Query(
|
child: Query(
|
||||||
options: QueryOptions(
|
options: QueryOptions(
|
||||||
document: gql(
|
document: gql(
|
||||||
|
@ -213,22 +212,21 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
} else {
|
} else {
|
||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
return _walletOptions.walletName(
|
return walletOptions.walletName(context, wallet, size, color);
|
||||||
context, wallet, size, _color);
|
|
||||||
} else {
|
} else {
|
||||||
return _walletOptions.walletNameController(
|
return walletOptions.walletNameController(
|
||||||
context, wallet, size);
|
context, wallet, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Text(
|
return Text(
|
||||||
_color == Colors.grey[700]!
|
color == Colors.grey[700]!
|
||||||
? '(${walletNameIndexer[address]!})'
|
? '(${walletNameIndexer[address]!})'
|
||||||
: truncate(walletNameIndexer[address]!, 20),
|
: truncate(walletNameIndexer[address]!, 20),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: size,
|
fontSize: size,
|
||||||
color: _color,
|
color: color,
|
||||||
fontWeight: fontWeight,
|
fontWeight: fontWeight,
|
||||||
fontStyle: fontStyle,
|
fontStyle: fontStyle,
|
||||||
),
|
),
|
||||||
|
@ -240,28 +238,28 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
Widget searchIdentity(BuildContext context, String name) {
|
Widget searchIdentity(BuildContext context, String name) {
|
||||||
// WalletOptionsProvider _walletOptions =
|
// WalletOptionsProvider _walletOptions =
|
||||||
// Provider.of<WalletOptionsProvider>(context, listen: false);
|
// Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
CesiumPlusProvider _cesiumPlusProvider =
|
CesiumPlusProvider cesiumPlusProvider =
|
||||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
WalletsProfilesProvider _walletsProfiles =
|
WalletsProfilesProvider walletsProfiles =
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
if (indexerEndpoint == '') {
|
if (indexerEndpoint == '') {
|
||||||
return const Text('Aucun résultat');
|
return const Text('Aucun résultat');
|
||||||
}
|
}
|
||||||
|
|
||||||
log.d(indexerEndpoint);
|
log.d(indexerEndpoint);
|
||||||
final _httpLink = HttpLink(
|
final httpLink = HttpLink(
|
||||||
'$indexerEndpoint/v1/graphql',
|
'$indexerEndpoint/v1/graphql',
|
||||||
);
|
);
|
||||||
|
|
||||||
final _client = ValueNotifier(
|
final client = ValueNotifier(
|
||||||
GraphQLClient(
|
GraphQLClient(
|
||||||
cache: GraphQLCache(
|
cache: GraphQLCache(
|
||||||
store: HiveStore()), // GraphQLCache(store: HiveStore())
|
store: HiveStore()), // GraphQLCache(store: HiveStore())
|
||||||
link: _httpLink,
|
link: httpLink,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return GraphQLProvider(
|
return GraphQLProvider(
|
||||||
client: _client,
|
client: client,
|
||||||
child: Query(
|
child: Query(
|
||||||
options: QueryOptions(
|
options: QueryOptions(
|
||||||
document: gql(
|
document: gql(
|
||||||
|
@ -288,7 +286,7 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
int keyID = 0;
|
int keyID = 0;
|
||||||
double _avatarSize = 55;
|
double avatarSize = 55;
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: ListView(children: <Widget>[
|
child: ListView(children: <Widget>[
|
||||||
for (Map profile in identities)
|
for (Map profile in identities)
|
||||||
|
@ -298,7 +296,7 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
key: Key('searchResult${keyID++}'),
|
key: Key('searchResult${keyID++}'),
|
||||||
horizontalTitleGap: 40,
|
horizontalTitleGap: 40,
|
||||||
contentPadding: const EdgeInsets.all(5),
|
contentPadding: const EdgeInsets.all(5),
|
||||||
leading: _cesiumPlusProvider.defaultAvatar(_avatarSize),
|
leading: cesiumPlusProvider.defaultAvatar(avatarSize),
|
||||||
title: Row(children: <Widget>[
|
title: Row(children: <Widget>[
|
||||||
Text(getShortPubkey(profile['id']),
|
Text(getShortPubkey(profile['id']),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
@ -322,7 +320,7 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
_walletsProfiles.address = profile['id'];
|
walletsProfiles.address = profile['id'];
|
||||||
return WalletViewScreen(
|
return WalletViewScreen(
|
||||||
pubkey: profile['id'],
|
pubkey: profile['id'],
|
||||||
username: g1WalletsBox
|
username: g1WalletsBox
|
||||||
|
@ -341,14 +339,14 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List parseHistory(blockchainTX, _pubkey) {
|
List parseHistory(blockchainTX, pubkey) {
|
||||||
var transBC = [];
|
var transBC = [];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (final trans in blockchainTX) {
|
for (final trans in blockchainTX) {
|
||||||
final transaction = trans['node'];
|
final transaction = trans['node'];
|
||||||
final direction =
|
final direction =
|
||||||
transaction['issuer_id'] != _pubkey ? 'RECEIVED' : 'SENT';
|
transaction['issuer_id'] != pubkey ? 'RECEIVED' : 'SENT';
|
||||||
|
|
||||||
transBC.add(i);
|
transBC.add(i);
|
||||||
transBC[i] = [];
|
transBC[i] = [];
|
||||||
|
@ -362,7 +360,7 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
} else if (direction == "SENT") {
|
} else if (direction == "SENT") {
|
||||||
transBC[i].add(transaction['receiver_id']);
|
transBC[i].add(transaction['receiver_id']);
|
||||||
transBC[i].add(transaction['receiver']['identity']?['name'] ?? '');
|
transBC[i].add(transaction['receiver']['identity']?['name'] ?? '');
|
||||||
transBC[i].add('- ' + amount.toString());
|
transBC[i].add('- $amount');
|
||||||
}
|
}
|
||||||
// transBC[i].add(''); //transaction comment
|
// transBC[i].add(''); //transaction comment
|
||||||
|
|
||||||
|
@ -371,7 +369,7 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
return transBC;
|
return transBC;
|
||||||
}
|
}
|
||||||
|
|
||||||
FetchMoreOptions? checkQueryResult(result, opts, _pubkey) {
|
FetchMoreOptions? checkQueryResult(result, opts, pubkey) {
|
||||||
final List<dynamic>? blockchainTX =
|
final List<dynamic>? blockchainTX =
|
||||||
(result.data['transaction_connection']['edges'] as List<dynamic>?);
|
(result.data['transaction_connection']['edges'] as List<dynamic>?);
|
||||||
// final List<dynamic> mempoolTX =
|
// final List<dynamic> mempoolTX =
|
||||||
|
@ -402,9 +400,9 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
as List<dynamic>
|
as List<dynamic>
|
||||||
];
|
];
|
||||||
|
|
||||||
log.d('repos: ' + previousResultData.toString());
|
log.d('repos: $previousResultData');
|
||||||
log.d('repos: ' + fetchMoreResultData.toString());
|
log.d('repos: $fetchMoreResultData');
|
||||||
log.d('repos: ' + repos.toString());
|
log.d('repos: $repos');
|
||||||
|
|
||||||
fetchMoreResultData['transaction_connection']['edges'] = repos;
|
fetchMoreResultData['transaction_connection']['edges'] = repos;
|
||||||
return fetchMoreResultData;
|
return fetchMoreResultData;
|
||||||
|
@ -415,7 +413,7 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
log.d(
|
log.d(
|
||||||
"###### DEBUG H Parse blockchainTX list. Cursor: $fetchMoreCursor ######");
|
"###### DEBUG H Parse blockchainTX list. Cursor: $fetchMoreCursor ######");
|
||||||
if (fetchMoreCursor != null) {
|
if (fetchMoreCursor != null) {
|
||||||
transBC = parseHistory(blockchainTX, _pubkey);
|
transBC = parseHistory(blockchainTX, pubkey);
|
||||||
} else {
|
} else {
|
||||||
log.i("###### DEBUG H - Début de l'historique");
|
log.i("###### DEBUG H - Début de l'historique");
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
if (chestNumber == 0) {
|
if (chestNumber == 0) {
|
||||||
chestName = 'geckoChest'.tr();
|
chestName = 'geckoChest'.tr();
|
||||||
} else {
|
} else {
|
||||||
chestName = 'geckoChest'.tr() + '${chestNumber + 1}';
|
chestName = '${'geckoChest'.tr()}${chestNumber + 1}';
|
||||||
}
|
}
|
||||||
await configBox.put('currentChest', chestNumber);
|
await configBox.put('currentChest', chestNumber);
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkAskedWord(String inputWord, String _mnemo) {
|
void checkAskedWord(String inputWord, String mnemo) {
|
||||||
final expectedWord = _mnemo.split(' ')[nbrWord];
|
final expectedWord = mnemo.split(' ')[nbrWord];
|
||||||
final normInputWord = unorm.nfkd(inputWord);
|
final normInputWord = unorm.nfkd(inputWord);
|
||||||
|
|
||||||
log.i("Is $expectedWord equal to input $normInputWord ?");
|
log.i("Is $expectedWord equal to input $normInputWord ?");
|
||||||
|
@ -118,7 +118,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
return rng.nextInt(12);
|
return rng.nextInt(12);
|
||||||
}
|
}
|
||||||
|
|
||||||
String? intToString(int _nbr) {
|
String? intToString(int nbr) {
|
||||||
Map nbrToString = {};
|
Map nbrToString = {};
|
||||||
nbrToString[1] = '1th'.tr();
|
nbrToString[1] = '1th'.tr();
|
||||||
nbrToString[2] = '2th'.tr();
|
nbrToString[2] = '2th'.tr();
|
||||||
|
@ -133,7 +133,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
nbrToString[11] = '11th'.tr();
|
nbrToString[11] = '11th'.tr();
|
||||||
nbrToString[12] = '12th'.tr();
|
nbrToString[12] = '12th'.tr();
|
||||||
|
|
||||||
nbrWordAlpha = nbrToString[_nbr];
|
nbrWordAlpha = nbrToString[nbr];
|
||||||
|
|
||||||
return nbrWordAlpha;
|
return nbrWordAlpha;
|
||||||
}
|
}
|
||||||
|
@ -222,12 +222,12 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> generateCesiumWalletPubkey(
|
Future<void> generateCesiumWalletPubkey(
|
||||||
String _cesiumID, String _cesiumPWD) async {
|
String cesiumID, String cesiumPWD) async {
|
||||||
cesiumWallet = durt.CesiumWallet(_cesiumID, _cesiumPWD);
|
cesiumWallet = durt.CesiumWallet(cesiumID, cesiumPWD);
|
||||||
String _walletPubkey = cesiumWallet.pubkey;
|
String walletPubkey = cesiumWallet.pubkey;
|
||||||
|
|
||||||
cesiumPubkey.text = _walletPubkey;
|
cesiumPubkey.text = walletPubkey;
|
||||||
log.d(_walletPubkey);
|
log.d(walletPubkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cesiumIDisVisible() {
|
void cesiumIDisVisible() {
|
||||||
|
@ -248,19 +248,19 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<String>> generateWordList(BuildContext context) async {
|
Future<List<String>> generateWordList(BuildContext context) async {
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
generatedMnemonic = await _sub.generateMnemonic(lang: appLang);
|
generatedMnemonic = await sub.generateMnemonic(lang: appLang);
|
||||||
List<String> _wordsList = [];
|
List<String> wordsList = [];
|
||||||
String word;
|
String word;
|
||||||
int _nbr = 1;
|
int nbr = 1;
|
||||||
|
|
||||||
for (word in generatedMnemonic!.split(' ')) {
|
for (word in generatedMnemonic!.split(' ')) {
|
||||||
_wordsList.add("$_nbr:$word");
|
wordsList.add("$nbr:$word");
|
||||||
_nbr++;
|
nbr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _wordsList;
|
return wordsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBipWord(String word, [bool checkRedondance = true]) {
|
bool isBipWord(String word, [bool checkRedondance = true]) {
|
||||||
|
@ -368,29 +368,29 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
|
|
||||||
Future<bool> scanDerivations(BuildContext context,
|
Future<bool> scanDerivations(BuildContext context,
|
||||||
{int numberScan = 20}) async {
|
{int numberScan = 20}) async {
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
final currentChestNumber = configBox.get('currentChest');
|
final currentChestNumber = configBox.get('currentChest');
|
||||||
bool isAlive = false;
|
bool isAlive = false;
|
||||||
scanedWalletNumber = 0;
|
scanedWalletNumber = 0;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
if (!_sub.nodeConnected) {
|
if (!sub.nodeConnected) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final hasRoot = await scanRootBalance(_sub, currentChestNumber);
|
final hasRoot = await scanRootBalance(sub, currentChestNumber);
|
||||||
if (hasRoot) {
|
if (hasRoot) {
|
||||||
scanedWalletNumber = 1;
|
scanedWalletNumber = 1;
|
||||||
isAlive = true;
|
isAlive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var derivationNbr in [for (var i = 0; i < numberScan; i += 1) i]) {
|
for (var derivationNbr in [for (var i = 0; i < numberScan; i += 1) i]) {
|
||||||
final addressData = await _sub.sdk.api.keyring.addressFromMnemonic(ss58,
|
final addressData = await sub.sdk.api.keyring.addressFromMnemonic(ss58,
|
||||||
cryptoType: CryptoType.sr25519,
|
cryptoType: CryptoType.sr25519,
|
||||||
mnemonic: generatedMnemonic!,
|
mnemonic: generatedMnemonic!,
|
||||||
derivePath: '//$derivationNbr');
|
derivePath: '//$derivationNbr');
|
||||||
|
|
||||||
final balance = await _sub.getBalance(addressData.address!).timeout(
|
final balance = await sub.getBalance(addressData.address!).timeout(
|
||||||
const Duration(seconds: 1),
|
const Duration(seconds: 1),
|
||||||
onTimeout: () => 0,
|
onTimeout: () => 0,
|
||||||
);
|
);
|
||||||
|
@ -401,8 +401,8 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
isAlive = true;
|
isAlive = true;
|
||||||
String walletName = scanedWalletNumber == 0
|
String walletName = scanedWalletNumber == 0
|
||||||
? 'currentWallet'.tr()
|
? 'currentWallet'.tr()
|
||||||
: 'wallet'.tr() + ' ${scanedWalletNumber + 1}';
|
: '${'wallet'.tr()} ${scanedWalletNumber + 1}';
|
||||||
await _sub.importAccount(
|
await sub.importAccount(
|
||||||
mnemonic: '',
|
mnemonic: '',
|
||||||
fromMnemonic: true,
|
fromMnemonic: true,
|
||||||
derivePath: '//$derivationNbr',
|
derivePath: '//$derivationNbr',
|
||||||
|
@ -425,12 +425,11 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
return isAlive;
|
return isAlive;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> scanRootBalance(
|
Future<bool> scanRootBalance(SubstrateSdk sub, int currentChestNumber) async {
|
||||||
SubstrateSdk _sub, int currentChestNumber) async {
|
final addressData = await sub.sdk.api.keyring.addressFromMnemonic(ss58,
|
||||||
final addressData = await _sub.sdk.api.keyring.addressFromMnemonic(ss58,
|
|
||||||
cryptoType: CryptoType.sr25519, mnemonic: generatedMnemonic!);
|
cryptoType: CryptoType.sr25519, mnemonic: generatedMnemonic!);
|
||||||
|
|
||||||
final balance = await _sub.getBalance(addressData.address!).timeout(
|
final balance = await sub.getBalance(addressData.address!).timeout(
|
||||||
const Duration(seconds: 1),
|
const Duration(seconds: 1),
|
||||||
onTimeout: () => 0,
|
onTimeout: () => 0,
|
||||||
);
|
);
|
||||||
|
@ -438,7 +437,7 @@ class GenerateWalletsProvider with ChangeNotifier {
|
||||||
log.d(balance);
|
log.d(balance);
|
||||||
if (balance != 0) {
|
if (balance != 0) {
|
||||||
String walletName = 'myRootWallet'.tr();
|
String walletName = 'myRootWallet'.tr();
|
||||||
await _sub.importAccount(
|
await sub.importAccount(
|
||||||
mnemonic: '', fromMnemonic: true, password: pin.text);
|
mnemonic: '', fromMnemonic: true, password: pin.text);
|
||||||
|
|
||||||
WalletData myWallet = WalletData(
|
WalletData myWallet = WalletData(
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
@ -70,7 +72,7 @@ class HomeProvider with ChangeNotifier {
|
||||||
: (int.parse(packageInfo.buildNumber) - 1000).toString();
|
: (int.parse(packageInfo.buildNumber) - 1000).toString();
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
return version + '+' + buildNumber;
|
return '$version+$buildNumber';
|
||||||
}
|
}
|
||||||
|
|
||||||
Future changeMessage(String newMessage, int seconds) async {
|
Future changeMessage(String newMessage, int seconds) async {
|
||||||
|
@ -87,19 +89,19 @@ class HomeProvider with ChangeNotifier {
|
||||||
configBox.put('autoEndpoint', true);
|
configBox.put('autoEndpoint', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
List _listEndpoints = [];
|
List listEndpoints = [];
|
||||||
if (!configBox.containsKey('endpoint') ||
|
if (!configBox.containsKey('endpoint') ||
|
||||||
configBox.get('endpoint') == [] ||
|
configBox.get('endpoint') == [] ||
|
||||||
configBox.get('endpoint') == '') {
|
configBox.get('endpoint') == '') {
|
||||||
_listEndpoints = await rootBundle
|
listEndpoints = await rootBundle
|
||||||
.loadString('config/gdev_endpoints.json')
|
.loadString('config/gdev_endpoints.json')
|
||||||
.then((jsonStr) => jsonDecode(jsonStr));
|
.then((jsonStr) => jsonDecode(jsonStr));
|
||||||
_listEndpoints.shuffle();
|
listEndpoints.shuffle();
|
||||||
configBox.put('endpoint', _listEndpoints);
|
configBox.put('endpoint', listEndpoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.i('ENDPOINT: ' + _listEndpoints.toString());
|
log.i('ENDPOINT: $listEndpoints');
|
||||||
return _listEndpoints;
|
return listEndpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
T getRandomElement<T>(List<T> list) {
|
T getRandomElement<T>(List<T> list) {
|
||||||
|
@ -119,17 +121,17 @@ class HomeProvider with ChangeNotifier {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Widget bottomAppBar(BuildContext context) {
|
Widget bottomAppBar(BuildContext context) {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
WalletsProfilesProvider _historyProvider =
|
WalletsProfilesProvider historyProvider =
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
|
|
||||||
final size = MediaQuery.of(context).size;
|
final size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
const bool _showBottomBar = true;
|
const bool showBottomBar = true;
|
||||||
|
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible: _showBottomBar,
|
visible: showBottomBar,
|
||||||
child: Container(
|
child: Container(
|
||||||
color: yellowC,
|
color: yellowC,
|
||||||
width: size.width,
|
width: size.width,
|
||||||
|
@ -171,7 +173,7 @@ class HomeProvider with ChangeNotifier {
|
||||||
context,
|
context,
|
||||||
ModalRoute.withName('/'),
|
ModalRoute.withName('/'),
|
||||||
);
|
);
|
||||||
_historyProvider.scan(homeContext);
|
historyProvider.scan(homeContext);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
|
@ -180,10 +182,10 @@ class HomeProvider with ChangeNotifier {
|
||||||
iconSize: 60,
|
iconSize: 60,
|
||||||
icon: const Image(image: AssetImage('assets/wallet.png')),
|
icon: const Image(image: AssetImage('assets/wallet.png')),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
WalletData? defaultWallet = _myWalletProvider.getDefaultWallet();
|
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
String? _pin;
|
String? pin;
|
||||||
if (_myWalletProvider.pinCode == '') {
|
if (myWalletProvider.pinCode == '') {
|
||||||
_pin = await Navigator.push(
|
pin = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (homeContext) {
|
builder: (homeContext) {
|
||||||
|
@ -193,7 +195,7 @@ class HomeProvider with ChangeNotifier {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_pin != null || _myWalletProvider.pinCode != '') {
|
if (pin != null || myWalletProvider.pinCode != '') {
|
||||||
Navigator.popUntil(
|
Navigator.popUntil(
|
||||||
context,
|
context,
|
||||||
ModalRoute.withName('/'),
|
ModalRoute.withName('/'),
|
||||||
|
|
|
@ -31,11 +31,11 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WalletData> readAllWallets([int? _chest]) {
|
List<WalletData> readAllWallets([int? chest]) {
|
||||||
_chest = _chest ?? configBox.get('currentChest') ?? 0;
|
chest = chest ?? configBox.get('currentChest') ?? 0;
|
||||||
listWallets.clear();
|
listWallets.clear();
|
||||||
walletBox.toMap().forEach((key, value) {
|
walletBox.toMap().forEach((key, value) {
|
||||||
if (value.chest == _chest) {
|
if (value.chest == chest) {
|
||||||
listWallets.add(value);
|
listWallets.add(value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -43,33 +43,33 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
return listWallets;
|
return listWallets;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletData? getWalletDataById(List<int?> _id) {
|
WalletData? getWalletDataById(List<int?> id) {
|
||||||
if (_id.isEmpty) return WalletData();
|
if (id.isEmpty) return WalletData();
|
||||||
int? _chest = _id[0];
|
int? chest = id[0];
|
||||||
int? _nbr = _id[1];
|
int? nbr = id[1];
|
||||||
WalletData? _targetedWallet;
|
WalletData? targetedWallet;
|
||||||
|
|
||||||
walletBox.toMap().forEach((key, value) {
|
walletBox.toMap().forEach((key, value) {
|
||||||
if (value.chest == _chest && value.number == _nbr) {
|
if (value.chest == chest && value.number == nbr) {
|
||||||
_targetedWallet = value;
|
targetedWallet = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return _targetedWallet;
|
return targetedWallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletData? getWalletDataByAddress(String address) {
|
WalletData? getWalletDataByAddress(String address) {
|
||||||
WalletData? _targetedWallet;
|
WalletData? targetedWallet;
|
||||||
|
|
||||||
walletBox.toMap().forEach((key, value) {
|
walletBox.toMap().forEach((key, value) {
|
||||||
if (value.address == address) {
|
if (value.address == address) {
|
||||||
_targetedWallet = value;
|
targetedWallet = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return _targetedWallet;
|
return targetedWallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletData getDefaultWallet([int? chest]) {
|
WalletData getDefaultWallet([int? chest]) {
|
||||||
|
@ -84,21 +84,21 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> deleteAllWallet(context) async {
|
Future<int> deleteAllWallet(context) async {
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
try {
|
try {
|
||||||
log.w('DELETE ALL WALLETS ?');
|
log.w('DELETE ALL WALLETS ?');
|
||||||
|
|
||||||
final bool? _answer =
|
final bool? answer =
|
||||||
await (confirmPopup(context, 'areYouSureForgetAllChests'.tr()));
|
await (confirmPopup(context, 'areYouSureForgetAllChests'.tr()));
|
||||||
if (_answer!) {
|
if (answer!) {
|
||||||
await walletBox.clear();
|
await walletBox.clear();
|
||||||
await chestBox.clear();
|
await chestBox.clear();
|
||||||
await configBox.delete('defaultWallet');
|
await configBox.delete('defaultWallet');
|
||||||
await _sub.deleteAllAccounts();
|
await sub.deleteAllAccounts();
|
||||||
|
|
||||||
_myWalletProvider.pinCode = '';
|
myWalletProvider.pinCode = '';
|
||||||
|
|
||||||
await Navigator.of(context).pushNamedAndRemoveUntil(
|
await Navigator.of(context).pushNamedAndRemoveUntil(
|
||||||
'/',
|
'/',
|
||||||
|
@ -111,32 +111,32 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> generateNewDerivation(context, String _name,
|
Future<void> generateNewDerivation(context, String name,
|
||||||
[int? number]) async {
|
[int? number]) async {
|
||||||
isNewDerivationLoading = true;
|
isNewDerivationLoading = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
final List idList = getNextWalletNumberAndDerivation();
|
final List idList = getNextWalletNumberAndDerivation();
|
||||||
int _newWalletNbr = idList[0];
|
int newWalletNbr = idList[0];
|
||||||
int _newDerivationNbr = number ?? idList[1];
|
int newDerivationNbr = number ?? idList[1];
|
||||||
|
|
||||||
int? _chest = getCurrentChest();
|
int? chest = getCurrentChest();
|
||||||
|
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
WalletData defaultWallet = getDefaultWallet();
|
WalletData defaultWallet = getDefaultWallet();
|
||||||
|
|
||||||
final address = await _sub.derive(
|
final address = await sub.derive(
|
||||||
context, defaultWallet.address!, _newDerivationNbr, pinCode);
|
context, defaultWallet.address!, newDerivationNbr, pinCode);
|
||||||
|
|
||||||
WalletData newWallet = WalletData(
|
WalletData newWallet = WalletData(
|
||||||
version: dataVersion,
|
version: dataVersion,
|
||||||
chest: _chest,
|
chest: chest,
|
||||||
address: address,
|
address: address,
|
||||||
number: _newWalletNbr,
|
number: newWalletNbr,
|
||||||
name: _name,
|
name: name,
|
||||||
derivation: _newDerivationNbr,
|
derivation: newDerivationNbr,
|
||||||
imageDefaultPath: '${_newWalletNbr % 4}.png');
|
imageDefaultPath: '${newWalletNbr % 4}.png');
|
||||||
|
|
||||||
await walletBox.add(newWallet);
|
await walletBox.add(newWallet);
|
||||||
|
|
||||||
|
@ -144,37 +144,37 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> generateRootWallet(context, String _name) async {
|
Future<void> generateRootWallet(context, String name) async {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
isNewDerivationLoading = true;
|
isNewDerivationLoading = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
int _newWalletNbr;
|
int newWalletNbr;
|
||||||
int? _chest = getCurrentChest();
|
int? chest = getCurrentChest();
|
||||||
|
|
||||||
List<WalletData> _walletConfig = readAllWallets(_chest);
|
List<WalletData> walletConfig = readAllWallets(chest);
|
||||||
|
|
||||||
if (_walletConfig.isEmpty) {
|
if (walletConfig.isEmpty) {
|
||||||
_newWalletNbr = 0;
|
newWalletNbr = 0;
|
||||||
} else {
|
} else {
|
||||||
_newWalletNbr = _walletConfig.last.number! + 1;
|
newWalletNbr = walletConfig.last.number! + 1;
|
||||||
}
|
}
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
WalletData defaultWallet = _myWalletProvider.getDefaultWallet();
|
WalletData defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
|
|
||||||
final address =
|
final address =
|
||||||
await _sub.generateRootKeypair(defaultWallet.address!, pinCode);
|
await sub.generateRootKeypair(defaultWallet.address!, pinCode);
|
||||||
|
|
||||||
WalletData newWallet = WalletData(
|
WalletData newWallet = WalletData(
|
||||||
version: dataVersion,
|
version: dataVersion,
|
||||||
chest: _chest,
|
chest: chest,
|
||||||
address: address,
|
address: address,
|
||||||
number: _newWalletNbr,
|
number: newWalletNbr,
|
||||||
name: _name,
|
name: name,
|
||||||
derivation: -1,
|
derivation: -1,
|
||||||
imageDefaultPath: '${_newWalletNbr % 4}.png');
|
imageDefaultPath: '${newWalletNbr % 4}.png');
|
||||||
|
|
||||||
await walletBox.add(newWallet);
|
await walletBox.add(newWallet);
|
||||||
|
|
||||||
|
@ -184,29 +184,29 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
|
|
||||||
List<int> getNextWalletNumberAndDerivation(
|
List<int> getNextWalletNumberAndDerivation(
|
||||||
{int? chestNumber, bool isOneshoot = false}) {
|
{int? chestNumber, bool isOneshoot = false}) {
|
||||||
int _newDerivationNbr = 0;
|
int newDerivationNbr = 0;
|
||||||
int _newWalletNbr = 0;
|
int newWalletNbr = 0;
|
||||||
|
|
||||||
chestNumber ??= getCurrentChest();
|
chestNumber ??= getCurrentChest();
|
||||||
|
|
||||||
List<WalletData> _walletConfig = readAllWallets(chestNumber);
|
List<WalletData> walletConfig = readAllWallets(chestNumber);
|
||||||
|
|
||||||
if (_walletConfig.isEmpty) {
|
if (walletConfig.isEmpty) {
|
||||||
_newDerivationNbr = 2;
|
newDerivationNbr = 2;
|
||||||
} else {
|
} else {
|
||||||
WalletData _lastWallet = _walletConfig.reduce(
|
WalletData lastWallet = walletConfig.reduce(
|
||||||
(curr, next) => curr.derivation! > next.derivation! ? curr : next);
|
(curr, next) => curr.derivation! > next.derivation! ? curr : next);
|
||||||
|
|
||||||
if (_lastWallet.derivation == -1) {
|
if (lastWallet.derivation == -1) {
|
||||||
_newDerivationNbr = 2;
|
newDerivationNbr = 2;
|
||||||
} else {
|
} else {
|
||||||
_newDerivationNbr = _lastWallet.derivation! + (isOneshoot ? 1 : 2);
|
newDerivationNbr = lastWallet.derivation! + (isOneshoot ? 1 : 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
_newWalletNbr = _walletConfig.last.number! + 1;
|
newWalletNbr = walletConfig.last.number! + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [_newWalletNbr, _newDerivationNbr];
|
return [newWalletNbr, newDerivationNbr];
|
||||||
}
|
}
|
||||||
|
|
||||||
int lockPin = 0;
|
int lockPin = 0;
|
||||||
|
|
|
@ -68,12 +68,12 @@ class SearchProvider with ChangeNotifier {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Future<List<G1WalletsList>> searchAddress() async {
|
Future<List<G1WalletsList>> searchAddress() async {
|
||||||
final WalletsProfilesProvider _walletProfiles =
|
final WalletsProfilesProvider walletProfiles =
|
||||||
WalletsProfilesProvider('pubkey');
|
WalletsProfilesProvider('pubkey');
|
||||||
|
|
||||||
if (_walletProfiles.isAddress(searchController.text)) {
|
if (walletProfiles.isAddress(searchController.text)) {
|
||||||
G1WalletsList _wallet = G1WalletsList(pubkey: searchController.text);
|
G1WalletsList wallet = G1WalletsList(pubkey: searchController.text);
|
||||||
return [_wallet];
|
return [wallet];
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// ignore_for_file: avoid_print
|
|
||||||
|
|
||||||
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:flutter/services.dart';
|
||||||
|
@ -46,7 +44,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> connectNode(BuildContext ctx) async {
|
Future<void> connectNode(BuildContext ctx) async {
|
||||||
HomeProvider _homeProvider = Provider.of<HomeProvider>(ctx, listen: false);
|
HomeProvider homeProvider = Provider.of<HomeProvider>(ctx, listen: false);
|
||||||
|
|
||||||
// var connectivityResult = await (Connectivity().checkConnectivity());
|
// var connectivityResult = await (Connectivity().checkConnectivity());
|
||||||
// if (connectivityResult == ConnectivityResult.mobile ||
|
// if (connectivityResult == ConnectivityResult.mobile ||
|
||||||
|
@ -54,7 +52,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
// _homeProvider.changeMessage("Vous n'êtes pas connecté à internet", 0);
|
// _homeProvider.changeMessage("Vous n'êtes pas connecté à internet", 0);
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
_homeProvider.changeMessage("connectionPending".tr(), 0);
|
homeProvider.changeMessage("connectionPending".tr(), 0);
|
||||||
|
|
||||||
// configBox.delete('customEndpoint');
|
// configBox.delete('customEndpoint');
|
||||||
final List<NetworkParams> listEndpoints =
|
final List<NetworkParams> listEndpoints =
|
||||||
|
@ -108,7 +106,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
// log.d(sdk.api.connectedNode?.endpoint);
|
// log.d(sdk.api.connectedNode?.endpoint);
|
||||||
if (sdk.api.connectedNode?.endpoint == null) {
|
if (sdk.api.connectedNode?.endpoint == null) {
|
||||||
nodeConnected = false;
|
nodeConnected = false;
|
||||||
_homeProvider.changeMessage("networkLost".tr(), 0);
|
homeProvider.changeMessage("networkLost".tr(), 0);
|
||||||
} else {
|
} else {
|
||||||
nodeConnected = true;
|
nodeConnected = true;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +115,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
|
|
||||||
// currencyName = await getCurencyName();
|
// currencyName = await getCurencyName();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
_homeProvider.changeMessage(
|
homeProvider.changeMessage(
|
||||||
"wellConnectedToNode"
|
"wellConnectedToNode"
|
||||||
.tr(args: [getConnectedEndpoint()!.split('/')[2]]),
|
.tr(args: [getConnectedEndpoint()!.split('/')[2]]),
|
||||||
5);
|
5);
|
||||||
|
@ -126,7 +124,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
nodeConnected = false;
|
nodeConnected = false;
|
||||||
debugConnection = res.toString();
|
debugConnection = res.toString();
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
_homeProvider.changeMessage("noDuniterEndointAvailable".tr(), 0);
|
homeProvider.changeMessage("noDuniterEndointAvailable".tr(), 0);
|
||||||
// snackNode(ctx, false);
|
// snackNode(ctx, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,10 +134,10 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
List<NetworkParams> getDuniterBootstrap() {
|
List<NetworkParams> getDuniterBootstrap() {
|
||||||
List<NetworkParams> node = [];
|
List<NetworkParams> node = [];
|
||||||
|
|
||||||
for (String _endpoint in configBox.get('endpoint')) {
|
for (String endpoint in configBox.get('endpoint')) {
|
||||||
final n = NetworkParams();
|
final n = NetworkParams();
|
||||||
n.name = currencyName;
|
n.name = currencyName;
|
||||||
n.endpoint = _endpoint;
|
n.endpoint = endpoint;
|
||||||
n.ss58 = ss58;
|
n.ss58 = ss58;
|
||||||
node.add(n);
|
node.add(n);
|
||||||
}
|
}
|
||||||
|
@ -199,7 +197,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
});
|
});
|
||||||
if (json == null) return '';
|
if (json == null) return '';
|
||||||
print(json);
|
log.d(json);
|
||||||
try {
|
try {
|
||||||
await sdk.api.keyring.addAccount(
|
await sdk.api.keyring.addAccount(
|
||||||
keyring,
|
keyring,
|
||||||
|
@ -209,7 +207,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
);
|
);
|
||||||
// Clipboard.setData(ClipboardData(text: jsonEncode(acc.toJson())));
|
// Clipboard.setData(ClipboardData(text: jsonEncode(acc.toJson())));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
log.e(e);
|
||||||
importIsLoading = false;
|
importIsLoading = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
@ -247,11 +245,11 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
.evalJavascript('api.query.identity.identityIndexOf("$address")');
|
.evalJavascript('api.query.identity.identityIndexOf("$address")');
|
||||||
// log.d('u32: ' + idtyIndex.toString());
|
// log.d('u32: ' + idtyIndex.toString());
|
||||||
|
|
||||||
final _certsReceiver = await sdk.webView!
|
final certsReceiver = await sdk.webView!
|
||||||
.evalJavascript('api.query.cert.storageIdtyCertMeta($idtyIndex)') ??
|
.evalJavascript('api.query.cert.storageIdtyCertMeta($idtyIndex)') ??
|
||||||
[];
|
[];
|
||||||
|
|
||||||
return [_certsReceiver['receivedCount'], _certsReceiver['issuedCount']];
|
return [certsReceiver['receivedCount'], certsReceiver['issuedCount']];
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map> getCertData(String from, String to) async {
|
Future<Map> getCertData(String from, String to) async {
|
||||||
|
@ -261,22 +259,22 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
final idtyIndexTo = await sdk.webView!
|
final idtyIndexTo = await sdk.webView!
|
||||||
.evalJavascript('api.query.identity.identityIndexOf("$to")');
|
.evalJavascript('api.query.identity.identityIndexOf("$to")');
|
||||||
|
|
||||||
final _certData = await sdk.webView!.evalJavascript(
|
final certData = await sdk.webView!.evalJavascript(
|
||||||
'api.query.cert.storageCertsByIssuer($idtyIndexFrom, $idtyIndexTo)') ??
|
'api.query.cert.storageCertsByIssuer($idtyIndexFrom, $idtyIndexTo)') ??
|
||||||
'';
|
'';
|
||||||
|
|
||||||
if (_certData == '') return {};
|
if (certData == '') return {};
|
||||||
|
|
||||||
// log.d(_certData);
|
// log.d(_certData);
|
||||||
return _certData;
|
return certData;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> hasAccountConsumers(String address) async {
|
Future<bool> hasAccountConsumers(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 _consumers = _accountInfo['consumers'];
|
final consumers = accountInfo['consumers'];
|
||||||
// log.d('Consumers: $_consumers');
|
// log.d('Consumers: $_consumers');
|
||||||
return _consumers == 0 ? false : true;
|
return consumers == 0 ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<double> getBalance(String address, {bool isUd = false}) async {
|
Future<double> getBalance(String address, {bool isUd = false}) async {
|
||||||
|
@ -295,8 +293,8 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
Future<double> subscribeBalance(String address, {bool isUd = false}) async {
|
Future<double> subscribeBalance(String address, {bool isUd = false}) async {
|
||||||
double balance = 0.0;
|
double balance = 0.0;
|
||||||
if (nodeConnected) {
|
if (nodeConnected) {
|
||||||
await sdk.api.account.subscribeBalance(address, (_balance) {
|
await sdk.api.account.subscribeBalance(address, (balanceData) {
|
||||||
balance = int.parse(_balance.freeBalance) / 100;
|
balance = int.parse(balanceData.freeBalance) / 100;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -316,21 +314,21 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
return await sdk.api.keyring.checkPassword(account, pass);
|
return await sdk.api.keyring.checkPassword(account, pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> getSeed(String address, String _pin) async {
|
Future<String> getSeed(String address, String pin) async {
|
||||||
final account = getKeypair(address);
|
final account = getKeypair(address);
|
||||||
keyring.setCurrent(account);
|
keyring.setCurrent(account);
|
||||||
|
|
||||||
final _seed = await sdk.api.keyring.getDecryptedSeed(keyring, _pin);
|
final seed = await sdk.api.keyring.getDecryptedSeed(keyring, pin);
|
||||||
|
|
||||||
String _seedText;
|
String seedText;
|
||||||
if (_seed == null) {
|
if (seed == null) {
|
||||||
_seedText = '';
|
seedText = '';
|
||||||
} else {
|
} else {
|
||||||
_seedText = _seed.seed!.split('//')[0];
|
seedText = seed.seed!.split('//')[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
log.d(_seedText);
|
log.d(seedText);
|
||||||
return _seedText;
|
return seedText;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getDerivationNumber(String address) {
|
int getDerivationNumber(String address) {
|
||||||
|
@ -342,10 +340,10 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
Future<KeyPairData?> changePassword(BuildContext context, String address,
|
Future<KeyPairData?> changePassword(BuildContext context, String address,
|
||||||
String passOld, String? passNew) async {
|
String passOld, String? passNew) async {
|
||||||
final account = getKeypair(address);
|
final account = getKeypair(address);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
keyring.setCurrent(account);
|
keyring.setCurrent(account);
|
||||||
_myWalletProvider.resetPinCode();
|
myWalletProvider.resetPinCode();
|
||||||
|
|
||||||
return await sdk.api.keyring.changePassword(keyring, passOld, passNew);
|
return await sdk.api.keyring.changePassword(keyring, passOld, passNew);
|
||||||
}
|
}
|
||||||
|
@ -372,14 +370,14 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
return gen.mnemonic!;
|
return gen.mnemonic!;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> setCurrentWallet(WalletData _wallet) async {
|
Future<String> setCurrentWallet(WalletData wallet) async {
|
||||||
final currentChestNumber = configBox.get('currentChest');
|
final currentChestNumber = configBox.get('currentChest');
|
||||||
ChestData _newChestData = chestBox.get(currentChestNumber)!;
|
ChestData newChestData = chestBox.get(currentChestNumber)!;
|
||||||
_newChestData.defaultWallet = _wallet.number;
|
newChestData.defaultWallet = wallet.number;
|
||||||
await chestBox.put(currentChestNumber, _newChestData);
|
await chestBox.put(currentChestNumber, newChestData);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final acc = getKeypair(_wallet.address!);
|
final acc = getKeypair(wallet.address!);
|
||||||
keyring.setCurrent(acc);
|
keyring.setCurrent(acc);
|
||||||
return acc.address!;
|
return acc.address!;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -426,7 +424,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
[destAddress, amount == -1 ? false : amountUnit],
|
[destAddress, amount == -1 ? false : amountUnit],
|
||||||
password,
|
password,
|
||||||
onStatusChange: (status) {
|
onStatusChange: (status) {
|
||||||
log.d('Transaction status: ' + status);
|
log.d('Transaction status: $status');
|
||||||
transactionStatus = status;
|
transactionStatus = status;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
},
|
},
|
||||||
|
@ -457,16 +455,16 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
transactionStatus = '';
|
transactionStatus = '';
|
||||||
|
|
||||||
// setCurrentWallet(fromAddress);
|
// setCurrentWallet(fromAddress);
|
||||||
log.d('me: ' + fromAddress);
|
log.d('me: $fromAddress');
|
||||||
log.d('to: ' + toAddress);
|
log.d('to: $toAddress');
|
||||||
|
|
||||||
final _myIdtyStatus = await idtyStatus(fromAddress);
|
final myIdtyStatus = await idtyStatus(fromAddress);
|
||||||
final _toIdtyStatus = await idtyStatus(toAddress);
|
final toIdtyStatus = await idtyStatus(toAddress);
|
||||||
|
|
||||||
log.d(_myIdtyStatus);
|
log.d(myIdtyStatus);
|
||||||
log.d(_toIdtyStatus);
|
log.d(toIdtyStatus);
|
||||||
|
|
||||||
if (_myIdtyStatus != 'Validated') {
|
if (myIdtyStatus != 'Validated') {
|
||||||
transactionStatus = 'notMember';
|
transactionStatus = 'notMember';
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
return 'notMember';
|
return 'notMember';
|
||||||
|
@ -478,14 +476,14 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
);
|
);
|
||||||
TxInfoData txInfo;
|
TxInfoData txInfo;
|
||||||
|
|
||||||
if (_toIdtyStatus == 'noid') {
|
if (toIdtyStatus == 'noid') {
|
||||||
txInfo = TxInfoData(
|
txInfo = TxInfoData(
|
||||||
'identity',
|
'identity',
|
||||||
'createIdentity',
|
'createIdentity',
|
||||||
sender,
|
sender,
|
||||||
);
|
);
|
||||||
} else if (_toIdtyStatus == 'Validated' ||
|
} else if (toIdtyStatus == 'Validated' ||
|
||||||
_toIdtyStatus == 'ConfirmedByOwner') {
|
toIdtyStatus == 'ConfirmedByOwner') {
|
||||||
txInfo = TxInfoData(
|
txInfo = TxInfoData(
|
||||||
'cert',
|
'cert',
|
||||||
'addCert',
|
'addCert',
|
||||||
|
@ -497,7 +495,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
return 'cantBeCert';
|
return 'cantBeCert';
|
||||||
}
|
}
|
||||||
|
|
||||||
log.d('Cert action: ' + txInfo.call!);
|
log.d('Cert action: ${txInfo.call!}');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final hash = await sdk.api.tx
|
final hash = await sdk.api.tx
|
||||||
|
@ -543,9 +541,9 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
.evalJavascript('api.query.identity.identities($idtyIndex)');
|
.evalJavascript('api.query.identity.identities($idtyIndex)');
|
||||||
|
|
||||||
if (idtyStatus != null) {
|
if (idtyStatus != null) {
|
||||||
final String _status = idtyStatus['status'];
|
final String status = idtyStatus['status'];
|
||||||
// log.d('Status $address: $_status');
|
// log.d('Status $address: $_status');
|
||||||
return (_status);
|
return (status);
|
||||||
} else {
|
} else {
|
||||||
return 'expired';
|
return 'expired';
|
||||||
}
|
}
|
||||||
|
@ -555,7 +553,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
String fromAddress, String name, String password) async {
|
String fromAddress, String name, String password) async {
|
||||||
// Confirm identity
|
// Confirm identity
|
||||||
// setCurrentWallet(fromAddress);
|
// setCurrentWallet(fromAddress);
|
||||||
log.d('me: ' + keyring.current.address!);
|
log.d('me: ${keyring.current.address!}');
|
||||||
|
|
||||||
final sender = TxSenderData(
|
final sender = TxSenderData(
|
||||||
keyring.current.address,
|
keyring.current.address,
|
||||||
|
@ -574,7 +572,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
[name],
|
[name],
|
||||||
password,
|
password,
|
||||||
onStatusChange: (status) {
|
onStatusChange: (status) {
|
||||||
log.d('Transaction status: ' + status);
|
log.d('Transaction status: $status');
|
||||||
transactionStatus = status;
|
transactionStatus = status;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
},
|
},
|
||||||
|
@ -601,7 +599,7 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> isMember(String address) async {
|
Future<bool> isMemberGet(String address) async {
|
||||||
return await idtyStatus(address) == 'Validated';
|
return await idtyStatus(address) == 'Validated';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,13 +607,13 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
// TODOO: Continue digging memberAddress detection
|
// TODOO: Continue digging memberAddress detection
|
||||||
String memberAddress = '';
|
String memberAddress = '';
|
||||||
walletBox.toMap().forEach((key, value) async {
|
walletBox.toMap().forEach((key, value) async {
|
||||||
final bool _isMember = await isMember(value.address!);
|
final bool isMember = await isMemberGet(value.address!);
|
||||||
log.d(_isMember);
|
log.d(isMember);
|
||||||
if (_isMember) {
|
if (isMember) {
|
||||||
final currentChestNumber = configBox.get('currentChest');
|
final currentChestNumber = configBox.get('currentChest');
|
||||||
ChestData _newChestData = chestBox.get(currentChestNumber)!;
|
ChestData newChestData = chestBox.get(currentChestNumber)!;
|
||||||
_newChestData.memberWallet = value.number;
|
newChestData.memberWallet = value.number;
|
||||||
await chestBox.put(currentChestNumber, _newChestData);
|
await chestBox.put(currentChestNumber, newChestData);
|
||||||
memberAddress = value.address!;
|
memberAddress = value.address!;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -625,39 +623,39 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, int>> certState(String from, String to) async {
|
Future<Map<String, int>> certState(String from, String to) async {
|
||||||
Map<String, int> _result = {};
|
Map<String, int> result = {};
|
||||||
if (from != to && await isMember(from)) {
|
if (from != to && await isMemberGet(from)) {
|
||||||
final _certData = await getCertData(from, to);
|
final certData = await getCertData(from, to);
|
||||||
final _certMeta = await getCertMeta(from);
|
final certMeta = await getCertMeta(from);
|
||||||
final int _removableOn = _certData['removableOn'] ?? 0;
|
final int removableOn = certData['removableOn'] ?? 0;
|
||||||
final int _nextIssuableOn = _certMeta['nextIssuableOn'] ?? 0;
|
final int nextIssuableOn = certMeta['nextIssuableOn'] ?? 0;
|
||||||
final certRemovableDuration = (_removableOn - blocNumber) * 6;
|
final certRemovableDuration = (removableOn - blocNumber) * 6;
|
||||||
const int renewDelay = 2 * 30 * 24 * 3600; // 2 months
|
const int renewDelay = 2 * 30 * 24 * 3600; // 2 months
|
||||||
|
|
||||||
if (certRemovableDuration >= renewDelay) {
|
if (certRemovableDuration >= renewDelay) {
|
||||||
final certRenewDuration = certRemovableDuration - renewDelay;
|
final certRenewDuration = certRemovableDuration - renewDelay;
|
||||||
_result.putIfAbsent('certRenewable', () => certRenewDuration);
|
result.putIfAbsent('certRenewable', () => certRenewDuration);
|
||||||
} else if (_nextIssuableOn > blocNumber) {
|
} else if (nextIssuableOn > blocNumber) {
|
||||||
final certDelayDuration = (_nextIssuableOn - blocNumber) * 6;
|
final certDelayDuration = (nextIssuableOn - blocNumber) * 6;
|
||||||
_result.putIfAbsent('certDelay', () => certDelayDuration);
|
result.putIfAbsent('certDelay', () => certDelayDuration);
|
||||||
} else {
|
} else {
|
||||||
_result.putIfAbsent('canCert', () => 0);
|
result.putIfAbsent('canCert', () => 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map> getCertMeta(String address) async {
|
Future<Map> getCertMeta(String address) async {
|
||||||
var idtyIndex = await sdk.webView!
|
var idtyIndex = await sdk.webView!
|
||||||
.evalJavascript('api.query.identity.identityIndexOf("$address")');
|
.evalJavascript('api.query.identity.identityIndexOf("$address")');
|
||||||
|
|
||||||
final _certMeta = await sdk.webView!
|
final certMeta = await sdk.webView!
|
||||||
.evalJavascript('api.query.cert.storageIdtyCertMeta($idtyIndex)') ??
|
.evalJavascript('api.query.cert.storageIdtyCertMeta($idtyIndex)') ??
|
||||||
'';
|
'';
|
||||||
// if (_certMeta['nextIssuableOn'] != 0) return {};
|
// if (_certMeta['nextIssuableOn'] != 0) return {};
|
||||||
|
|
||||||
// log.d(_certMeta);
|
// log.d(_certMeta);
|
||||||
return _certMeta;
|
return certMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future revokeIdentity(String address, String password) async {
|
Future revokeIdentity(String address, String password) async {
|
||||||
|
@ -767,19 +765,19 @@ class AddressInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
void snackNode(BuildContext context, bool isConnected) {
|
void snackNode(BuildContext context, bool isConnected) {
|
||||||
String _message;
|
String message;
|
||||||
if (!isConnected) {
|
if (!isConnected) {
|
||||||
_message = "noDuniterNodeAvailableTryLater".tr() +
|
message =
|
||||||
":\n${configBox.get('endpoint').first}";
|
"${"noDuniterNodeAvailableTryLater".tr()}:\n${configBox.get('endpoint').first}";
|
||||||
} else {
|
} else {
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
_message = "youAreConnectedToNode".tr() +
|
message =
|
||||||
"\n${_sub.getConnectedEndpoint()!.split('//')[1]}";
|
"${"youAreConnectedToNode".tr()}\n${sub.getConnectedEndpoint()!.split('//')[1]}";
|
||||||
}
|
}
|
||||||
final snackBar = SnackBar(
|
final snackBar = SnackBar(
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
content: Text(_message, style: const TextStyle(fontSize: 16)),
|
content: Text(message, style: const TextStyle(fontSize: 16)),
|
||||||
duration: const Duration(seconds: 4));
|
duration: const Duration(seconds: 4));
|
||||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
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';
|
||||||
|
@ -31,43 +33,43 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
|
|
||||||
Future<NewWallet>? get badWallet => null;
|
Future<NewWallet>? get badWallet => null;
|
||||||
|
|
||||||
int getPinLenght(_walletNbr) {
|
int getPinLenght(walletNbr) {
|
||||||
return pinLength;
|
return pinLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _renameWallet(List<int?> _walletID, String _newName,
|
void _renameWallet(List<int?> walletID, String newName,
|
||||||
{required bool isCesium}) async {
|
{required bool isCesium}) async {
|
||||||
MyWalletsProvider myWalletClass = MyWalletsProvider();
|
MyWalletsProvider myWalletClass = MyWalletsProvider();
|
||||||
|
|
||||||
WalletData _walletTarget = myWalletClass.getWalletDataById(_walletID)!;
|
WalletData walletTarget = myWalletClass.getWalletDataById(walletID)!;
|
||||||
_walletTarget.name = _newName;
|
walletTarget.name = newName;
|
||||||
await walletBox.put(_walletTarget.key, _walletTarget);
|
await walletBox.put(walletTarget.key, walletTarget);
|
||||||
|
|
||||||
_newWalletName.text = '';
|
_newWalletName.text = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> deleteWallet(context, WalletData wallet) async {
|
Future<int> deleteWallet(context, WalletData wallet) async {
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
final bool? _answer = await (confirmPopup(
|
final bool? answer = await (confirmPopup(
|
||||||
context, 'areYouSureToForgetWallet'.tr(args: [wallet.name!])));
|
context, 'areYouSureToForgetWallet'.tr(args: [wallet.name!])));
|
||||||
|
|
||||||
if (_answer ?? false) {
|
if (answer ?? false) {
|
||||||
//Check if balance is null
|
//Check if balance is null
|
||||||
final _balance = await _sub.getBalance(wallet.address!);
|
final balance = await sub.getBalance(wallet.address!);
|
||||||
if (_balance != 0) {
|
if (balance != 0) {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
final _defaultWallet = _myWalletProvider.getDefaultWallet();
|
final defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
log.d(_defaultWallet.address);
|
log.d(defaultWallet.address);
|
||||||
_sub.pay(
|
sub.pay(
|
||||||
fromAddress: wallet.address!,
|
fromAddress: wallet.address!,
|
||||||
destAddress: _defaultWallet.address!,
|
destAddress: defaultWallet.address!,
|
||||||
amount: -1,
|
amount: -1,
|
||||||
password: _myWalletProvider.pinCode);
|
password: myWalletProvider.pinCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
await walletBox.delete(wallet.key);
|
await walletBox.delete(wallet.key);
|
||||||
await _sub.deleteAccounts([wallet.address!]);
|
await sub.deleteAccounts([wallet.address!]);
|
||||||
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
|
@ -130,11 +132,11 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
|
|
||||||
Widget idtyStatus(BuildContext context, String address,
|
Widget idtyStatus(BuildContext context, String address,
|
||||||
{bool isOwner = false, Color color = Colors.black}) {
|
{bool isOwner = false, Color color = Colors.black}) {
|
||||||
DuniterIndexer _duniterIndexer =
|
DuniterIndexer duniterIndexer =
|
||||||
Provider.of<DuniterIndexer>(context, listen: false);
|
Provider.of<DuniterIndexer>(context, listen: false);
|
||||||
|
|
||||||
_showText(String text,
|
_showText(String text,
|
||||||
[double size = 18, bool _bold = false, bool smooth = true]) {
|
[double size = 18, bool bold = false, bool smooth = true]) {
|
||||||
log.d(text);
|
log.d(text);
|
||||||
return AnimatedFadeOutIn<String>(
|
return AnimatedFadeOutIn<String>(
|
||||||
data: text,
|
data: text,
|
||||||
|
@ -144,15 +146,15 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: size,
|
fontSize: size,
|
||||||
color: _bold ? color : Colors.black,
|
color: bold ? color : Colors.black,
|
||||||
fontWeight: _bold ? FontWeight.w500 : FontWeight.w400),
|
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),
|
||||||
initialData: '',
|
initialData: '',
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
switch (snapshot.data.toString()) {
|
switch (snapshot.data.toString()) {
|
||||||
|
@ -176,7 +178,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
{
|
{
|
||||||
return isOwner
|
return isOwner
|
||||||
? _showText('identityConfirmed'.tr())
|
? _showText('identityConfirmed'.tr())
|
||||||
: _duniterIndexer.getNameByAddress(
|
: duniterIndexer.getNameByAddress(
|
||||||
context,
|
context,
|
||||||
address,
|
address,
|
||||||
null,
|
null,
|
||||||
|
@ -191,7 +193,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
{
|
{
|
||||||
return isOwner
|
return isOwner
|
||||||
? _showText('memberValidated'.tr(), 18, true)
|
? _showText('memberValidated'.tr(), 18, true)
|
||||||
: _duniterIndexer.getNameByAddress(
|
: duniterIndexer.getNameByAddress(
|
||||||
context,
|
context,
|
||||||
address,
|
address,
|
||||||
null,
|
null,
|
||||||
|
@ -215,16 +217,16 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> isMember(BuildContext context, String address) async {
|
Future<bool> isMember(BuildContext context, String address) async {
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
return await _sub.idtyStatus(address) == 'Validated';
|
return await sub.idtyStatus(address) == 'Validated';
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String?> validateIdentity(BuildContext context) async {
|
Future<String?> validateIdentity(BuildContext context) async {
|
||||||
TextEditingController idtyName = TextEditingController();
|
TextEditingController idtyName = TextEditingController();
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
return showDialog<String>(
|
return showDialog<String>(
|
||||||
|
@ -259,7 +261,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Consumer<WalletOptionsProvider>(
|
Consumer<WalletOptionsProvider>(
|
||||||
builder: (context, _wOptions, _) {
|
builder: (context, wOptions, _) {
|
||||||
return TextButton(
|
return TextButton(
|
||||||
key: const Key('infoPopup'),
|
key: const Key('infoPopup'),
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -274,11 +276,11 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (idtyName.text.length >= 2) {
|
if (idtyName.text.length >= 2) {
|
||||||
WalletData? defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet();
|
myWalletProvider.getDefaultWallet();
|
||||||
|
|
||||||
String? _pin;
|
String? pin;
|
||||||
if (_myWalletProvider.pinCode == '') {
|
if (myWalletProvider.pinCode == '') {
|
||||||
_pin = await Navigator.push(
|
pin = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (homeContext) {
|
builder: (homeContext) {
|
||||||
|
@ -287,12 +289,12 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (_pin != null || _myWalletProvider.pinCode != '') {
|
if (pin != null || myWalletProvider.pinCode != '') {
|
||||||
final _wallet = _myWalletProvider
|
final wallet = myWalletProvider
|
||||||
.getWalletDataByAddress(address.text);
|
.getWalletDataByAddress(address.text);
|
||||||
await _sub.setCurrentWallet(_wallet!);
|
await sub.setCurrentWallet(wallet!);
|
||||||
_sub.confirmIdentity(_walletOptions.address.text,
|
sub.confirmIdentity(walletOptions.address.text,
|
||||||
idtyName.text, _myWalletProvider.pinCode);
|
idtyName.text, myWalletProvider.pinCode);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
|
@ -316,7 +318,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String?> editWalletName(BuildContext context, List<int?> _wID) async {
|
Future<String?> editWalletName(BuildContext context, List<int?> wID) async {
|
||||||
TextEditingController walletName = TextEditingController();
|
TextEditingController walletName = TextEditingController();
|
||||||
canValidateNameBool = false;
|
canValidateNameBool = false;
|
||||||
|
|
||||||
|
@ -348,7 +350,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Consumer<WalletOptionsProvider>(
|
Consumer<WalletOptionsProvider>(
|
||||||
builder: (context, _wOptions, _) {
|
builder: (context, wOptions, _) {
|
||||||
return TextButton(
|
return TextButton(
|
||||||
key: const Key('infoPopup'),
|
key: const Key('infoPopup'),
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -364,7 +366,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (canValidateNameBool) {
|
if (canValidateNameBool) {
|
||||||
nameController.text = walletName.text;
|
nameController.text = walletName.text;
|
||||||
_renameWallet(_wID, walletName.text, isCesium: false);
|
_renameWallet(wID, walletName.text, isCesium: false);
|
||||||
// notifyListeners();
|
// notifyListeners();
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
|
@ -399,7 +401,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool canValidateName(BuildContext context, TextEditingController walletName) {
|
bool canValidateName(BuildContext context, TextEditingController walletName) {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
bool isNameValid = walletName.text.length >= 2 &&
|
bool isNameValid = walletName.text.length >= 2 &&
|
||||||
|
@ -407,7 +409,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
walletName.text.length <= 39;
|
walletName.text.length <= 39;
|
||||||
|
|
||||||
if (isNameValid) {
|
if (isNameValid) {
|
||||||
for (var wallet in _myWalletProvider.listWallets) {
|
for (var wallet in myWalletProvider.listWallets) {
|
||||||
if (walletName.text == wallet.name!) {
|
if (walletName.text == wallet.name!) {
|
||||||
canValidateNameBool = false;
|
canValidateNameBool = false;
|
||||||
break;
|
break;
|
||||||
|
@ -432,26 +434,22 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
String? getAddress(int chest, int derivation) {
|
String? getAddress(int chest, int derivation) {
|
||||||
String? _address;
|
String? addressGet;
|
||||||
walletBox.toMap().forEach((key, value) {
|
walletBox.toMap().forEach((key, value) {
|
||||||
if (value.chest == chest && value.derivation == derivation) {
|
if (value.chest == chest && value.derivation == derivation) {
|
||||||
_address = value.address!;
|
addressGet = value.address!;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
address.text = _address ?? '';
|
address.text = addressGet ?? '';
|
||||||
|
|
||||||
return _address;
|
return addressGet;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget walletNameController(BuildContext context, WalletData wallet,
|
Widget walletNameController(BuildContext context, WalletData wallet,
|
||||||
[double size = 20]) {
|
[double size = 20]) {
|
||||||
// WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
log.d('aaaaaaaaaaaaaaaaaaaaa: ${wallet.name}');
|
|
||||||
nameController.text = wallet.name!;
|
nameController.text = wallet.name!;
|
||||||
// _walletOptions.reloadBuild();
|
|
||||||
// });
|
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 260,
|
width: 260,
|
||||||
|
@ -527,39 +525,39 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
Map<String, double> balanceCache = {};
|
Map<String, double> balanceCache = {};
|
||||||
|
|
||||||
Widget balance(BuildContext context, String address, double size,
|
Widget balance(BuildContext context, String address, double size,
|
||||||
[Color _color = Colors.black,
|
[Color color = Colors.black,
|
||||||
Color _loadingColor = const Color(0xffd07316)]) {
|
Color loadingColor = const Color(0xffd07316)]) {
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sdk, _) {
|
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||||
return FutureBuilder(
|
return FutureBuilder(
|
||||||
future: _sdk.getBalance(address),
|
future: sdk.getBalance(address),
|
||||||
builder: (BuildContext context, AsyncSnapshot<double> _balance) {
|
builder: (BuildContext context, AsyncSnapshot<double> balance) {
|
||||||
if (_balance.connectionState != ConnectionState.done ||
|
if (balance.connectionState != ConnectionState.done ||
|
||||||
_balance.hasError) {
|
balance.hasError) {
|
||||||
if (balanceCache[address] != null &&
|
if (balanceCache[address] != null &&
|
||||||
balanceCache[address] != -1) {
|
balanceCache[address] != -1) {
|
||||||
return Text(
|
return Text(
|
||||||
"${balanceCache[address]!.toString()} $currencyName",
|
"${balanceCache[address]!.toString()} $currencyName",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: isTall ? size : size * 0.9, color: _color));
|
fontSize: isTall ? size : size * 0.9, color: color));
|
||||||
} else {
|
} else {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
width: 15,
|
width: 15,
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
color: _loadingColor,
|
color: loadingColor,
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
balanceCache[address] = _balance.data!;
|
balanceCache[address] = balance.data!;
|
||||||
if (balanceCache[address] != -1) {
|
if (balanceCache[address] != -1) {
|
||||||
return Text(
|
return Text(
|
||||||
"${balanceCache[address]!.toString()} $currencyName",
|
"${balanceCache[address]!.toString()} $currencyName",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: isTall ? size : size * 0.9,
|
fontSize: isTall ? size : size * 0.9,
|
||||||
color: _color,
|
color: color,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -571,24 +569,24 @@ Widget balance(BuildContext context, String address, double size,
|
||||||
}
|
}
|
||||||
|
|
||||||
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<int>> _certs) {
|
builder: (BuildContext context, AsyncSnapshot<List<int>> certs) {
|
||||||
// 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(
|
? Row(
|
||||||
children: [
|
children: [
|
||||||
Image.asset('assets/medal.png', height: 20),
|
Image.asset('assets/medal.png', height: 20),
|
||||||
const SizedBox(width: 1),
|
const SizedBox(width: 1),
|
||||||
Text(_certs.data?[0].toString() ?? '0',
|
Text(certs.data?[0].toString() ?? '0',
|
||||||
style: const TextStyle(fontSize: 20)),
|
style: const TextStyle(fontSize: 20)),
|
||||||
const SizedBox(width: 5),
|
const SizedBox(width: 5),
|
||||||
Text(
|
Text(
|
||||||
"(${_certs.data?[1].toString() ?? '0'})",
|
"(${certs.data?[1].toString() ?? '0'})",
|
||||||
style: const TextStyle(fontSize: 14),
|
style: const TextStyle(fontSize: 14),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|
|
@ -100,8 +100,8 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
String generateIdenticon(String _pubkey) {
|
String generateIdenticon(String pubkey) {
|
||||||
return Jdenticon.toSvg(_pubkey);
|
return Jdenticon.toSvg(pubkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future<num> getBalance(String _pubkey) async {
|
// Future<num> getBalance(String _pubkey) async {
|
||||||
|
@ -119,7 +119,7 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
// return balance;
|
// return balance;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Future<num?> getBalance(String? _pubkey) async {
|
Future<num?> getBalance(String? pubkey) async {
|
||||||
while (_balance == null) {
|
while (_balance == null) {
|
||||||
await Future.delayed(const Duration(milliseconds: 50));
|
await Future.delayed(const Duration(milliseconds: 50));
|
||||||
}
|
}
|
||||||
|
@ -128,19 +128,19 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget headerProfileView(
|
Widget headerProfileView(
|
||||||
BuildContext context, String _address, String? username) {
|
BuildContext context, String address, String? username) {
|
||||||
const double _avatarSize = 140;
|
const double avatarSize = 140;
|
||||||
|
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
CesiumPlusProvider _cesiumPlusProvider =
|
CesiumPlusProvider cesiumPlusProvider =
|
||||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
bool isAccountExist = balanceCache[_address] != 0;
|
bool isAccountExist = balanceCache[address] != 0;
|
||||||
|
|
||||||
return Stack(children: <Widget>[
|
return Stack(children: <Widget>[
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 180,
|
height: 180,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
@ -168,11 +168,11 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
key: const Key('copyPubkey'),
|
key: const Key('copyPubkey'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Clipboard.setData(ClipboardData(text: _address));
|
Clipboard.setData(ClipboardData(text: address));
|
||||||
snackCopyKey(context);
|
snackCopyKey(context);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
getShortPubkey(_address),
|
getShortPubkey(address),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 30,
|
fontSize: 30,
|
||||||
fontWeight: FontWeight.w800,
|
fontWeight: FontWeight.w800,
|
||||||
|
@ -181,17 +181,17 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
balance(context, _address, 22),
|
balance(context, address, 22),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
_walletOptions.idtyStatus(context, _address,
|
walletOptions.idtyStatus(context, address,
|
||||||
isOwner: false, color: Colors.black),
|
isOwner: false, color: Colors.black),
|
||||||
getCerts(context, _address, 14),
|
getCerts(context, address, 14),
|
||||||
if (username == null &&
|
if (username == null &&
|
||||||
g1WalletsBox.get(_address)?.username != null)
|
g1WalletsBox.get(address)?.username != null)
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 230,
|
width: 230,
|
||||||
child: Text(
|
child: Text(
|
||||||
g1WalletsBox.get(_address)?.username ?? '',
|
g1WalletsBox.get(address)?.username ?? '',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 27,
|
fontSize: 27,
|
||||||
color: Color(0xff814C00),
|
color: Color(0xff814C00),
|
||||||
|
@ -214,7 +214,7 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
ClipOval(
|
ClipOval(
|
||||||
child: _cesiumPlusProvider.defaultAvatar(_avatarSize),
|
child: cesiumPlusProvider.defaultAvatar(avatarSize),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
]),
|
]),
|
||||||
|
|
|
@ -30,9 +30,9 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
WalletsProfilesProvider _walletProfile =
|
WalletsProfilesProvider walletProfile =
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
HomeProvider _homeProvider =
|
HomeProvider homeProvider =
|
||||||
Provider.of<HomeProvider>(context, listen: false);
|
Provider.of<HomeProvider>(context, listen: false);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -45,15 +45,15 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
child: Text('accountActivity'.tr()),
|
child: Text('accountActivity'.tr()),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: _homeProvider.bottomAppBar(context),
|
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||||
body: Column(children: <Widget>[
|
body: Column(children: <Widget>[
|
||||||
_walletProfile.headerProfileView(context, address!, username),
|
walletProfile.headerProfileView(context, address!, username),
|
||||||
historyQuery(context),
|
historyQuery(context),
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget historyQuery(context) {
|
Widget historyQuery(context) {
|
||||||
DuniterIndexer _duniterIndexer =
|
DuniterIndexer duniterIndexer =
|
||||||
Provider.of<DuniterIndexer>(context, listen: false);
|
Provider.of<DuniterIndexer>(context, listen: false);
|
||||||
|
|
||||||
if (indexerEndpoint == '') {
|
if (indexerEndpoint == '') {
|
||||||
|
@ -67,19 +67,19 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
final _httpLink = HttpLink(
|
final httpLink = HttpLink(
|
||||||
'$indexerEndpoint/v1beta1/relay',
|
'$indexerEndpoint/v1beta1/relay',
|
||||||
);
|
);
|
||||||
|
|
||||||
final _client = ValueNotifier(
|
final client = ValueNotifier(
|
||||||
GraphQLClient(
|
GraphQLClient(
|
||||||
cache: GraphQLCache(),
|
cache: GraphQLCache(),
|
||||||
link: _httpLink,
|
link: httpLink,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return GraphQLProvider(
|
return GraphQLProvider(
|
||||||
client: _client,
|
client: client,
|
||||||
child: Expanded(
|
child: Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
@ -102,7 +102,7 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.hasException) {
|
if (result.hasException) {
|
||||||
log.e('Error Indexer: ' + result.exception.toString());
|
log.e('Error Indexer: ${result.exception}');
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
const SizedBox(height: 50),
|
const SizedBox(height: 50),
|
||||||
Text(
|
Text(
|
||||||
|
@ -124,7 +124,7 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
|
|
||||||
if (result.isNotLoading) {
|
if (result.isNotLoading) {
|
||||||
// log.d(result.data);
|
// log.d(result.data);
|
||||||
opts = _duniterIndexer.checkQueryResult(result, opts, address!);
|
opts = duniterIndexer.checkQueryResult(result, opts, address!);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build history list
|
// Build history list
|
||||||
|
@ -142,7 +142,7 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
if (t is ScrollEndNotification &&
|
if (t is ScrollEndNotification &&
|
||||||
scrollController.position.pixels >=
|
scrollController.position.pixels >=
|
||||||
scrollController.position.maxScrollExtent * 0.7 &&
|
scrollController.position.maxScrollExtent * 0.7 &&
|
||||||
_duniterIndexer.pageInfo!['hasNextPage'] &&
|
duniterIndexer.pageInfo!['hasNextPage'] &&
|
||||||
result.isNotLoading) {
|
result.isNotLoading) {
|
||||||
fetchMore!(opts!);
|
fetchMore!(opts!);
|
||||||
}
|
}
|
||||||
|
@ -156,10 +156,10 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget historyView(context, result) {
|
Widget historyView(context, result) {
|
||||||
DuniterIndexer _duniterIndexer =
|
DuniterIndexer duniterIndexer =
|
||||||
Provider.of<DuniterIndexer>(context, listen: false);
|
Provider.of<DuniterIndexer>(context, listen: false);
|
||||||
|
|
||||||
return _duniterIndexer.transBC == null
|
return duniterIndexer.transBC == null
|
||||||
? Column(children: <Widget>[
|
? Column(children: <Widget>[
|
||||||
const SizedBox(height: 50),
|
const SizedBox(height: 50),
|
||||||
Text(
|
Text(
|
||||||
|
@ -168,16 +168,15 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
: Column(children: <Widget>[
|
: Column(children: <Widget>[
|
||||||
getTransactionTile(context, _duniterIndexer),
|
getTransactionTile(context, duniterIndexer),
|
||||||
if (result.isLoading &&
|
if (result.isLoading && duniterIndexer.pageInfo!['hasPreviousPage'])
|
||||||
_duniterIndexer.pageInfo!['hasPreviousPage'])
|
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: const <Widget>[
|
children: const <Widget>[
|
||||||
CircularProgressIndicator(),
|
CircularProgressIndicator(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (!_duniterIndexer.pageInfo!['hasNextPage'])
|
if (!duniterIndexer.pageInfo!['hasNextPage'])
|
||||||
Column(
|
Column(
|
||||||
children: const <Widget>[
|
children: const <Widget>[
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
|
@ -191,13 +190,13 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget getTransactionTile(
|
Widget getTransactionTile(
|
||||||
BuildContext context, DuniterIndexer _duniterIndexer) {
|
BuildContext context, DuniterIndexer duniterIndexer) {
|
||||||
CesiumPlusProvider _cesiumPlusProvider =
|
CesiumPlusProvider cesiumPlusProvider =
|
||||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
int keyID = 0;
|
int keyID = 0;
|
||||||
String? dateDelimiter;
|
String? dateDelimiter;
|
||||||
String? lastDateDelimiter;
|
String? lastDateDelimiter;
|
||||||
const double _avatarSize = 200;
|
const double avatarSize = 200;
|
||||||
|
|
||||||
bool isTody = false;
|
bool isTody = false;
|
||||||
bool isYesterday = false;
|
bool isYesterday = false;
|
||||||
|
@ -219,7 +218,7 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
};
|
};
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: _duniterIndexer.transBC!.map((repository) {
|
children: duniterIndexer.transBC!.map((repository) {
|
||||||
// log.d('bbbbbbbbbbbbbbbbbbbbbb: ' + repository.toString());
|
// log.d('bbbbbbbbbbbbbbbbbbbbbb: ' + repository.toString());
|
||||||
|
|
||||||
DateTime now = DateTime.now();
|
DateTime now = DateTime.now();
|
||||||
|
@ -291,7 +290,7 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
contentPadding: const EdgeInsets.only(
|
contentPadding: const EdgeInsets.only(
|
||||||
left: 20, right: 30, top: 15, bottom: 15),
|
left: 20, right: 30, top: 15, bottom: 15),
|
||||||
leading: ClipOval(
|
leading: ClipOval(
|
||||||
child: _cesiumPlusProvider.defaultAvatar(_avatarSize),
|
child: cesiumPlusProvider.defaultAvatar(avatarSize),
|
||||||
),
|
),
|
||||||
title: Padding(
|
title: Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 5),
|
padding: const EdgeInsets.only(bottom: 5),
|
||||||
|
@ -334,7 +333,7 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
||||||
dense: false,
|
dense: false,
|
||||||
isThreeLine: false,
|
isThreeLine: false,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_duniterIndexer.nPage = 1;
|
duniterIndexer.nPage = 1;
|
||||||
// _cesiumPlusProvider.avatarCancelToken.cancel('cancelled');
|
// _cesiumPlusProvider.avatarCancelToken.cancel('cancelled');
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
|
|
@ -29,10 +29,10 @@ class AnimatedFadeOutIn<T> extends StatefulWidget {
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_AnimatedFadeOutInState<T> createState() => _AnimatedFadeOutInState<T>();
|
AnimatedFadeOutInState<T> createState() => AnimatedFadeOutInState<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AnimatedFadeOutInState<T> extends State<AnimatedFadeOutIn<T>>
|
class AnimatedFadeOutInState<T> extends State<AnimatedFadeOutIn<T>>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late AnimationController controller;
|
late AnimationController controller;
|
||||||
late Animation<double> animation;
|
late Animation<double> animation;
|
||||||
|
|
|
@ -131,6 +131,17 @@ class CommonElements {
|
||||||
EdgeInsets padding,
|
EdgeInsets padding,
|
||||||
) {
|
) {
|
||||||
return Container(
|
return Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.white,
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey,
|
||||||
|
blurRadius: 4.0,
|
||||||
|
offset: Offset(2.0, 2.5),
|
||||||
|
spreadRadius: 0.5)
|
||||||
|
],
|
||||||
|
),
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Material(
|
child: Material(
|
||||||
color: const Color(0xffFFD58D), // button color
|
color: const Color(0xffFFD58D), // button color
|
||||||
|
@ -144,26 +155,15 @@ class CommonElements {
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
decoration: const BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Colors.white,
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: Colors.grey,
|
|
||||||
blurRadius: 4.0,
|
|
||||||
offset: Offset(2.0, 2.5),
|
|
||||||
spreadRadius: 0.5)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget offlineInfo(BuildContext context) {
|
Widget offlineInfo(BuildContext context) {
|
||||||
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
final double screenWidth = MediaQuery.of(context).size.width;
|
final double screenWidth = MediaQuery.of(context).size.width;
|
||||||
return Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
return Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible: !_sub.nodeConnected,
|
visible: !sub.nodeConnected,
|
||||||
child: Positioned(
|
child: Positioned(
|
||||||
top: 0,
|
top: 0,
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'package:bubble/bubble.dart';
|
import 'package:bubble/bubble.dart';
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
@ -29,12 +31,12 @@ class HomeScreen extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
homeContext = context;
|
homeContext = context;
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
Provider.of<ChestProvider>(context);
|
Provider.of<ChestProvider>(context);
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||||
|
|
||||||
isTall = false;
|
isTall = false;
|
||||||
ratio = 1;
|
ratio = 1;
|
||||||
|
@ -50,15 +52,15 @@ class HomeScreen extends StatelessWidget {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
|
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
|
||||||
DrawerHeader(
|
DrawerHeader(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: orangeC,
|
||||||
|
),
|
||||||
child: Column(children: const <Widget>[
|
child: Column(children: const <Widget>[
|
||||||
SizedBox(height: 0),
|
SizedBox(height: 0),
|
||||||
Image(
|
Image(
|
||||||
image: AssetImage('assets/icon/gecko_final.png'),
|
image: AssetImage('assets/icon/gecko_final.png'),
|
||||||
height: 130),
|
height: 130),
|
||||||
]),
|
]),
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: orangeC,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
key: const Key('parameters'),
|
key: const Key('parameters'),
|
||||||
|
@ -106,12 +108,12 @@ class HomeScreen extends StatelessWidget {
|
||||||
builder: (ctx) => StatefulWrapper(
|
builder: (ctx) => StatefulWrapper(
|
||||||
onInit: () {
|
onInit: () {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
DuniterIndexer _duniterIndexer =
|
DuniterIndexer duniterIndexer =
|
||||||
Provider.of<DuniterIndexer>(ctx, listen: false);
|
Provider.of<DuniterIndexer>(ctx, listen: false);
|
||||||
_duniterIndexer.getValidIndexerEndpoint();
|
duniterIndexer.getValidIndexerEndpoint();
|
||||||
|
|
||||||
if (!_sub.sdkReady && !_sub.sdkLoading) await _sub.initApi();
|
if (!sub.sdkReady && !sub.sdkLoading) await sub.initApi();
|
||||||
if (_sub.sdkReady && !_sub.nodeConnected) {
|
if (sub.sdkReady && !sub.nodeConnected) {
|
||||||
// Check if versionData non compatible, drop everything
|
// Check if versionData non compatible, drop everything
|
||||||
if (walletBox.isNotEmpty &&
|
if (walletBox.isNotEmpty &&
|
||||||
walletBox.getAt(0)!.version! < dataVersion) {
|
walletBox.getAt(0)!.version! < dataVersion) {
|
||||||
|
@ -120,19 +122,19 @@ class HomeScreen extends StatelessWidget {
|
||||||
await walletBox.clear();
|
await walletBox.clear();
|
||||||
await chestBox.clear();
|
await chestBox.clear();
|
||||||
await configBox.delete('defaultWallet');
|
await configBox.delete('defaultWallet');
|
||||||
await _sub.deleteAllAccounts();
|
await sub.deleteAllAccounts();
|
||||||
_myWalletProvider.rebuildWidget();
|
myWalletProvider.rebuildWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
var connectivityResult =
|
var connectivityResult =
|
||||||
await (Connectivity().checkConnectivity());
|
await (Connectivity().checkConnectivity());
|
||||||
HomeProvider _homeProvider =
|
HomeProvider homeProvider =
|
||||||
Provider.of<HomeProvider>(ctx, listen: false);
|
Provider.of<HomeProvider>(ctx, listen: false);
|
||||||
if (connectivityResult != ConnectivityResult.mobile &&
|
if (connectivityResult != ConnectivityResult.mobile &&
|
||||||
connectivityResult != ConnectivityResult.wifi) {
|
connectivityResult != ConnectivityResult.wifi) {
|
||||||
_homeProvider.changeMessage(
|
homeProvider.changeMessage(
|
||||||
"notConnectedToInternet".tr(), 0);
|
"notConnectedToInternet".tr(), 0);
|
||||||
_sub.nodeConnected = false;
|
sub.nodeConnected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Connectivity()
|
Connectivity()
|
||||||
|
@ -140,13 +142,13 @@ class HomeScreen extends StatelessWidget {
|
||||||
.listen((ConnectivityResult result) async {
|
.listen((ConnectivityResult result) async {
|
||||||
log.d('Network changed: $result');
|
log.d('Network changed: $result');
|
||||||
if (result == ConnectivityResult.none) {
|
if (result == ConnectivityResult.none) {
|
||||||
_sub.nodeConnected = false;
|
sub.nodeConnected = false;
|
||||||
await _sub.sdk.api.setting.unsubscribeBestNumber();
|
await sub.sdk.api.setting.unsubscribeBestNumber();
|
||||||
_homeProvider.changeMessage(
|
homeProvider.changeMessage(
|
||||||
"notConnectedToInternet".tr(), 0);
|
"notConnectedToInternet".tr(), 0);
|
||||||
_sub.reload();
|
sub.reload();
|
||||||
} else {
|
} else {
|
||||||
await _sub.connectNode(ctx);
|
await sub.connectNode(ctx);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -182,10 +184,10 @@ class HomeScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget geckHome(context) {
|
Widget geckHome(context) {
|
||||||
MyWalletsProvider _myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
MyWalletsProvider myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||||
Provider.of<ChestProvider>(context);
|
Provider.of<ChestProvider>(context);
|
||||||
|
|
||||||
WalletsProfilesProvider _historyProvider =
|
WalletsProfilesProvider historyProvider =
|
||||||
Provider.of<WalletsProfilesProvider>(context);
|
Provider.of<WalletsProfilesProvider>(context);
|
||||||
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
final double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||||
return Container(
|
return Container(
|
||||||
|
@ -241,9 +243,9 @@ Widget geckHome(context) {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: Consumer<HomeProvider>(builder: (context, _homeP, _) {
|
child: Consumer<HomeProvider>(builder: (context, homeP, _) {
|
||||||
return AnimatedFadeOutIn<String>(
|
return AnimatedFadeOutIn<String>(
|
||||||
data: _homeP.homeMessage,
|
data: homeP.homeMessage,
|
||||||
duration: const Duration(milliseconds: 100),
|
duration: const Duration(milliseconds: 100),
|
||||||
builder: (value) => Text(value),
|
builder: (value) => Text(value),
|
||||||
);
|
);
|
||||||
|
@ -270,6 +272,16 @@ Widget geckHome(context) {
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
blurRadius: 2,
|
||||||
|
offset: Offset(1, 1.5),
|
||||||
|
spreadRadius: 0.5)
|
||||||
|
],
|
||||||
|
),
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Material(
|
child: Material(
|
||||||
color: orangeC, // button color
|
color: orangeC, // button color
|
||||||
|
@ -291,16 +303,6 @@ Widget geckHome(context) {
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
decoration: const BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Colors.black,
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
blurRadius: 2,
|
|
||||||
offset: Offset(1, 1.5),
|
|
||||||
spreadRadius: 0.5)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
Text(
|
Text(
|
||||||
|
@ -315,6 +317,16 @@ Widget geckHome(context) {
|
||||||
const SizedBox(width: 120),
|
const SizedBox(width: 120),
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
blurRadius: 2,
|
||||||
|
offset: Offset(1, 1.5),
|
||||||
|
spreadRadius: 0.5)
|
||||||
|
],
|
||||||
|
),
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
key: const Key('manageWallets'),
|
key: const Key('manageWallets'),
|
||||||
child: Material(
|
child: Material(
|
||||||
|
@ -328,10 +340,10 @@ Widget geckHome(context) {
|
||||||
height: 68 * ratio)),
|
height: 68 * ratio)),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
WalletData? defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet();
|
myWalletProvider.getDefaultWallet();
|
||||||
String? _pin;
|
String? pin;
|
||||||
if (_myWalletProvider.pinCode == '') {
|
if (myWalletProvider.pinCode == '') {
|
||||||
_pin = await Navigator.push(
|
pin = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (homeContext) {
|
builder: (homeContext) {
|
||||||
|
@ -341,8 +353,7 @@ Widget geckHome(context) {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (_pin != null ||
|
if (pin != null || myWalletProvider.pinCode != '') {
|
||||||
_myWalletProvider.pinCode != '') {
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
|
@ -357,16 +368,6 @@ Widget geckHome(context) {
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
decoration: const BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Colors.black,
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
blurRadius: 2,
|
|
||||||
offset: Offset(1, 1.5),
|
|
||||||
spreadRadius: 0.5)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
Text(
|
Text(
|
||||||
|
@ -386,6 +387,16 @@ Widget geckHome(context) {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
blurRadius: 2,
|
||||||
|
offset: Offset(1, 1.5),
|
||||||
|
spreadRadius: 0.5)
|
||||||
|
],
|
||||||
|
),
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Material(
|
child: Material(
|
||||||
color: orangeC, // button color
|
color: orangeC, // button color
|
||||||
|
@ -397,20 +408,10 @@ Widget geckHome(context) {
|
||||||
'assets/home/qrcode.png'),
|
'assets/home/qrcode.png'),
|
||||||
height: 68 * ratio)),
|
height: 68 * ratio)),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _historyProvider.scan(context);
|
await historyProvider.scan(context);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
decoration: const BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Colors.black,
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
blurRadius: 2,
|
|
||||||
offset: Offset(1, 1.5),
|
|
||||||
spreadRadius: 0.5)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
Text(
|
Text(
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
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:durt/durt.dart';
|
import 'package:durt/durt.dart';
|
||||||
|
@ -28,8 +30,8 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
|
@ -106,11 +108,11 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
WalletData defaultWallet =
|
WalletData defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet();
|
myWalletProvider.getDefaultWallet();
|
||||||
|
|
||||||
String? _pin;
|
String? pin;
|
||||||
if (_myWalletProvider.pinCode == '') {
|
if (myWalletProvider.pinCode == '') {
|
||||||
_pin = await Navigator.push(
|
pin = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (homeContext) {
|
builder: (homeContext) {
|
||||||
|
@ -119,8 +121,8 @@ class ChangePinScreen extends StatelessWidget with ChangeNotifier {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (_pin != null || _myWalletProvider.pinCode != '') {
|
if (pin != null || myWalletProvider.pinCode != '') {
|
||||||
await _sub.changePassword(context, defaultWallet.address!,
|
await sub.changePassword(context, defaultWallet.address!,
|
||||||
walletProvider.pinCode, newPin.text);
|
walletProvider.pinCode, newPin.text);
|
||||||
walletProvider.pinCode = newPin.text;
|
walletProvider.pinCode = newPin.text;
|
||||||
newPin.text = '';
|
newPin.text = '';
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
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:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
@ -23,9 +25,9 @@ class ChestOptions extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
ChestProvider _chestProvider =
|
ChestProvider chestProvider =
|
||||||
Provider.of<ChestProvider>(context, listen: false);
|
Provider.of<ChestProvider>(context, listen: false);
|
||||||
HomeProvider _homeProvider =
|
HomeProvider homeProvider =
|
||||||
Provider.of<HomeProvider>(context, listen: false);
|
Provider.of<HomeProvider>(context, listen: false);
|
||||||
|
|
||||||
ChestData currentChest = chestBox.get(configBox.get('currentChest'))!;
|
ChestData currentChest = chestBox.get(configBox.get('currentChest'))!;
|
||||||
|
@ -49,7 +51,7 @@ class ChestOptions extends StatelessWidget {
|
||||||
height: 22,
|
height: 22,
|
||||||
child: Text(currentChest.name!),
|
child: Text(currentChest.name!),
|
||||||
)),
|
)),
|
||||||
bottomNavigationBar: _homeProvider.bottomAppBar(context),
|
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||||
body: Stack(children: [
|
body: Stack(children: [
|
||||||
Builder(
|
Builder(
|
||||||
builder: (ctx) => SafeArea(
|
builder: (ctx) => SafeArea(
|
||||||
|
@ -58,12 +60,12 @@ class ChestOptions extends StatelessWidget {
|
||||||
InkWell(
|
InkWell(
|
||||||
key: const Key('showSeed'),
|
key: const Key('showSeed'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
WalletData? defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet();
|
myWalletProvider.getDefaultWallet();
|
||||||
String? _pin;
|
String? pin;
|
||||||
_pin = await Navigator.push(
|
pin = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (homeContext) {
|
builder: (homeContext) {
|
||||||
|
@ -72,7 +74,7 @@ class ChestOptions extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (_pin != null) {
|
if (pin != null) {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
|
@ -104,10 +106,10 @@ class ChestOptions extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 10 * ratio),
|
SizedBox(height: 10 * ratio),
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
key: const Key('changePin'),
|
key: const Key('changePin'),
|
||||||
onTap: _sub.nodeConnected
|
onTap: sub.nodeConnected
|
||||||
? () async {
|
? () async {
|
||||||
// await _chestProvider.changePin(context, cesiumWallet);
|
// await _chestProvider.changePin(context, cesiumWallet);
|
||||||
String? pinResult = await Navigator.push(
|
String? pinResult = await Navigator.push(
|
||||||
|
@ -140,7 +142,7 @@ class ChestOptions extends StatelessWidget {
|
||||||
'changePassword'.tr(),
|
'changePassword'.tr(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: _sub.nodeConnected
|
color: sub.nodeConnected
|
||||||
? Colors.black
|
? Colors.black
|
||||||
: Colors.grey[500]),
|
: Colors.grey[500]),
|
||||||
),
|
),
|
||||||
|
@ -148,10 +150,10 @@ class ChestOptions extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
SizedBox(height: 10 * ratio),
|
SizedBox(height: 10 * ratio),
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
key: const Key('createRootDerivation'),
|
key: const Key('createRootDerivation'),
|
||||||
onTap: _sub.nodeConnected
|
onTap: sub.nodeConnected
|
||||||
? () async {
|
? () async {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
@ -176,7 +178,7 @@ class ChestOptions extends StatelessWidget {
|
||||||
'createDerivation'.tr(),
|
'createDerivation'.tr(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: _sub.nodeConnected
|
color: sub.nodeConnected
|
||||||
? Colors.black
|
? Colors.black
|
||||||
: Colors.grey[500]),
|
: Colors.grey[500]),
|
||||||
),
|
),
|
||||||
|
@ -188,7 +190,7 @@ class ChestOptions extends StatelessWidget {
|
||||||
InkWell(
|
InkWell(
|
||||||
key: const Key('deleteChest'),
|
key: const Key('deleteChest'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _chestProvider.deleteChest(context, currentChest);
|
await chestProvider.deleteChest(context, currentChest);
|
||||||
},
|
},
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 50,
|
height: 50,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
@ -29,7 +31,7 @@ class _ChooseChestState extends State<ChooseChest> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -114,10 +116,10 @@ class _ChooseChestState extends State<ChooseChest> {
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await configBox.put('currentChest', currentChest);
|
await configBox.put('currentChest', currentChest);
|
||||||
_myWalletProvider.pinCode = '';
|
myWalletProvider.pinCode = '';
|
||||||
WalletData? defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet();
|
myWalletProvider.getDefaultWallet();
|
||||||
_myWalletProvider.rebuildWidget();
|
myWalletProvider.rebuildWidget();
|
||||||
|
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
@ -131,7 +133,7 @@ class _ChooseChestState extends State<ChooseChest> {
|
||||||
context,
|
context,
|
||||||
ModalRoute.withName('/'),
|
ModalRoute.withName('/'),
|
||||||
);
|
);
|
||||||
if (_myWalletProvider.pinCode != '') {
|
if (myWalletProvider.pinCode != '') {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
@ -22,7 +24,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
final int chest = configBox.get('currentChest');
|
final int chest = configBox.get('currentChest');
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -50,10 +52,10 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
onPrimary: Colors.white, // foreground
|
onPrimary: Colors.white, // foreground
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await _sub.setCurrentWallet(selectedWallet!);
|
await sub.setCurrentWallet(selectedWallet!);
|
||||||
|
|
||||||
// _walletViewProvider.reload();
|
// _walletViewProvider.reload();
|
||||||
_sub.reload();
|
sub.reload();
|
||||||
|
|
||||||
// Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
@ -73,21 +75,21 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget myWalletsTiles(BuildContext context, int? currentChest) {
|
Widget myWalletsTiles(BuildContext context, int? currentChest) {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||||
WalletData? defaultWallet = _myWalletProvider.getDefaultWallet();
|
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
|
|
||||||
selectedWallet ??= defaultWallet;
|
selectedWallet ??= defaultWallet;
|
||||||
_myWalletProvider.readAllWallets(currentChest);
|
myWalletProvider.readAllWallets(currentChest);
|
||||||
|
|
||||||
if (!isWalletsExists) {
|
if (!isWalletsExists) {
|
||||||
return const Text('');
|
return const Text('');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_myWalletProvider.listWallets.isEmpty) {
|
if (myWalletProvider.listWallets.isEmpty) {
|
||||||
return Column(children: const <Widget>[
|
return Column(children: const <Widget>[
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -97,7 +99,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
List _listWallets = _myWalletProvider.listWallets;
|
List listWallets = myWalletProvider.listWallets;
|
||||||
final double screenWidth = MediaQuery.of(context).size.width;
|
final double screenWidth = MediaQuery.of(context).size.width;
|
||||||
int nTule = 2;
|
int nTule = 2;
|
||||||
|
|
||||||
|
@ -116,13 +118,13 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
crossAxisSpacing: 0,
|
crossAxisSpacing: 0,
|
||||||
mainAxisSpacing: 0,
|
mainAxisSpacing: 0,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
for (WalletData _repository in _listWallets as Iterable<WalletData>)
|
for (WalletData repository in listWallets as Iterable<WalletData>)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
selectedWallet = _repository;
|
selectedWallet = repository;
|
||||||
_myWalletProvider.rebuildWidget();
|
myWalletProvider.rebuildWidget();
|
||||||
},
|
},
|
||||||
child: ClipOvalShadow(
|
child: ClipOvalShadow(
|
||||||
shadow: const Shadow(
|
shadow: const Shadow(
|
||||||
|
@ -147,9 +149,9 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
const Color(0xFFE7E7A6),
|
const Color(0xFFE7E7A6),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
child: _repository.imageCustomPath == null
|
child: repository.imageCustomPath == null
|
||||||
? Image.asset(
|
? Image.asset(
|
||||||
'assets/avatars/${_repository.imageDefaultPath}',
|
'assets/avatars/${repository.imageDefaultPath}',
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
)
|
)
|
||||||
|
@ -162,14 +164,14 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
image: FileImage(
|
image: FileImage(
|
||||||
File(_repository.imageCustomPath!),
|
File(repository.imageCustomPath!),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
balanceBuilder(context, _repository.address!,
|
balanceBuilder(context, repository.address!,
|
||||||
selectedWallet!.address == _repository.address!),
|
selectedWallet!.address == repository.address!),
|
||||||
ListTile(
|
ListTile(
|
||||||
shape: const RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.vertical(
|
borderRadius: BorderRadius.vertical(
|
||||||
|
@ -177,7 +179,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
tileColor:
|
tileColor:
|
||||||
_repository.address == selectedWallet!.address
|
repository.address == selectedWallet!.address
|
||||||
? orangeC
|
? orangeC
|
||||||
: const Color(0xffFFD58D),
|
: const Color(0xffFFD58D),
|
||||||
title: Center(
|
title: Center(
|
||||||
|
@ -185,11 +187,11 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(horizontal: 5),
|
const EdgeInsets.symmetric(horizontal: 5),
|
||||||
child: Text(
|
child: Text(
|
||||||
_repository.name!,
|
repository.name!,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 17.0,
|
fontSize: 17.0,
|
||||||
color: _repository.address ==
|
color: repository.address ==
|
||||||
selectedWallet!.address
|
selectedWallet!.address
|
||||||
? const Color(0xffF9F9F1)
|
? const Color(0xffF9F9F1)
|
||||||
: Colors.black,
|
: Colors.black,
|
||||||
|
@ -198,8 +200,8 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
selectedWallet = _repository;
|
selectedWallet = repository;
|
||||||
_myWalletProvider.rebuildWidget();
|
myWalletProvider.rebuildWidget();
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
|
@ -210,7 +212,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget balanceBuilder(context, String _address, bool isDefault) {
|
Widget balanceBuilder(context, String address, bool isDefault) {
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
color: isDefault ? orangeC : yellowC,
|
color: isDefault ? orangeC : yellowC,
|
||||||
|
@ -223,8 +225,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
// textAlign: TextAlign.center,
|
// textAlign: TextAlign.center,
|
||||||
// style: TextStyle(color: isDefault ? Colors.white : Colors.black),
|
// style: TextStyle(color: isDefault ? Colors.white : Colors.black),
|
||||||
// ),
|
// ),
|
||||||
balance(
|
balance(context, address, 15, isDefault ? Colors.white : Colors.black)
|
||||||
context, _address, 15, isDefault ? Colors.white : Colors.black)
|
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
@ -26,7 +28,7 @@ class _CustomDerivationState extends State<CustomDerivation> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
final derivationList = <String>[
|
final derivationList = <String>[
|
||||||
|
@ -34,11 +36,11 @@ class _CustomDerivationState extends State<CustomDerivation> {
|
||||||
for (var i = 0; i < 51; i += 1) i.toString()
|
for (var i = 0; i < 51; i += 1) i.toString()
|
||||||
];
|
];
|
||||||
|
|
||||||
final listWallets = _myWalletProvider.readAllWallets();
|
final listWallets = myWalletProvider.readAllWallets();
|
||||||
|
|
||||||
for (WalletData _wallet in listWallets) {
|
for (WalletData wallet in listWallets) {
|
||||||
derivationList.remove(_wallet.derivation.toString());
|
derivationList.remove(wallet.derivation.toString());
|
||||||
if (_wallet.derivation == -1) {
|
if (wallet.derivation == -1) {
|
||||||
derivationList.remove('root');
|
derivationList.remove('root');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,10 +113,10 @@ class _CustomDerivationState extends State<CustomDerivation> {
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
WalletData? defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet();
|
myWalletProvider.getDefaultWallet();
|
||||||
String? _pin;
|
String? pin;
|
||||||
if (_myWalletProvider.pinCode == '') {
|
if (myWalletProvider.pinCode == '') {
|
||||||
_pin = await Navigator.push(
|
pin = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (homeContext) {
|
builder: (homeContext) {
|
||||||
|
@ -124,16 +126,16 @@ class _CustomDerivationState extends State<CustomDerivation> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_pin != null || _myWalletProvider.pinCode != '') {
|
if (pin != null || myWalletProvider.pinCode != '') {
|
||||||
String _newDerivationName = 'wallet'.tr() +
|
String newDerivationName =
|
||||||
' ${_myWalletProvider.listWallets.last.number! + 2}';
|
'${'wallet'.tr()} ${myWalletProvider.listWallets.last.number! + 2}';
|
||||||
if (dropdownValue == 'root') {
|
if (dropdownValue == 'root') {
|
||||||
await _myWalletProvider.generateRootWallet(
|
await myWalletProvider.generateRootWallet(
|
||||||
context, 'Portefeuille racine');
|
context, 'Portefeuille racine');
|
||||||
} else {
|
} else {
|
||||||
await _myWalletProvider.generateNewDerivation(
|
await myWalletProvider.generateNewDerivation(
|
||||||
context,
|
context,
|
||||||
_newDerivationName,
|
newDerivationName,
|
||||||
int.parse(dropdownValue!),
|
int.parse(dropdownValue!),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class RestoreChest extends StatelessWidget {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
GenerateWalletsProvider genW =
|
GenerateWalletsProvider genW =
|
||||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
genW.actualWallet = null;
|
genW.actualWallet = null;
|
||||||
if (genW.isSentenceComplete(context)) {
|
if (genW.isSentenceComplete(context)) {
|
||||||
|
@ -96,7 +96,7 @@ class RestoreChest extends StatelessWidget {
|
||||||
onPrimary: Colors.white, // foreground
|
onPrimary: Colors.white, // foreground
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (await _sub.isMnemonicValid(genW.generatedMnemonic!)) {
|
if (await sub.isMnemonicValid(genW.generatedMnemonic!)) {
|
||||||
genW.resetImportView();
|
genW.resetImportView();
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
@ -184,6 +184,12 @@ class RestoreChest extends StatelessWidget {
|
||||||
return Container(
|
return Container(
|
||||||
width: 102,
|
width: 102,
|
||||||
height: 40 * ratio,
|
height: 40 * ratio,
|
||||||
|
// ),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.grey),
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(3),
|
||||||
|
),
|
||||||
// child: RawKeyboardListener(
|
// child: RawKeyboardListener(
|
||||||
// focusNode: FocusNode(), // or FocusNode()
|
// focusNode: FocusNode(), // or FocusNode()
|
||||||
// onKey: (event) {
|
// onKey: (event) {
|
||||||
|
@ -210,12 +216,6 @@ class RestoreChest extends StatelessWidget {
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: const TextStyle(fontSize: 20),
|
style: const TextStyle(fontSize: 20),
|
||||||
),
|
),
|
||||||
// ),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(color: Colors.grey),
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(3),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,13 +24,13 @@ class ShowSeed extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
|
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
WalletData defaultWallet = _myWalletProvider.getDefaultWallet();
|
WalletData defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
|
@ -44,11 +44,11 @@ class ShowSeed extends StatelessWidget {
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
const Spacer(flex: 1),
|
const Spacer(flex: 1),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _sub.getSeed(
|
future:
|
||||||
defaultWallet.address!, walletProvider.pinCode),
|
sub.getSeed(defaultWallet.address!, walletProvider.pinCode),
|
||||||
builder: (BuildContext context, AsyncSnapshot<String?> _seed) {
|
builder: (BuildContext context, AsyncSnapshot<String?> seed) {
|
||||||
if (_seed.connectionState != ConnectionState.done ||
|
if (seed.connectionState != ConnectionState.done ||
|
||||||
_seed.hasError) {
|
seed.hasError) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
width: 15,
|
width: 15,
|
||||||
|
@ -57,7 +57,7 @@ class ShowSeed extends StatelessWidget {
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else if (!_seed.hasData) {
|
} else if (!seed.hasData) {
|
||||||
return const Text('');
|
return const Text('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class ShowSeed extends StatelessWidget {
|
||||||
Column(children: [
|
Column(children: [
|
||||||
common.buildText('keepYourMnemonicSecret'.tr()),
|
common.buildText('keepYourMnemonicSecret'.tr()),
|
||||||
SizedBox(height: 35 * ratio),
|
SizedBox(height: 35 * ratio),
|
||||||
sentanceArray(context, _seed.data!.split(' ')),
|
sentanceArray(context, seed.data!.split(' ')),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 40,
|
height: 40,
|
||||||
|
@ -82,7 +82,7 @@ class ShowSeed extends StatelessWidget {
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Clipboard.setData(
|
Clipboard.setData(
|
||||||
ClipboardData(text: _seed.data));
|
ClipboardData(text: seed.data));
|
||||||
snackCopyKey(context);
|
snackCopyKey(context);
|
||||||
},
|
},
|
||||||
child: Row(children: <Widget>[
|
child: Row(children: <Widget>[
|
||||||
|
@ -105,7 +105,7 @@ class ShowSeed extends StatelessWidget {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return PrintWallet(_seed.data);
|
return PrintWallet(seed.data);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -152,7 +152,7 @@ class ShowSeed extends StatelessWidget {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget sentanceArray(BuildContext context, List _mnemonic) {
|
Widget sentanceArray(BuildContext context, List mnemonic) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 3),
|
padding: const EdgeInsets.symmetric(horizontal: 3),
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -170,24 +170,24 @@ class ShowSeed extends StatelessWidget {
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
arrayCell(_mnemonic[0], 1),
|
arrayCell(mnemonic[0], 1),
|
||||||
arrayCell(_mnemonic[1], 2),
|
arrayCell(mnemonic[1], 2),
|
||||||
arrayCell(_mnemonic[2], 3),
|
arrayCell(mnemonic[2], 3),
|
||||||
arrayCell(_mnemonic[3], 4),
|
arrayCell(mnemonic[3], 4),
|
||||||
]),
|
]),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
arrayCell(_mnemonic[4], 5),
|
arrayCell(mnemonic[4], 5),
|
||||||
arrayCell(_mnemonic[5], 6),
|
arrayCell(mnemonic[5], 6),
|
||||||
arrayCell(_mnemonic[6], 7),
|
arrayCell(mnemonic[6], 7),
|
||||||
arrayCell(_mnemonic[7], 8),
|
arrayCell(mnemonic[7], 8),
|
||||||
]),
|
]),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
arrayCell(_mnemonic[8], 9),
|
arrayCell(mnemonic[8], 9),
|
||||||
arrayCell(_mnemonic[9], 10),
|
arrayCell(mnemonic[9], 10),
|
||||||
arrayCell(_mnemonic[10], 11),
|
arrayCell(mnemonic[10], 11),
|
||||||
arrayCell(_mnemonic[11], 12),
|
arrayCell(mnemonic[11], 12),
|
||||||
]),
|
]),
|
||||||
])),
|
])),
|
||||||
);
|
);
|
||||||
|
@ -249,26 +249,26 @@ class PrintWallet extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Uint8List> printWallet(String _seed) async {
|
Future<Uint8List> printWallet(String seed) async {
|
||||||
final ByteData fontData =
|
final ByteData fontData =
|
||||||
await rootBundle.load("assets/OpenSans-Regular.ttf");
|
await rootBundle.load("assets/OpenSans-Regular.ttf");
|
||||||
final pw.Font ttf = pw.Font.ttf(fontData.buffer.asByteData());
|
final pw.Font ttf = pw.Font.ttf(fontData.buffer.asByteData());
|
||||||
final pdf = pw.Document();
|
final pdf = pw.Document();
|
||||||
int nbr = 1;
|
int nbr = 1;
|
||||||
|
|
||||||
final _seedList = _seed.split(' ');
|
final seedList = seed.split(' ');
|
||||||
|
|
||||||
// const imageProvider = AssetImage('assets/icon/gecko_final.png');
|
// const imageProvider = AssetImage('assets/icon/gecko_final.png');
|
||||||
// final geckoLogo = await flutterImageProvider(imageProvider);
|
// final geckoLogo = await flutterImageProvider(imageProvider);
|
||||||
|
|
||||||
pw.Widget arrayCell(String dataWord, int _nbr) {
|
pw.Widget arrayCell(String dataWord, int nbr) {
|
||||||
nbr++;
|
nbr++;
|
||||||
|
|
||||||
return pw.SizedBox(
|
return pw.SizedBox(
|
||||||
width: 120,
|
width: 120,
|
||||||
child: pw.Column(children: <pw.Widget>[
|
child: pw.Column(children: <pw.Widget>[
|
||||||
pw.Text(
|
pw.Text(
|
||||||
_nbr.toString(),
|
nbr.toString(),
|
||||||
style: pw.TextStyle(
|
style: pw.TextStyle(
|
||||||
fontSize: 15, color: const PdfColor(0.5, 0, 0), font: ttf),
|
fontSize: 15, color: const PdfColor(0.5, 0, 0), font: ttf),
|
||||||
),
|
),
|
||||||
|
@ -292,22 +292,22 @@ class PrintWallet extends StatelessWidget {
|
||||||
// crossAxisAlignment: pw.CrossAxisAlignment.center,
|
// crossAxisAlignment: pw.CrossAxisAlignment.center,
|
||||||
children: <pw.Widget>[
|
children: <pw.Widget>[
|
||||||
pw.Row(children: <pw.Widget>[
|
pw.Row(children: <pw.Widget>[
|
||||||
arrayCell(_seedList[0], nbr),
|
arrayCell(seedList[0], nbr),
|
||||||
arrayCell(_seedList[1], nbr),
|
arrayCell(seedList[1], nbr),
|
||||||
arrayCell(_seedList[2], nbr),
|
arrayCell(seedList[2], nbr),
|
||||||
arrayCell(_seedList[3], nbr),
|
arrayCell(seedList[3], nbr),
|
||||||
]),
|
]),
|
||||||
pw.Row(children: <pw.Widget>[
|
pw.Row(children: <pw.Widget>[
|
||||||
arrayCell(_seedList[4], nbr),
|
arrayCell(seedList[4], nbr),
|
||||||
arrayCell(_seedList[5], nbr),
|
arrayCell(seedList[5], nbr),
|
||||||
arrayCell(_seedList[6], nbr),
|
arrayCell(seedList[6], nbr),
|
||||||
arrayCell(_seedList[7], nbr),
|
arrayCell(seedList[7], nbr),
|
||||||
]),
|
]),
|
||||||
pw.Row(children: <pw.Widget>[
|
pw.Row(children: <pw.Widget>[
|
||||||
arrayCell(_seedList[8], nbr),
|
arrayCell(seedList[8], nbr),
|
||||||
arrayCell(_seedList[9], nbr),
|
arrayCell(seedList[9], nbr),
|
||||||
arrayCell(_seedList[10], nbr),
|
arrayCell(seedList[10], nbr),
|
||||||
arrayCell(_seedList[11], nbr)
|
arrayCell(seedList[11], nbr)
|
||||||
]),
|
]),
|
||||||
pw.Expanded(
|
pw.Expanded(
|
||||||
child: pw.Align(
|
child: pw.Align(
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
// ignore_for_file: avoid_print
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
@ -32,14 +30,14 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
Provider.of<WalletOptionsProvider>(context);
|
||||||
// final double statusBarHeight = MediaQuery.of(context).padding.top;
|
// final double statusBarHeight = MediaQuery.of(context).padding.top;
|
||||||
|
|
||||||
currentChestNumber = configBox.get('currentChest');
|
currentChestNumber = configBox.get('currentChest');
|
||||||
currentChest = chestBox.get(currentChestNumber)!;
|
currentChest = chestBox.get(currentChestNumber)!;
|
||||||
|
|
||||||
int _pinLenght = _walletOptions.getPinLenght(wallet!.number);
|
int pinLenght = walletOptions.getPinLenght(wallet!.number);
|
||||||
errorController = StreamController<ErrorAnimationType>();
|
errorController = StreamController<ErrorAnimationType>();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -101,12 +99,12 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
fontWeight: FontWeight.w400),
|
fontWeight: FontWeight.w400),
|
||||||
)),
|
)),
|
||||||
SizedBox(height: 40 * ratio),
|
SizedBox(height: 40 * ratio),
|
||||||
pinForm(context, _pinLenght),
|
pinForm(context, pinLenght),
|
||||||
SizedBox(height: 3 * ratio),
|
SizedBox(height: 3 * ratio),
|
||||||
if (canUnlock)
|
if (canUnlock)
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_walletOptions.changePinCacheChoice();
|
walletOptions.changePinCacheChoice();
|
||||||
},
|
},
|
||||||
child: Row(children: [
|
child: Row(children: [
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
|
@ -157,20 +155,20 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget pinForm(context, _pinLenght) {
|
Widget pinForm(context, pinLenght) {
|
||||||
// var _walletPin = '';
|
// var _walletPin = '';
|
||||||
// ignore: close_sinks
|
// ignore: close_sinks
|
||||||
StreamController<ErrorAnimationType> errorController =
|
StreamController<ErrorAnimationType> errorController =
|
||||||
StreamController<ErrorAnimationType>();
|
StreamController<ErrorAnimationType>();
|
||||||
TextEditingController _enterPin = TextEditingController();
|
TextEditingController enterPin = TextEditingController();
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
Provider.of<WalletOptionsProvider>(context);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
FocusNode pinFocus = FocusNode();
|
FocusNode pinFocus = FocusNode();
|
||||||
|
|
||||||
WalletData defaultWallet = _myWalletProvider.getDefaultWallet();
|
WalletData defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
|
|
||||||
// defaultWallet.address = null;
|
// defaultWallet.address = null;
|
||||||
if (defaultWallet.address == null) {
|
if (defaultWallet.address == null) {
|
||||||
|
@ -195,14 +193,13 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
color: Colors.green.shade600,
|
color: Colors.green.shade600,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
length: _pinLenght,
|
length: pinLenght,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
obscuringCharacter: '*',
|
obscuringCharacter: '*',
|
||||||
animationType: AnimationType.fade,
|
animationType: AnimationType.fade,
|
||||||
validator: (v) {
|
validator: (v) {
|
||||||
if (v!.length < _pinLenght) {
|
if (v!.length < pinLenght) {
|
||||||
return "yourPasswordLengthIsX"
|
return "yourPasswordLengthIsX".tr(args: [pinLenght.toString()]);
|
||||||
.tr(args: [_pinLenght.toString()]);
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -222,7 +219,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
backgroundColor: const Color(0xffF9F9F1),
|
backgroundColor: const Color(0xffF9F9F1),
|
||||||
enableActiveFill: false,
|
enableActiveFill: false,
|
||||||
errorAnimationController: errorController,
|
errorAnimationController: errorController,
|
||||||
controller: _enterPin,
|
controller: enterPin,
|
||||||
keyboardType: TextInputType.visiblePassword,
|
keyboardType: TextInputType.visiblePassword,
|
||||||
boxShadows: const [
|
boxShadows: const [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
|
@ -231,23 +228,23 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
blurRadius: 10,
|
blurRadius: 10,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
onCompleted: (_pin) async {
|
onCompleted: (pin) async {
|
||||||
_myWalletProvider.pinCode = _pin.toUpperCase();
|
myWalletProvider.pinCode = pin.toUpperCase();
|
||||||
final isValid = await _sub.checkPassword(
|
final isValid = await sub.checkPassword(
|
||||||
defaultWallet.address!, _pin.toUpperCase());
|
defaultWallet.address!, pin.toUpperCase());
|
||||||
|
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
await Future.delayed(const Duration(milliseconds: 50));
|
await Future.delayed(const Duration(milliseconds: 50));
|
||||||
errorController.add(ErrorAnimationType
|
errorController.add(ErrorAnimationType
|
||||||
.shake); // Triggering error shake animation
|
.shake); // Triggering error shake animation
|
||||||
pinColor = Colors.red[600];
|
pinColor = Colors.red[600];
|
||||||
_myWalletProvider.pinCode = _myWalletProvider.mnemonic = '';
|
myWalletProvider.pinCode = myWalletProvider.mnemonic = '';
|
||||||
_walletOptions.reloadBuild();
|
walletOptions.reloadBuild();
|
||||||
pinFocus.requestFocus();
|
pinFocus.requestFocus();
|
||||||
} else {
|
} else {
|
||||||
pinColor = Colors.green[400];
|
pinColor = Colors.green[400];
|
||||||
_myWalletProvider.resetPinCode();
|
myWalletProvider.resetPinCode();
|
||||||
Navigator.pop(context, _pin.toUpperCase());
|
Navigator.pop(context, pin.toUpperCase());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
|
|
|
@ -26,30 +26,30 @@ class WalletOptions extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
WalletsProfilesProvider _historyProvider =
|
WalletsProfilesProvider historyProvider =
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
HomeProvider _homeProvider =
|
HomeProvider homeProvider =
|
||||||
Provider.of<HomeProvider>(context, listen: false);
|
Provider.of<HomeProvider>(context, listen: false);
|
||||||
DuniterIndexer _duniterIndexer =
|
DuniterIndexer duniterIndexer =
|
||||||
Provider.of<DuniterIndexer>(context, listen: false);
|
Provider.of<DuniterIndexer>(context, listen: false);
|
||||||
|
|
||||||
log.d(_walletOptions.address.text);
|
log.d(walletOptions.address.text);
|
||||||
|
|
||||||
final int _currentChest = _myWalletProvider.getCurrentChest();
|
final int currentChest = myWalletProvider.getCurrentChest();
|
||||||
|
|
||||||
// final currentWallet = _myWalletProvider.getDefaultWallet();
|
// final currentWallet = _myWalletProvider.getDefaultWallet();
|
||||||
// log.d(_walletOptions.getAddress(_currentChest, 3));
|
// log.d(_walletOptions.getAddress(_currentChest, 3));
|
||||||
log.d("Wallet options: $_currentChest:${wallet.derivation}");
|
log.d("Wallet options: $currentChest:${wallet.derivation}");
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
_walletOptions.isEditing = false;
|
walletOptions.isEditing = false;
|
||||||
_walletOptions.isBalanceBlur = false;
|
walletOptions.isBalanceBlur = false;
|
||||||
_myWalletProvider.rebuildWidget();
|
myWalletProvider.rebuildWidget();
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
},
|
},
|
||||||
|
@ -62,9 +62,9 @@ class WalletOptions extends StatelessWidget {
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_walletOptions.isEditing = false;
|
walletOptions.isEditing = false;
|
||||||
_walletOptions.isBalanceBlur = false;
|
walletOptions.isBalanceBlur = false;
|
||||||
_myWalletProvider.rebuildWidget();
|
myWalletProvider.rebuildWidget();
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}),
|
}),
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
|
@ -81,20 +81,20 @@ class WalletOptions extends StatelessWidget {
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return QrCodeFullscreen(
|
return QrCodeFullscreen(
|
||||||
_walletOptions.address.text,
|
walletOptions.address.text,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: QrImageWidget(
|
child: QrImageWidget(
|
||||||
data: _walletOptions.address.text,
|
data: walletOptions.address.text,
|
||||||
version: QrVersions.auto,
|
version: QrVersions.auto,
|
||||||
size: 80,
|
size: 80,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
bottomNavigationBar: _homeProvider.bottomAppBar(context),
|
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||||
body: Stack(children: [
|
body: Stack(children: [
|
||||||
Builder(
|
Builder(
|
||||||
builder: (ctx) => SafeArea(
|
builder: (ctx) => SafeArea(
|
||||||
|
@ -124,7 +124,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
_duniterIndexer.getNameByAddress(
|
duniterIndexer.getNameByAddress(
|
||||||
context,
|
context,
|
||||||
walletProvider.address.text,
|
walletProvider.address.text,
|
||||||
wallet,
|
wallet,
|
||||||
|
@ -143,8 +143,8 @@ class WalletOptions extends StatelessWidget {
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.center,
|
CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
_walletOptions.idtyStatus(
|
walletOptions.idtyStatus(
|
||||||
context, _walletOptions.address.text,
|
context, walletOptions.address.text,
|
||||||
isOwner: true, color: orangeC),
|
isOwner: true, color: orangeC),
|
||||||
getCerts(context,
|
getCerts(context,
|
||||||
walletProvider.address.text, 15),
|
walletProvider.address.text, 15),
|
||||||
|
@ -184,34 +184,34 @@ class WalletOptions extends StatelessWidget {
|
||||||
pubkeyWidget(walletProvider, ctx),
|
pubkeyWidget(walletProvider, ctx),
|
||||||
SizedBox(height: 10 * ratio),
|
SizedBox(height: 10 * ratio),
|
||||||
activityWidget(
|
activityWidget(
|
||||||
context, _historyProvider, walletProvider),
|
context, historyProvider, walletProvider),
|
||||||
SizedBox(height: 12 * ratio),
|
SizedBox(height: 12 * ratio),
|
||||||
setDefaultWalletWidget(
|
setDefaultWalletWidget(
|
||||||
context,
|
context,
|
||||||
walletProvider,
|
walletProvider,
|
||||||
_myWalletProvider,
|
myWalletProvider,
|
||||||
_walletOptions,
|
walletOptions,
|
||||||
_currentChest),
|
currentChest),
|
||||||
SizedBox(height: 17 * ratio),
|
SizedBox(height: 17 * ratio),
|
||||||
// walletProvider.isMember(context, _walletOptions.address.text)
|
// walletProvider.isMember(context, _walletOptions.address.text)
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: walletProvider.isMember(
|
future: walletProvider.isMember(
|
||||||
context, _walletOptions.address.text),
|
context, walletOptions.address.text),
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
AsyncSnapshot<bool> _isMember) {
|
AsyncSnapshot<bool> isMember) {
|
||||||
if (_isMember.connectionState !=
|
if (isMember.connectionState !=
|
||||||
ConnectionState.done ||
|
ConnectionState.done ||
|
||||||
_isMember.hasError) {
|
isMember.hasError) {
|
||||||
return const Text('');
|
return const Text('');
|
||||||
}
|
}
|
||||||
return Column(children: [
|
return Column(children: [
|
||||||
if (!walletProvider.isDefaultWallet &&
|
if (!walletProvider.isDefaultWallet &&
|
||||||
!_isMember.data!)
|
!isMember.data!)
|
||||||
deleteWallet(context, walletProvider,
|
deleteWallet(context, walletProvider,
|
||||||
_currentChest)
|
currentChest)
|
||||||
else
|
else
|
||||||
const SizedBox(),
|
const SizedBox(),
|
||||||
if (_isMember.data!)
|
if (isMember.data!)
|
||||||
manageMemberStatus(context)
|
manageMemberStatus(context)
|
||||||
]);
|
]);
|
||||||
}),
|
}),
|
||||||
|
@ -234,9 +234,9 @@ class WalletOptions extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final _newPath = await (walletProvider.changeAvatar());
|
final newPath = await (walletProvider.changeAvatar());
|
||||||
if (_newPath != '') {
|
if (newPath != '') {
|
||||||
wallet.imageCustomPath = _newPath;
|
wallet.imageCustomPath = newPath;
|
||||||
walletBox.put(wallet.key, wallet);
|
walletBox.put(wallet.key, wallet);
|
||||||
}
|
}
|
||||||
walletProvider.reloadBuild();
|
walletProvider.reloadBuild();
|
||||||
|
@ -339,7 +339,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
|
|
||||||
Widget activityWidget(
|
Widget activityWidget(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
WalletsProfilesProvider _historyProvider,
|
WalletsProfilesProvider historyProvider,
|
||||||
WalletOptionsProvider walletProvider) {
|
WalletOptionsProvider walletProvider) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
key: const Key('displayActivity'),
|
key: const Key('displayActivity'),
|
||||||
|
@ -380,7 +380,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget manageMemberStatus(BuildContext context) {
|
Widget manageMemberStatus(BuildContext context) {
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
return InkWell(
|
return InkWell(
|
||||||
key: const Key('manageStatus'),
|
key: const Key('manageStatus'),
|
||||||
|
@ -389,7 +389,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return ManageMembership(
|
return ManageMembership(
|
||||||
address: _walletOptions.address.text,
|
address: walletOptions.address.text,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
@ -412,18 +412,17 @@ class WalletOptions extends StatelessWidget {
|
||||||
Widget setDefaultWalletWidget(
|
Widget setDefaultWalletWidget(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
WalletOptionsProvider walletProvider,
|
WalletOptionsProvider walletProvider,
|
||||||
MyWalletsProvider _myWalletProvider,
|
MyWalletsProvider myWalletProvider,
|
||||||
WalletOptionsProvider _walletOptions,
|
WalletOptionsProvider walletOptions,
|
||||||
int _currentChest) {
|
int currentChest) {
|
||||||
return Consumer<MyWalletsProvider>(
|
return Consumer<MyWalletsProvider>(builder: (context, myWalletProvider, _) {
|
||||||
builder: (context, _myWalletProvider, _) {
|
WalletData defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
WalletData defaultWallet = _myWalletProvider.getDefaultWallet();
|
walletOptions.isDefaultWallet = (defaultWallet.number == wallet.id()[1]);
|
||||||
_walletOptions.isDefaultWallet = (defaultWallet.number == wallet.id()[1]);
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
key: const Key('setDefaultWallet'),
|
key: const Key('setDefaultWallet'),
|
||||||
onTap: !walletProvider.isDefaultWallet
|
onTap: !walletProvider.isDefaultWallet
|
||||||
? () async {
|
? () async {
|
||||||
await setDefaultWallet(context, _currentChest);
|
await setDefaultWallet(context, currentChest);
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
@ -454,50 +453,50 @@ class WalletOptions extends StatelessWidget {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future setDefaultWallet(BuildContext context, int _currentChest) async {
|
Future setDefaultWallet(BuildContext context, int currentChest) async {
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
// WalletData defaultWallet = _myWalletProvider.getDefaultWallet()!;
|
// WalletData defaultWallet = _myWalletProvider.getDefaultWallet()!;
|
||||||
// defaultWallet = wallet;
|
// defaultWallet = wallet;
|
||||||
await _sub.setCurrentWallet(wallet);
|
await sub.setCurrentWallet(wallet);
|
||||||
_myWalletProvider.readAllWallets(_currentChest);
|
myWalletProvider.readAllWallets(currentChest);
|
||||||
_myWalletProvider.rebuildWidget();
|
myWalletProvider.rebuildWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget deleteWallet(BuildContext context,
|
Widget deleteWallet(BuildContext context,
|
||||||
WalletOptionsProvider walletProvider, int _currentChest) {
|
WalletOptionsProvider walletProvider, int currentChest) {
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
final _defaultWallet = _myWalletProvider.getDefaultWallet();
|
final defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
final bool isDefaultWallet =
|
final bool isDefaultWallet =
|
||||||
walletProvider.address.text == _defaultWallet.address;
|
walletProvider.address.text == defaultWallet.address;
|
||||||
// return Consumer<MyWalletsProvider>(
|
// return Consumer<MyWalletsProvider>(
|
||||||
// builder: (context, _myWalletProvider, _) {
|
// builder: (context, _myWalletProvider, _) {
|
||||||
return FutureBuilder(
|
return FutureBuilder(
|
||||||
future: _sub.hasAccountConsumers(wallet.address!),
|
future: sub.hasAccountConsumers(wallet.address!),
|
||||||
builder: (BuildContext context, AsyncSnapshot<bool> _hasConsumers) {
|
builder: (BuildContext context, AsyncSnapshot<bool> hasConsumers) {
|
||||||
if (_hasConsumers.connectionState != ConnectionState.done ||
|
if (hasConsumers.connectionState != ConnectionState.done ||
|
||||||
_hasConsumers.hasError) {
|
hasConsumers.hasError) {
|
||||||
return const Text('');
|
return const Text('');
|
||||||
}
|
}
|
||||||
final double _balance =
|
final double balance =
|
||||||
balanceCache[walletProvider.address.text] ?? -1;
|
balanceCache[walletProvider.address.text] ?? -1;
|
||||||
final bool canDelete = !isDefaultWallet &&
|
final bool canDelete = !isDefaultWallet &&
|
||||||
!_hasConsumers.data! &&
|
!hasConsumers.data! &&
|
||||||
(_balance > 2 || _balance == 0);
|
(balance > 2 || balance == 0);
|
||||||
return InkWell(
|
return InkWell(
|
||||||
key: const Key('deleteWallet'),
|
key: const Key('deleteWallet'),
|
||||||
onTap: canDelete
|
onTap: canDelete
|
||||||
? () async {
|
? () async {
|
||||||
await walletProvider.deleteWallet(context, wallet);
|
await walletProvider.deleteWallet(context, wallet);
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
_myWalletProvider.listWallets =
|
myWalletProvider.listWallets =
|
||||||
_myWalletProvider.readAllWallets(_currentChest);
|
myWalletProvider.readAllWallets(currentChest);
|
||||||
_myWalletProvider.rebuildWidget();
|
myWalletProvider.rebuildWidget();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
|
|
|
@ -26,13 +26,13 @@ class WalletsHome extends StatelessWidget {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
MyWalletsProvider myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
HomeProvider _homeProvider =
|
HomeProvider homeProvider =
|
||||||
Provider.of<HomeProvider>(context, listen: false);
|
Provider.of<HomeProvider>(context, listen: false);
|
||||||
|
|
||||||
final int? _currentChestNumber = myWalletProvider.getCurrentChest();
|
final int currentChestNumber = myWalletProvider.getCurrentChest();
|
||||||
final ChestData _currentChest = chestBox.get(_currentChestNumber)!;
|
final ChestData currentChest = chestBox.get(currentChestNumber)!;
|
||||||
myWalletProvider.listWallets =
|
myWalletProvider.listWallets =
|
||||||
myWalletProvider.readAllWallets(_currentChestNumber);
|
myWalletProvider.readAllWallets(currentChestNumber);
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
|
@ -57,16 +57,16 @@ class WalletsHome extends StatelessWidget {
|
||||||
ModalRoute.withName('/'),
|
ModalRoute.withName('/'),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
title: Text(_currentChest.name!,
|
title: Text(currentChest.name!,
|
||||||
key: const Key('myWallets'),
|
key: const Key('myWallets'),
|
||||||
style: TextStyle(color: Colors.grey[850])),
|
style: TextStyle(color: Colors.grey[850])),
|
||||||
backgroundColor: const Color(0xffFFD58D),
|
backgroundColor: const Color(0xffFFD58D),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: _homeProvider.bottomAppBar(context),
|
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
myWalletsTiles(context, _currentChestNumber!),
|
myWalletsTiles(context, currentChestNumber),
|
||||||
CommonElements().offlineInfo(context),
|
CommonElements().offlineInfo(context),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -76,7 +76,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget chestOptions(
|
Widget chestOptions(
|
||||||
BuildContext context, MyWalletsProvider _myWalletProvider) {
|
BuildContext context, MyWalletsProvider myWalletProvider) {
|
||||||
return Column(children: [
|
return Column(children: [
|
||||||
const SizedBox(height: 50),
|
const SizedBox(height: 50),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
@ -95,11 +95,11 @@ class WalletsHome extends StatelessWidget {
|
||||||
onPressed: () => Navigator.push(
|
onPressed: () => Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return ChestOptions(walletProvider: _myWalletProvider);
|
return ChestOptions(walletProvider: myWalletProvider);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
label: Text(
|
label: Text(
|
||||||
" " + "manageChest".tr(),
|
" ${"manageChest".tr()}",
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 22,
|
fontSize: 22,
|
||||||
fontWeight: FontWeight.w700,
|
fontWeight: FontWeight.w700,
|
||||||
|
@ -133,18 +133,18 @@ class WalletsHome extends StatelessWidget {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget myWalletsTiles(BuildContext context, int _currentChestNumber) {
|
Widget myWalletsTiles(BuildContext context, int currentChestNumber) {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||||
|
|
||||||
if (!isWalletsExists) {
|
if (!isWalletsExists) {
|
||||||
return const Text('');
|
return const Text('');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_myWalletProvider.listWallets.isEmpty) {
|
if (myWalletProvider.listWallets.isEmpty) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Column(children: const <Widget>[
|
child: Column(children: const <Widget>[
|
||||||
Center(
|
Center(
|
||||||
|
@ -155,8 +155,8 @@ class WalletsHome extends StatelessWidget {
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
List _listWallets = _myWalletProvider.listWallets;
|
List listWallets = myWalletProvider.listWallets;
|
||||||
WalletData? defaultWallet = _myWalletProvider.getDefaultWallet();
|
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
final double screenWidth = MediaQuery.of(context).size.width;
|
final double screenWidth = MediaQuery.of(context).size.width;
|
||||||
int nTule = 2;
|
int nTule = 2;
|
||||||
|
|
||||||
|
@ -176,18 +176,18 @@ class WalletsHome extends StatelessWidget {
|
||||||
crossAxisSpacing: 0,
|
crossAxisSpacing: 0,
|
||||||
mainAxisSpacing: 0,
|
mainAxisSpacing: 0,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
for (WalletData _repository in _listWallets as Iterable<WalletData>)
|
for (WalletData repository in listWallets as Iterable<WalletData>)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_walletOptions.getAddress(
|
walletOptions.getAddress(
|
||||||
_currentChestNumber, _repository.derivation!);
|
currentChestNumber, repository.derivation!);
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
SmoothTransition(
|
SmoothTransition(
|
||||||
page: WalletOptions(
|
page: WalletOptions(
|
||||||
wallet: _repository,
|
wallet: repository,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -218,10 +218,10 @@ class WalletsHome extends StatelessWidget {
|
||||||
child:
|
child:
|
||||||
// SvgPicture.asset('assets/chopp-gecko2.png',
|
// SvgPicture.asset('assets/chopp-gecko2.png',
|
||||||
// semanticsLabel: 'Gecko', height: 48),
|
// semanticsLabel: 'Gecko', height: 48),
|
||||||
_repository.imageCustomPath == null ||
|
repository.imageCustomPath == null ||
|
||||||
_repository.imageCustomPath == ''
|
repository.imageCustomPath == ''
|
||||||
? Image.asset(
|
? Image.asset(
|
||||||
'assets/avatars/${_repository.imageDefaultPath}',
|
'assets/avatars/${repository.imageDefaultPath}',
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
)
|
)
|
||||||
|
@ -232,25 +232,24 @@ class WalletsHome extends StatelessWidget {
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
fit: BoxFit.fitHeight,
|
fit: BoxFit.fitHeight,
|
||||||
image: FileImage(
|
image: FileImage(
|
||||||
File(
|
File(repository.imageCustomPath!),
|
||||||
_repository.imageCustomPath!),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
Stack(children: <Widget>[
|
Stack(children: <Widget>[
|
||||||
balanceBuilder(context, _repository.address!,
|
balanceBuilder(context, repository.address!,
|
||||||
_repository.address == defaultWallet.address),
|
repository.address == defaultWallet.address),
|
||||||
nameBuilder(context, _repository, defaultWallet,
|
nameBuilder(context, repository, defaultWallet,
|
||||||
_currentChestNumber),
|
currentChestNumber),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return _sub.nodeConnected
|
return sub.nodeConnected
|
||||||
? addNewDerivation(context)
|
? addNewDerivation(context)
|
||||||
: const Text('');
|
: const Text('');
|
||||||
}),
|
}),
|
||||||
|
@ -264,11 +263,11 @@ class WalletsHome extends StatelessWidget {
|
||||||
// ))
|
// ))
|
||||||
]),
|
]),
|
||||||
// SliverToBoxAdapter(child: Spacer()),
|
// SliverToBoxAdapter(child: Spacer()),
|
||||||
SliverToBoxAdapter(child: chestOptions(context, _myWalletProvider)),
|
SliverToBoxAdapter(child: chestOptions(context, myWalletProvider)),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget balanceBuilder(context, String _address, bool isDefault) {
|
Widget balanceBuilder(context, String address, bool isDefault) {
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
color: isDefault ? orangeC : yellowC,
|
color: isDefault ? orangeC : yellowC,
|
||||||
|
@ -276,24 +275,24 @@ class WalletsHome extends StatelessWidget {
|
||||||
padding: const EdgeInsets.only(left: 5, right: 5, top: 38),
|
padding: const EdgeInsets.only(left: 5, right: 5, top: 38),
|
||||||
child: balance(
|
child: balance(
|
||||||
context,
|
context,
|
||||||
_address,
|
address,
|
||||||
15,
|
15,
|
||||||
isDefault ? Colors.white : Colors.black,
|
isDefault ? Colors.white : Colors.black,
|
||||||
isDefault ? yellowC : orangeC)),
|
isDefault ? yellowC : orangeC)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget nameBuilder(BuildContext context, WalletData _repository,
|
Widget nameBuilder(BuildContext context, WalletData repository,
|
||||||
WalletData defaultWallet, int _currentChestNumber) {
|
WalletData defaultWallet, int currentChestNumber) {
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
DuniterIndexer _duniterIndexer =
|
DuniterIndexer duniterIndexer =
|
||||||
Provider.of<DuniterIndexer>(context, listen: false);
|
Provider.of<DuniterIndexer>(context, listen: false);
|
||||||
return ListTile(
|
return ListTile(
|
||||||
shape: const RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.vertical(bottom: Radius.circular(12))),
|
borderRadius: BorderRadius.vertical(bottom: Radius.circular(12))),
|
||||||
// contentPadding: const EdgeInsets.only(left: 7.0),
|
// contentPadding: const EdgeInsets.only(left: 7.0),
|
||||||
tileColor: _repository.address == defaultWallet.address
|
tileColor: repository.address == defaultWallet.address
|
||||||
? orangeC
|
? orangeC
|
||||||
: const Color(0xffFFD58D),
|
: const Color(0xffFFD58D),
|
||||||
// leading: Text('IMAGE'),
|
// leading: Text('IMAGE'),
|
||||||
|
@ -303,13 +302,13 @@ class WalletsHome extends StatelessWidget {
|
||||||
title: Center(
|
title: Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 5, right: 5, bottom: 35, top: 5),
|
padding: const EdgeInsets.only(left: 5, right: 5, bottom: 35, top: 5),
|
||||||
child: _duniterIndexer.getNameByAddress(
|
child: duniterIndexer.getNameByAddress(
|
||||||
context,
|
context,
|
||||||
_repository.address!,
|
repository.address!,
|
||||||
_repository,
|
repository,
|
||||||
20,
|
20,
|
||||||
true,
|
true,
|
||||||
_repository.id()[1] == defaultWallet.id()[1]
|
repository.id()[1] == defaultWallet.id()[1]
|
||||||
? const Color(0xffF9F9F1)
|
? const Color(0xffF9F9F1)
|
||||||
: Colors.black),
|
: Colors.black),
|
||||||
),
|
),
|
||||||
|
@ -321,12 +320,12 @@ class WalletsHome extends StatelessWidget {
|
||||||
// _repository,
|
// _repository,
|
||||||
// _myWalletProvider.pinCode,
|
// _myWalletProvider.pinCode,
|
||||||
// pinLength);
|
// pinLength);
|
||||||
_walletOptions.getAddress(_currentChestNumber, _repository.derivation!);
|
walletOptions.getAddress(currentChestNumber, repository.derivation!);
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
SmoothTransition(
|
SmoothTransition(
|
||||||
page: WalletOptions(
|
page: WalletOptions(
|
||||||
wallet: _repository,
|
wallet: repository,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -335,11 +334,11 @@ class WalletsHome extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget addNewDerivation(context) {
|
Widget addNewDerivation(context) {
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
|
|
||||||
String _newDerivationName =
|
String newDerivationName =
|
||||||
'wallet'.tr() + ' ${_myWalletProvider.listWallets.last.number! + 2}';
|
'${'wallet'.tr()} ${myWalletProvider.listWallets.last.number! + 2}';
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
|
@ -349,12 +348,12 @@ class WalletsHome extends StatelessWidget {
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
key: const Key('addDerivation'),
|
key: const Key('addDerivation'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
if (!_myWalletProvider.isNewDerivationLoading) {
|
if (!myWalletProvider.isNewDerivationLoading) {
|
||||||
WalletData? defaultWallet =
|
WalletData? defaultWallet =
|
||||||
_myWalletProvider.getDefaultWallet();
|
myWalletProvider.getDefaultWallet();
|
||||||
String? _pin;
|
String? pin;
|
||||||
if (_myWalletProvider.pinCode == '') {
|
if (myWalletProvider.pinCode == '') {
|
||||||
_pin = await Navigator.push(
|
pin = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (homeContext) {
|
builder: (homeContext) {
|
||||||
|
@ -363,9 +362,9 @@ class WalletsHome extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (_pin != null || _myWalletProvider.pinCode != '') {
|
if (pin != null || myWalletProvider.pinCode != '') {
|
||||||
await _myWalletProvider.generateNewDerivation(
|
await myWalletProvider.generateNewDerivation(
|
||||||
context, _newDerivationName);
|
context, newDerivationName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -374,7 +373,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
decoration: BoxDecoration(color: floattingYellow),
|
decoration: BoxDecoration(color: floattingYellow),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: _myWalletProvider.isNewDerivationLoading
|
child: myWalletProvider.isNewDerivationLoading
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
height: 60,
|
height: 60,
|
||||||
width: 60,
|
width: 60,
|
||||||
|
@ -435,7 +434,7 @@ class ClipOvalShadow extends StatelessWidget {
|
||||||
clipper: clipper,
|
clipper: clipper,
|
||||||
shadow: shadow,
|
shadow: shadow,
|
||||||
),
|
),
|
||||||
child: ClipRect(child: child, clipper: clipper),
|
child: ClipRect(clipper: clipper, child: child),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,12 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context);
|
Provider.of<WalletOptionsProvider>(context);
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
final int _pinLenght = _generateWalletProvider.pin.text.length;
|
final int pinLenght = generateWalletProvider.pin.text.length;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
|
@ -56,7 +56,7 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
common.buildText("geckoWillCheckPassword".tr()),
|
common.buildText("geckoWillCheckPassword".tr()),
|
||||||
SizedBox(height: isTall ? 80 : 20),
|
SizedBox(height: isTall ? 80 : 20),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: _generateWalletProvider.scanedWalletNumber != -1,
|
visible: generateWalletProvider.scanedWalletNumber != -1,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 15),
|
padding: const EdgeInsets.only(bottom: 15),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
@ -69,9 +69,9 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return _sub.nodeConnected
|
return sub.nodeConnected
|
||||||
? pinForm(context, _walletOptions, _pinLenght, 1, 2)
|
? pinForm(context, walletOptions, pinLenght, 1, 2)
|
||||||
: Row(
|
: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: const [
|
children: const [
|
||||||
|
@ -86,11 +86,11 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
}),
|
}),
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return _sub.nodeConnected
|
return sub.nodeConnected
|
||||||
? InkWell(
|
? InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_walletOptions.changePinCacheChoice();
|
walletOptions.changePinCacheChoice();
|
||||||
},
|
},
|
||||||
child: Row(children: [
|
child: Row(children: [
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
|
@ -116,20 +116,20 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget pinForm(context, WalletOptionsProvider _walletOptions, _pinLenght,
|
Widget pinForm(context, WalletOptionsProvider walletOptions, pinLenght,
|
||||||
int _walletNbr, int _derivation) {
|
int walletNbr, int derivation) {
|
||||||
// var _walletPin = '';
|
// var _walletPin = '';
|
||||||
// ignore: close_sinks
|
// ignore: close_sinks
|
||||||
StreamController<ErrorAnimationType> errorController =
|
StreamController<ErrorAnimationType> errorController =
|
||||||
StreamController<ErrorAnimationType>();
|
StreamController<ErrorAnimationType>();
|
||||||
TextEditingController _enterPin = TextEditingController();
|
TextEditingController enterPin = TextEditingController();
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
final int? _currentChest = _myWalletProvider.getCurrentChest();
|
final int currentChest = myWalletProvider.getCurrentChest();
|
||||||
|
|
||||||
return Form(
|
return Form(
|
||||||
key: formKey,
|
key: formKey,
|
||||||
|
@ -143,14 +143,13 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
color: Colors.green.shade600,
|
color: Colors.green.shade600,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
length: _pinLenght,
|
length: pinLenght,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
obscuringCharacter: '*',
|
obscuringCharacter: '*',
|
||||||
animationType: AnimationType.fade,
|
animationType: AnimationType.fade,
|
||||||
validator: (v) {
|
validator: (v) {
|
||||||
if (v!.length < _pinLenght) {
|
if (v!.length < pinLenght) {
|
||||||
return "yourPasswordLengthIsX"
|
return "yourPasswordLengthIsX".tr(args: [pinLenght.toString()]);
|
||||||
.tr(args: [_pinLenght.toString()]);
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -170,7 +169,7 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
backgroundColor: const Color(0xffF9F9F1),
|
backgroundColor: const Color(0xffF9F9F1),
|
||||||
enableActiveFill: false,
|
enableActiveFill: false,
|
||||||
errorAnimationController: errorController,
|
errorAnimationController: errorController,
|
||||||
controller: _enterPin,
|
controller: enterPin,
|
||||||
keyboardType: TextInputType.visiblePassword,
|
keyboardType: TextInputType.visiblePassword,
|
||||||
boxShadows: const [
|
boxShadows: const [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
|
@ -179,25 +178,25 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
blurRadius: 10,
|
blurRadius: 10,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
onCompleted: (_pin) async {
|
onCompleted: (pin) async {
|
||||||
_myWalletProvider.pinCode = _pin.toUpperCase();
|
myWalletProvider.pinCode = pin.toUpperCase();
|
||||||
_myWalletProvider.pinLenght = _pinLenght;
|
myWalletProvider.pinLenght = pinLenght;
|
||||||
log.d(_pin + ' || ' + _generateWalletProvider.pin.text);
|
log.d('$pin || ${generateWalletProvider.pin.text}');
|
||||||
if (_pin.toUpperCase() == _generateWalletProvider.pin.text) {
|
if (pin.toUpperCase() == generateWalletProvider.pin.text) {
|
||||||
pinColor = Colors.green[500];
|
pinColor = Colors.green[500];
|
||||||
|
|
||||||
await _generateWalletProvider.storeHDWChest(context);
|
await generateWalletProvider.storeHDWChest(context);
|
||||||
bool isAlive = false;
|
bool isAlive = false;
|
||||||
if (scanDerivation) {
|
if (scanDerivation) {
|
||||||
isAlive = await _generateWalletProvider
|
isAlive = await generateWalletProvider
|
||||||
.scanDerivations(context, numberScan: 20);
|
.scanDerivations(context, numberScan: 20);
|
||||||
}
|
}
|
||||||
if (!isAlive) {
|
if (!isAlive) {
|
||||||
final address = await _sub.importAccount(
|
final address = await sub.importAccount(
|
||||||
fromMnemonic: true,
|
fromMnemonic: true,
|
||||||
mnemonic: _generateWalletProvider.generatedMnemonic!,
|
mnemonic: generateWalletProvider.generatedMnemonic!,
|
||||||
derivePath: '//2',
|
derivePath: '//2',
|
||||||
password: _generateWalletProvider.pin.text);
|
password: generateWalletProvider.pin.text);
|
||||||
WalletData myWallet = WalletData(
|
WalletData myWallet = WalletData(
|
||||||
version: dataVersion,
|
version: dataVersion,
|
||||||
chest: configBox.get('currentChest'),
|
chest: configBox.get('currentChest'),
|
||||||
|
@ -208,11 +207,11 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
imageDefaultPath: '0.png');
|
imageDefaultPath: '0.png');
|
||||||
await walletBox.add(myWallet);
|
await walletBox.add(myWallet);
|
||||||
}
|
}
|
||||||
_myWalletProvider.readAllWallets(_currentChest);
|
myWalletProvider.readAllWallets(currentChest);
|
||||||
_myWalletProvider.rebuildWidget();
|
myWalletProvider.rebuildWidget();
|
||||||
|
|
||||||
_generateWalletProvider.generatedMnemonic = '';
|
generateWalletProvider.generatedMnemonic = '';
|
||||||
_myWalletProvider.resetPinCode();
|
myWalletProvider.resetPinCode();
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
FaderTransition(
|
FaderTransition(
|
||||||
|
@ -223,7 +222,7 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
.shake); // Triggering error shake animation
|
.shake); // Triggering error shake animation
|
||||||
hasError = true;
|
hasError = true;
|
||||||
pinColor = Colors.red[600];
|
pinColor = Colors.red[600];
|
||||||
_walletOptions.reloadBuild();
|
walletOptions.reloadBuild();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ class _ChooseChestState extends State<OnboardingStepFive> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
final CommonElements common = CommonElements();
|
final CommonElements common = CommonElements();
|
||||||
|
@ -61,7 +61,7 @@ class _ChooseChestState extends State<OnboardingStepFive> {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return PrintWallet(_generateWalletProvider.generatedMnemonic);
|
return PrintWallet(generateWalletProvider.generatedMnemonic);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -106,7 +106,7 @@ class _ChooseChestState extends State<OnboardingStepFive> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget sentanceArray(BuildContext context) {
|
Widget sentanceArray(BuildContext context) {
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
|
@ -121,36 +121,36 @@ Widget sentanceArray(BuildContext context) {
|
||||||
)),
|
)),
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: _generateWalletProvider.generateWordList(context),
|
future: generateWalletProvider.generateWordList(context),
|
||||||
builder: (BuildContext context, AsyncSnapshot<List> _data) {
|
builder: (BuildContext context, AsyncSnapshot<List> data) {
|
||||||
if (!_data.hasData) {
|
if (!data.hasData) {
|
||||||
return const Text('');
|
return const Text('');
|
||||||
} else {
|
} else {
|
||||||
mnemoList = _data;
|
mnemoList = data;
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
arrayCell(_data.data![0]),
|
arrayCell(data.data![0]),
|
||||||
arrayCell(_data.data![1]),
|
arrayCell(data.data![1]),
|
||||||
arrayCell(_data.data![2]),
|
arrayCell(data.data![2]),
|
||||||
arrayCell(_data.data![3]),
|
arrayCell(data.data![3]),
|
||||||
]),
|
]),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
arrayCell(_data.data![4]),
|
arrayCell(data.data![4]),
|
||||||
arrayCell(_data.data![5]),
|
arrayCell(data.data![5]),
|
||||||
arrayCell(_data.data![6]),
|
arrayCell(data.data![6]),
|
||||||
arrayCell(_data.data![7]),
|
arrayCell(data.data![7]),
|
||||||
]),
|
]),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
arrayCell(_data.data![8]),
|
arrayCell(data.data![8]),
|
||||||
arrayCell(_data.data![9]),
|
arrayCell(data.data![9]),
|
||||||
arrayCell(_data.data![10]),
|
arrayCell(data.data![10]),
|
||||||
arrayCell(_data.data![11]),
|
arrayCell(data.data![11]),
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ class PrintWallet extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
|
@ -208,7 +208,7 @@ class PrintWallet extends StatelessWidget {
|
||||||
body: PdfPreview(
|
body: PdfPreview(
|
||||||
canDebug: false,
|
canDebug: false,
|
||||||
canChangeOrientation: false,
|
canChangeOrientation: false,
|
||||||
build: (format) => _generateWalletProvider.printWallet(mnemoList),
|
build: (format) => generateWalletProvider.printWallet(mnemoList),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -217,9 +217,9 @@ class PrintWallet extends StatelessWidget {
|
||||||
|
|
||||||
Widget nextButton(
|
Widget nextButton(
|
||||||
BuildContext context, String text, bool isFast, bool skipIntro) {
|
BuildContext context, String text, bool isFast, bool skipIntro) {
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 380 * ratio,
|
width: 380 * ratio,
|
||||||
|
@ -231,17 +231,16 @@ Widget nextButton(
|
||||||
onPrimary: Colors.white, // foreground
|
onPrimary: Colors.white, // foreground
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_generateWalletProvider.nbrWord =
|
generateWalletProvider.nbrWord = generateWalletProvider.getRandomInt();
|
||||||
_generateWalletProvider.getRandomInt();
|
generateWalletProvider.nbrWordAlpha = generateWalletProvider
|
||||||
_generateWalletProvider.nbrWordAlpha = _generateWalletProvider
|
.intToString(generateWalletProvider.nbrWord + 1);
|
||||||
.intToString(_generateWalletProvider.nbrWord + 1);
|
myWalletProvider.mnemonic = generateWalletProvider.generatedMnemonic!;
|
||||||
_myWalletProvider.mnemonic = _generateWalletProvider.generatedMnemonic!;
|
|
||||||
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
FaderTransition(
|
FaderTransition(
|
||||||
page: OnboardingStepSix(
|
page: OnboardingStepSix(
|
||||||
generatedMnemonic: _generateWalletProvider.generatedMnemonic,
|
generatedMnemonic: generateWalletProvider.generatedMnemonic,
|
||||||
skipIntro: skipIntro),
|
skipIntro: skipIntro),
|
||||||
isFast: true),
|
isFast: true),
|
||||||
);
|
);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class OnboardingStepSix extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context, listen: true);
|
Provider.of<GenerateWalletsProvider>(context, listen: true);
|
||||||
|
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
|
@ -32,8 +32,8 @@ class OnboardingStepSix extends StatelessWidget {
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
_generateWalletProvider.isAskedWordValid = false;
|
generateWalletProvider.isAskedWordValid = false;
|
||||||
_generateWalletProvider.askedWordColor = Colors.black;
|
generateWalletProvider.askedWordColor = Colors.black;
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
@ -59,11 +59,11 @@ class OnboardingStepSix extends StatelessWidget {
|
||||||
SizedBox(height: isTall ? 40 : 20),
|
SizedBox(height: isTall ? 40 : 20),
|
||||||
common.buildText(
|
common.buildText(
|
||||||
"didYouNoteMnemonicToBeSureTypeWord".tr(
|
"didYouNoteMnemonicToBeSureTypeWord".tr(
|
||||||
args: [(_generateWalletProvider.nbrWord + 1).toString()]),
|
args: [(generateWalletProvider.nbrWord + 1).toString()]),
|
||||||
20,
|
20,
|
||||||
true),
|
true),
|
||||||
SizedBox(height: isTall ? 70 : 20),
|
SizedBox(height: isTall ? 70 : 20),
|
||||||
Text('${_generateWalletProvider.nbrWord + 1}',
|
Text('${generateWalletProvider.nbrWord + 1}',
|
||||||
key: const Key('askedWord'),
|
key: const Key('askedWord'),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: isTall ? 17 : 15,
|
fontSize: isTall ? 17 : 15,
|
||||||
|
@ -81,11 +81,11 @@ class OnboardingStepSix extends StatelessWidget {
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
key: const Key('inputWord'),
|
key: const Key('inputWord'),
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
enabled: !_generateWalletProvider.isAskedWordValid,
|
enabled: !generateWalletProvider.isAskedWordValid,
|
||||||
controller: wordController,
|
controller: wordController,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
_generateWalletProvider.checkAskedWord(
|
generateWalletProvider.checkAskedWord(
|
||||||
value, _mnemonicController.text);
|
value, _mnemonicController.text);
|
||||||
},
|
},
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
|
@ -95,20 +95,19 @@ class OnboardingStepSix extends StatelessWidget {
|
||||||
fontSize: 22.0,
|
fontSize: 22.0,
|
||||||
color: Colors.grey[500],
|
color: Colors.grey[500],
|
||||||
fontWeight: FontWeight.w500),
|
fontWeight: FontWeight.w500),
|
||||||
labelText: _generateWalletProvider.isAskedWordValid
|
labelText: generateWalletProvider.isAskedWordValid
|
||||||
? "itsTheGoodWord".tr()
|
? "itsTheGoodWord".tr()
|
||||||
: "${_generateWalletProvider.nbrWordAlpha} " +
|
: "${generateWalletProvider.nbrWordAlpha} ${"nthMnemonicWord".tr()}",
|
||||||
"nthMnemonicWord".tr(),
|
|
||||||
fillColor: const Color(0xffeeeedd),
|
fillColor: const Color(0xffeeeedd),
|
||||||
filled: true,
|
filled: true,
|
||||||
contentPadding: const EdgeInsets.all(12),
|
contentPadding: const EdgeInsets.all(12),
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 40.0,
|
fontSize: 40.0,
|
||||||
color: _generateWalletProvider.askedWordColor,
|
color: generateWalletProvider.askedWordColor,
|
||||||
fontWeight: FontWeight.w500))),
|
fontWeight: FontWeight.w500))),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: _generateWalletProvider.isAskedWordValid,
|
visible: generateWalletProvider.isAskedWordValid,
|
||||||
child: Expanded(
|
child: Expanded(
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
|
@ -141,7 +140,7 @@ class OnboardingStepSix extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget sentanceArray(BuildContext context) {
|
Widget sentanceArray(BuildContext context) {
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
|
@ -156,9 +155,9 @@ Widget sentanceArray(BuildContext context) {
|
||||||
)),
|
)),
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: _generateWalletProvider.generateWordList(context),
|
future: generateWalletProvider.generateWordList(context),
|
||||||
builder: (BuildContext context, AsyncSnapshot<List> _data) {
|
builder: (BuildContext context, AsyncSnapshot<List> data) {
|
||||||
if (!_data.hasData) {
|
if (!data.hasData) {
|
||||||
return const Text('');
|
return const Text('');
|
||||||
} else {
|
} else {
|
||||||
return Column(
|
return Column(
|
||||||
|
@ -167,24 +166,24 @@ Widget sentanceArray(BuildContext context) {
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
arrayCell(_data.data![0]),
|
arrayCell(data.data![0]),
|
||||||
arrayCell(_data.data![1]),
|
arrayCell(data.data![1]),
|
||||||
arrayCell(_data.data![2]),
|
arrayCell(data.data![2]),
|
||||||
arrayCell(_data.data![3]),
|
arrayCell(data.data![3]),
|
||||||
]),
|
]),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
arrayCell(_data.data![4]),
|
arrayCell(data.data![4]),
|
||||||
arrayCell(_data.data![5]),
|
arrayCell(data.data![5]),
|
||||||
arrayCell(_data.data![6]),
|
arrayCell(data.data![6]),
|
||||||
arrayCell(_data.data![7]),
|
arrayCell(data.data![7]),
|
||||||
]),
|
]),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
arrayCell(_data.data![8]),
|
arrayCell(data.data![8]),
|
||||||
arrayCell(_data.data![9]),
|
arrayCell(data.data![9]),
|
||||||
arrayCell(_data.data![10]),
|
arrayCell(data.data![10]),
|
||||||
arrayCell(_data.data![11]),
|
arrayCell(data.data![11]),
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -211,11 +210,11 @@ Widget arrayCell(dataWord) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget nextButton(BuildContext context, String text, nextScreen, bool isFast) {
|
Widget nextButton(BuildContext context, String text, nextScreen, bool isFast) {
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
Provider.of<GenerateWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
_generateWalletProvider.isAskedWordValid = false;
|
generateWalletProvider.isAskedWordValid = false;
|
||||||
_generateWalletProvider.askedWordColor = Colors.black;
|
generateWalletProvider.askedWordColor = Colors.black;
|
||||||
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 380 * ratio,
|
width: 380 * ratio,
|
||||||
|
|
|
@ -17,15 +17,15 @@ class OnboardingStepNine extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
GenerateWalletsProvider _generateWalletProvider =
|
GenerateWalletsProvider generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
// MyWalletsProvider myWalletProvider =
|
// MyWalletsProvider myWalletProvider =
|
||||||
// Provider.of<MyWalletsProvider>(context);
|
// Provider.of<MyWalletsProvider>(context);
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
|
|
||||||
_generateWalletProvider.pin.text = debugPin // kDebugMode &&
|
generateWalletProvider.pin.text = debugPin // kDebugMode &&
|
||||||
? 'AAAAA'
|
? 'AAAAA'
|
||||||
: _generateWalletProvider.changePinCode(reload: false).toUpperCase();
|
: generateWalletProvider.changePinCode(reload: false).toUpperCase();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
|
@ -53,7 +53,7 @@ class OnboardingStepNine extends StatelessWidget {
|
||||||
TextField(
|
TextField(
|
||||||
key: const Key('generatedPin'),
|
key: const Key('generatedPin'),
|
||||||
enabled: false,
|
enabled: false,
|
||||||
controller: _generateWalletProvider.pin,
|
controller: generateWalletProvider.pin,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
decoration: const InputDecoration(),
|
decoration: const InputDecoration(),
|
||||||
|
@ -66,7 +66,7 @@ class OnboardingStepNine extends StatelessWidget {
|
||||||
icon: const Icon(Icons.replay),
|
icon: const Icon(Icons.replay),
|
||||||
color: orangeC,
|
color: orangeC,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_generateWalletProvider.changePinCode(reload: true);
|
generateWalletProvider.changePinCode(reload: true);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -85,7 +85,7 @@ class OnboardingStepNine extends StatelessWidget {
|
||||||
onPrimary: Colors.black, // foreground
|
onPrimary: Colors.black, // foreground
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_generateWalletProvider.changePinCode(reload: true);
|
generateWalletProvider.changePinCode(reload: true);
|
||||||
},
|
},
|
||||||
child: Text("chooseAnotherPassword".tr(),
|
child: Text("chooseAnotherPassword".tr(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
|
|
@ -16,14 +16,14 @@ class SearchScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
SearchProvider _searchProvider = Provider.of<SearchProvider>(context);
|
SearchProvider searchProvider = Provider.of<SearchProvider>(context);
|
||||||
final double screenHeight = MediaQuery.of(context).size.height;
|
final double screenHeight = MediaQuery.of(context).size.height;
|
||||||
// HomeProvider _homeProvider =
|
// HomeProvider _homeProvider =
|
||||||
// Provider.of<HomeProvider>(context, listen: false);
|
// Provider.of<HomeProvider>(context, listen: false);
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
_searchProvider.searchController.text = '';
|
searchProvider.searchController.text = '';
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
@ -39,7 +39,7 @@ class SearchScreen extends StatelessWidget {
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_searchProvider.searchController.text = '';
|
searchProvider.searchController.text = '';
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
@ -51,11 +51,11 @@ class SearchScreen extends StatelessWidget {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 17),
|
padding: const EdgeInsets.symmetric(horizontal: 17),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _searchProvider.searchController,
|
controller: searchProvider.searchController,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
onChanged: (v) => _searchProvider.rebuildWidget(),
|
onChanged: (v) => searchProvider.rebuildWidget(),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
|
@ -96,7 +96,7 @@ class SearchScreen extends StatelessWidget {
|
||||||
primary: orangeC, // background
|
primary: orangeC, // background
|
||||||
onPrimary: Colors.white, // foreground
|
onPrimary: Colors.white, // foreground
|
||||||
),
|
),
|
||||||
onPressed: _searchProvider.searchController.text.length >= 2
|
onPressed: searchProvider.searchController.text.length >= 2
|
||||||
? () {
|
? () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
|
|
@ -20,19 +20,19 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
SearchProvider _searchProvider =
|
SearchProvider searchProvider =
|
||||||
Provider.of<SearchProvider>(context, listen: false);
|
Provider.of<SearchProvider>(context, listen: false);
|
||||||
CesiumPlusProvider _cesiumPlusProvider =
|
CesiumPlusProvider cesiumPlusProvider =
|
||||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
WalletsProfilesProvider _walletsProfilesClass =
|
WalletsProfilesProvider walletsProfilesClass =
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
HomeProvider _homeProvider =
|
HomeProvider homeProvider =
|
||||||
Provider.of<HomeProvider>(context, listen: false);
|
Provider.of<HomeProvider>(context, listen: false);
|
||||||
DuniterIndexer _duniterIndexer =
|
DuniterIndexer duniterIndexer =
|
||||||
Provider.of<DuniterIndexer>(context, listen: false);
|
Provider.of<DuniterIndexer>(context, listen: false);
|
||||||
|
|
||||||
int keyID = 0;
|
int keyID = 0;
|
||||||
double _avatarSize = 55;
|
double avatarSize = 55;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
|
@ -44,7 +44,7 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
child: Text('researchResults'.tr()),
|
child: Text('researchResults'.tr()),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: _homeProvider.bottomAppBar(context),
|
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Stack(children: [
|
child: Stack(children: [
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -64,7 +64,7 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
text: "resultsFor".tr(),
|
text: "resultsFor".tr(),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: '"${_searchProvider.searchController.text}"',
|
text: '"${searchProvider.searchController.text}"',
|
||||||
style: const TextStyle(fontStyle: FontStyle.italic),
|
style: const TextStyle(fontStyle: FontStyle.italic),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -77,13 +77,13 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _searchProvider.searchAddress(),
|
future: searchProvider.searchAddress(),
|
||||||
builder: (context, AsyncSnapshot<List?> snapshot) {
|
builder: (context, AsyncSnapshot<List?> snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
log.d(snapshot.data);
|
log.d(snapshot.data);
|
||||||
if (snapshot.data?.isEmpty ?? true) {
|
if (snapshot.data?.isEmpty ?? true) {
|
||||||
return _duniterIndexer.searchIdentity(
|
return duniterIndexer.searchIdentity(
|
||||||
context, _searchProvider.searchController.text);
|
context, searchProvider.searchController.text);
|
||||||
|
|
||||||
// const Text('Aucun résultat');
|
// const Text('Aucun résultat');
|
||||||
} else {
|
} else {
|
||||||
|
@ -98,8 +98,8 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
key: Key('searchResult${keyID++}'),
|
key: Key('searchResult${keyID++}'),
|
||||||
horizontalTitleGap: 40,
|
horizontalTitleGap: 40,
|
||||||
contentPadding: const EdgeInsets.all(5),
|
contentPadding: const EdgeInsets.all(5),
|
||||||
leading: _cesiumPlusProvider
|
leading: cesiumPlusProvider
|
||||||
.defaultAvatar(_avatarSize),
|
.defaultAvatar(avatarSize),
|
||||||
title: Row(children: <Widget>[
|
title: Row(children: <Widget>[
|
||||||
Text(getShortPubkey(g1Wallet.pubkey!),
|
Text(getShortPubkey(g1Wallet.pubkey!),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
@ -116,7 +116,7 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
context, g1Wallet.pubkey!, 16)
|
context, g1Wallet.pubkey!, 16)
|
||||||
]),
|
]),
|
||||||
subtitle: Row(children: <Widget>[
|
subtitle: Row(children: <Widget>[
|
||||||
_duniterIndexer.getNameByAddress(
|
duniterIndexer.getNameByAddress(
|
||||||
context, g1Wallet.pubkey!)
|
context, g1Wallet.pubkey!)
|
||||||
]),
|
]),
|
||||||
dense: false,
|
dense: false,
|
||||||
|
@ -125,7 +125,7 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
_walletsProfilesClass.address =
|
walletsProfilesClass.address =
|
||||||
g1Wallet.pubkey;
|
g1Wallet.pubkey;
|
||||||
return WalletViewScreen(
|
return WalletViewScreen(
|
||||||
pubkey: g1Wallet.pubkey,
|
pubkey: g1Wallet.pubkey,
|
||||||
|
|
|
@ -68,13 +68,13 @@ class SettingsScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget duniterEndpointSelection(BuildContext context) {
|
Widget duniterEndpointSelection(BuildContext context) {
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
String? selectedDuniterEndpoint;
|
String? selectedDuniterEndpoint;
|
||||||
|
|
||||||
// List of items in our dropdown menu
|
// List of items in our dropdown menu
|
||||||
var duniterBootstrapNodes = _sub.getDuniterBootstrap();
|
var duniterBootstrapNodes = sub.getDuniterBootstrap();
|
||||||
selectedDuniterEndpoint =
|
selectedDuniterEndpoint =
|
||||||
_sub.getConnectedEndpoint() ?? duniterBootstrapNodes.first.endpoint;
|
sub.getConnectedEndpoint() ?? duniterBootstrapNodes.first.endpoint;
|
||||||
|
|
||||||
final customEndpoint = NetworkParams();
|
final customEndpoint = NetworkParams();
|
||||||
customEndpoint.name = currencyName;
|
customEndpoint.name = currencyName;
|
||||||
|
@ -95,15 +95,15 @@ class SettingsScreen extends StatelessWidget {
|
||||||
selectedDuniterEndpoint = customEndpoint.endpoint;
|
selectedDuniterEndpoint = customEndpoint.endpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditingController _endpointController = TextEditingController(
|
TextEditingController endpointController = TextEditingController(
|
||||||
text: configBox.containsKey('customEndpoint')
|
text: configBox.containsKey('customEndpoint')
|
||||||
? configBox.get('customEndpoint')
|
? configBox.get('customEndpoint')
|
||||||
: 'wss://');
|
: 'wss://');
|
||||||
|
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
Row(children: [
|
Row(children: [
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
log.d(_sub.sdk.api.connectedNode?.endpoint);
|
log.d(sub.sdk.api.connectedNode?.endpoint);
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Row(children: [
|
child: Row(children: [
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
|
@ -114,49 +114,49 @@ class SettingsScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Icon(_sub.nodeConnected && !_sub.isLoadingEndpoint
|
Icon(sub.nodeConnected && !sub.isLoadingEndpoint
|
||||||
? Icons.check
|
? Icons.check
|
||||||
: Icons.close),
|
: Icons.close),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 265,
|
width: 265,
|
||||||
child: Consumer<SettingsProvider>(builder: (context, _set, _) {
|
child: Consumer<SettingsProvider>(builder: (context, set, _) {
|
||||||
return DropdownButtonHideUnderline(
|
return DropdownButtonHideUnderline(
|
||||||
child: DropdownButton(
|
child: DropdownButton(
|
||||||
// alignment: AlignmentDirectional.topStart,
|
// alignment: AlignmentDirectional.topStart,
|
||||||
value: selectedDuniterEndpoint,
|
value: selectedDuniterEndpoint,
|
||||||
icon: const Icon(Icons.keyboard_arrow_down),
|
icon: const Icon(Icons.keyboard_arrow_down),
|
||||||
items: duniterBootstrapNodes
|
items: duniterBootstrapNodes
|
||||||
.map((NetworkParams _endpointParams) {
|
.map((NetworkParams endpointParams) {
|
||||||
return DropdownMenuItem(
|
return DropdownMenuItem(
|
||||||
value: _endpointParams.endpoint,
|
value: endpointParams.endpoint,
|
||||||
child: Text(_endpointParams.endpoint!),
|
child: Text(endpointParams.endpoint!),
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
onChanged: (String? _newEndpoint) {
|
onChanged: (String? newEndpoint) {
|
||||||
log.d(_newEndpoint!);
|
log.d(newEndpoint!);
|
||||||
selectedDuniterEndpoint = _newEndpoint;
|
selectedDuniterEndpoint = newEndpoint;
|
||||||
_set.reload();
|
set.reload();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
const Spacer(flex: 5),
|
const Spacer(flex: 5),
|
||||||
_sub.isLoadingEndpoint
|
sub.isLoadingEndpoint
|
||||||
? CircularProgressIndicator(color: orangeC)
|
? CircularProgressIndicator(color: orangeC)
|
||||||
: Consumer<SettingsProvider>(builder: (context, _set, _) {
|
: Consumer<SettingsProvider>(builder: (context, set, _) {
|
||||||
return IconButton(
|
return IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.send,
|
Icons.send,
|
||||||
color: selectedDuniterEndpoint !=
|
color: selectedDuniterEndpoint !=
|
||||||
_sub.getConnectedEndpoint()
|
sub.getConnectedEndpoint()
|
||||||
? orangeC
|
? orangeC
|
||||||
: Colors.grey[500],
|
: Colors.grey[500],
|
||||||
size: 40,
|
size: 40,
|
||||||
),
|
),
|
||||||
onPressed: selectedDuniterEndpoint !=
|
onPressed: selectedDuniterEndpoint !=
|
||||||
_sub.getConnectedEndpoint()
|
sub.getConnectedEndpoint()
|
||||||
? () async {
|
? () async {
|
||||||
if (selectedDuniterEndpoint == 'Auto') {
|
if (selectedDuniterEndpoint == 'Auto') {
|
||||||
configBox.delete('customEndpoint');
|
configBox.delete('customEndpoint');
|
||||||
|
@ -166,12 +166,12 @@ class SettingsScreen extends StatelessWidget {
|
||||||
final finalEndpoint =
|
final finalEndpoint =
|
||||||
selectedDuniterEndpoint ==
|
selectedDuniterEndpoint ==
|
||||||
'Personnalisé'
|
'Personnalisé'
|
||||||
? _endpointController.text
|
? endpointController.text
|
||||||
: selectedDuniterEndpoint;
|
: selectedDuniterEndpoint;
|
||||||
configBox.put(
|
configBox.put(
|
||||||
'customEndpoint', finalEndpoint);
|
'customEndpoint', finalEndpoint);
|
||||||
}
|
}
|
||||||
await _sub.connectNode(context);
|
await sub.connectNode(context);
|
||||||
}
|
}
|
||||||
: null);
|
: null);
|
||||||
}),
|
}),
|
||||||
|
@ -180,31 +180,31 @@ class SettingsScreen extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
Consumer<SettingsProvider>(builder: (context, _set, _) {
|
Consumer<SettingsProvider>(builder: (context, set, _) {
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible: selectedDuniterEndpoint == 'Personnalisé',
|
visible: selectedDuniterEndpoint == 'Personnalisé',
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 200,
|
width: 200,
|
||||||
height: 50,
|
height: 50,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _endpointController,
|
controller: endpointController,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Consumer<SettingsProvider>(builder: (context, _set, _) {
|
Consumer<SettingsProvider>(builder: (context, set, _) {
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible: selectedDuniterEndpoint == 'Auto',
|
visible: selectedDuniterEndpoint == 'Auto',
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 250,
|
width: 250,
|
||||||
height: _sub.getConnectedEndpoint() == null ? 60 : 20,
|
height: sub.getConnectedEndpoint() == null ? 60 : 20,
|
||||||
child: Text(
|
child: Text(
|
||||||
_sub.getConnectedEndpoint() ??
|
sub.getConnectedEndpoint() ??
|
||||||
"Un noeud sûr et valide sera choisi automatiquement parmis une liste aléatoire.",
|
"Un noeud sûr et valide sera choisi automatiquement parmis une liste aléatoire.",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
|
@ -215,7 +215,7 @@ class SettingsScreen extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
Text(
|
Text(
|
||||||
'bloc N°${_sub.blocNumber}',
|
'bloc N°${sub.blocNumber}',
|
||||||
style: TextStyle(fontSize: 14, color: Colors.grey[700]),
|
style: TextStyle(fontSize: 14, color: Colors.grey[700]),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
@ -225,7 +225,7 @@ class SettingsScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget indexerEndpointSelection(BuildContext context) {
|
Widget indexerEndpointSelection(BuildContext context) {
|
||||||
DuniterIndexer _indexer =
|
DuniterIndexer indexer =
|
||||||
Provider.of<DuniterIndexer>(context, listen: false);
|
Provider.of<DuniterIndexer>(context, listen: false);
|
||||||
|
|
||||||
String? selectedIndexerEndpoint;
|
String? selectedIndexerEndpoint;
|
||||||
|
@ -236,19 +236,19 @@ class SettingsScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedIndexerEndpoint == '') {
|
if (selectedIndexerEndpoint == '') {
|
||||||
selectedIndexerEndpoint = _indexer.listIndexerEndpoints[0];
|
selectedIndexerEndpoint = indexer.listIndexerEndpoints[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditingController _indexerEndpointController = TextEditingController(
|
TextEditingController indexerEndpointController = TextEditingController(
|
||||||
text: configBox.containsKey('customIndexer')
|
text: configBox.containsKey('customIndexer')
|
||||||
? configBox.get('customIndexer')
|
? configBox.get('customIndexer')
|
||||||
: 'https://');
|
: 'https://');
|
||||||
|
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
Row(children: [
|
Row(children: [
|
||||||
Consumer<DuniterIndexer>(builder: (context, _indexer, _) {
|
Consumer<DuniterIndexer>(builder: (context, indexer, _) {
|
||||||
log.d(selectedIndexerEndpoint);
|
log.d(selectedIndexerEndpoint);
|
||||||
log.d(_indexer.listIndexerEndpoints);
|
log.d(indexer.listIndexerEndpoints);
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Row(children: [
|
child: Row(children: [
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
|
@ -261,32 +261,32 @@ class SettingsScreen extends StatelessWidget {
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 265,
|
width: 265,
|
||||||
child: Consumer<SettingsProvider>(builder: (context, _set, _) {
|
child: Consumer<SettingsProvider>(builder: (context, set, _) {
|
||||||
return DropdownButtonHideUnderline(
|
return DropdownButtonHideUnderline(
|
||||||
child: DropdownButton(
|
child: DropdownButton(
|
||||||
// alignment: AlignmentDirectional.topStart,
|
// alignment: AlignmentDirectional.topStart,
|
||||||
value: selectedIndexerEndpoint,
|
value: selectedIndexerEndpoint,
|
||||||
icon: const Icon(Icons.keyboard_arrow_down),
|
icon: const Icon(Icons.keyboard_arrow_down),
|
||||||
items:
|
items:
|
||||||
_indexer.listIndexerEndpoints.map((_indexerEndpoint) {
|
indexer.listIndexerEndpoints.map((indexerEndpoint) {
|
||||||
return DropdownMenuItem(
|
return DropdownMenuItem(
|
||||||
value: _indexerEndpoint,
|
value: indexerEndpoint,
|
||||||
child: Text(_indexerEndpoint),
|
child: Text(indexerEndpoint),
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
onChanged: (_newEndpoint) {
|
onChanged: (newEndpoint) {
|
||||||
log.d(_newEndpoint!);
|
log.d(newEndpoint!);
|
||||||
selectedIndexerEndpoint = _newEndpoint.toString();
|
selectedIndexerEndpoint = newEndpoint.toString();
|
||||||
_set.reload();
|
set.reload();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
const Spacer(flex: 5),
|
const Spacer(flex: 5),
|
||||||
_indexer.isLoadingIndexer
|
indexer.isLoadingIndexer
|
||||||
? CircularProgressIndicator(color: orangeC)
|
? CircularProgressIndicator(color: orangeC)
|
||||||
: Consumer<SettingsProvider>(builder: (context, _set, _) {
|
: Consumer<SettingsProvider>(builder: (context, set, _) {
|
||||||
return IconButton(
|
return IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.send,
|
Icons.send,
|
||||||
|
@ -299,18 +299,18 @@ class SettingsScreen extends StatelessWidget {
|
||||||
? () async {
|
? () async {
|
||||||
final finalEndpoint =
|
final finalEndpoint =
|
||||||
selectedIndexerEndpoint == 'Personnalisé'
|
selectedIndexerEndpoint == 'Personnalisé'
|
||||||
? _indexerEndpointController.text
|
? indexerEndpointController.text
|
||||||
: selectedIndexerEndpoint!;
|
: selectedIndexerEndpoint!;
|
||||||
|
|
||||||
if (selectedIndexerEndpoint ==
|
if (selectedIndexerEndpoint ==
|
||||||
'Personnalisé') {
|
'Personnalisé') {
|
||||||
configBox.put('customIndexer',
|
configBox.put('customIndexer',
|
||||||
_indexerEndpointController.text);
|
indexerEndpointController.text);
|
||||||
} else {
|
} else {
|
||||||
configBox.delete('customIndexer');
|
configBox.delete('customIndexer');
|
||||||
}
|
}
|
||||||
log.d('connection to indexer $finalEndpoint');
|
log.d('connection to indexer $finalEndpoint');
|
||||||
await _indexer
|
await indexer
|
||||||
.checkIndexerEndpoint(finalEndpoint);
|
.checkIndexerEndpoint(finalEndpoint);
|
||||||
}
|
}
|
||||||
: null);
|
: null);
|
||||||
|
@ -320,28 +320,28 @@ class SettingsScreen extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
]),
|
]),
|
||||||
Consumer<SettingsProvider>(builder: (context, _set, _) {
|
Consumer<SettingsProvider>(builder: (context, set, _) {
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible: selectedIndexerEndpoint == 'Personnalisé',
|
visible: selectedIndexerEndpoint == 'Personnalisé',
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 200,
|
width: 200,
|
||||||
height: 50,
|
height: 50,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
controller: _indexerEndpointController,
|
controller: indexerEndpointController,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return Consumer<SettingsProvider>(builder: (context, _set, _) {
|
return Consumer<SettingsProvider>(builder: (context, set, _) {
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible: selectedIndexerEndpoint == 'Auto',
|
visible: selectedIndexerEndpoint == 'Auto',
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 250,
|
width: 250,
|
||||||
height: 60,
|
height: 60,
|
||||||
child: Text(
|
child: Text(
|
||||||
_sub.getConnectedEndpoint() ??
|
sub.getConnectedEndpoint() ??
|
||||||
"Un noeud sûr et valide sera choisi automatiquement parmis une liste aléatoire.",
|
"Un noeud sûr et valide sera choisi automatiquement parmis une liste aléatoire.",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 15,
|
fontSize: 15,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/stateful_wrapper.dart';
|
import 'package:gecko/models/stateful_wrapper.dart';
|
||||||
|
@ -25,21 +27,21 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
child: Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text('js-api chargé ?: ${_sub.sdkReady}'),
|
Text('js-api chargé ?: ${sub.sdkReady}'),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _sub.connectNode(context);
|
await sub.connectNode(context);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'🌐 Noeud connecté ?: ${_sub.nodeConnected} (${_sub.sdk.api.connectedNode?.endpoint})')),
|
'🌐 Noeud connecté ?: ${sub.nodeConnected} (${sub.sdk.api.connectedNode?.endpoint})')),
|
||||||
if (_sub.nodeConnected)
|
if (sub.nodeConnected)
|
||||||
Text(
|
Text(
|
||||||
'🏆 Noeud "$currencyName", bloc N°${_sub.blocNumber}'),
|
'🏆 Noeud "$currencyName", bloc N°${sub.blocNumber}'),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Row(children: [
|
Row(children: [
|
||||||
const Text('💳 Liste des coffres:'),
|
const Text('💳 Liste des coffres:'),
|
||||||
|
@ -50,22 +52,22 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
height: 35,
|
height: 35,
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await _sub.deleteAllAccounts();
|
await sub.deleteAllAccounts();
|
||||||
_sub.reload();
|
sub.reload();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
]),
|
]),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: _sub.getKeyStoreAddress(),
|
future: sub.getKeyStoreAddress(),
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
AsyncSnapshot<List<AddressInfo>> _data) {
|
AsyncSnapshot<List<AddressInfo>> data) {
|
||||||
return Column(children: [
|
return Column(children: [
|
||||||
if (_data.data != null)
|
if (data.data != null)
|
||||||
for (final AddressInfo addressInfo in _data.data!)
|
for (final AddressInfo addressInfo in data.data!)
|
||||||
Row(children: [
|
Row(children: [
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () => _sub.keyring.setCurrent(_sub
|
onTap: () => sub.keyring.setCurrent(sub
|
||||||
.keyring.keyPairs
|
.keyring.keyPairs
|
||||||
.firstWhere((element) =>
|
.firstWhere((element) =>
|
||||||
element.address ==
|
element.address ==
|
||||||
|
@ -89,11 +91,11 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
// ),
|
// ),
|
||||||
const SizedBox(width: 20),
|
const SizedBox(width: 20),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async => await _sub.derive(
|
onTap: () async => await sub.derive(
|
||||||
context,
|
context,
|
||||||
addressInfo.address!,
|
addressInfo.address!,
|
||||||
2,
|
2,
|
||||||
_sub.keystorePassword.text),
|
sub.keystorePassword.text),
|
||||||
child: const Text("🏂 Dériver"),
|
child: const Text("🏂 Dériver"),
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
@ -102,12 +104,12 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Text('🔒 Mot de passe du coffre:'),
|
const Text('🔒 Mot de passe du coffre:'),
|
||||||
TextField(
|
TextField(
|
||||||
controller: _sub.keystorePassword,
|
controller: sub.keystorePassword,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
obscuringCharacter: '•',
|
obscuringCharacter: '•',
|
||||||
enableSuggestions: false,
|
enableSuggestions: false,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
onChanged: (_) => _sub.reload(),
|
onChanged: (_) => sub.reload(),
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
@ -118,11 +120,11 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
primary: yellowC, // background
|
primary: yellowC, // background
|
||||||
onPrimary: Colors.black, // foreground
|
onPrimary: Colors.black, // foreground
|
||||||
),
|
),
|
||||||
onPressed: _sub.keystorePassword.text.isNotEmpty
|
onPressed: sub.keystorePassword.text.isNotEmpty
|
||||||
? () async {
|
? () async {
|
||||||
final res = await _sub.importAccount();
|
final res = await sub.importAccount();
|
||||||
_sub.importIsLoading = false;
|
sub.importIsLoading = false;
|
||||||
_sub.reload();
|
sub.reload();
|
||||||
snack(
|
snack(
|
||||||
context,
|
context,
|
||||||
res != ''
|
res != ''
|
||||||
|
@ -135,7 +137,7 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
style: TextStyle(fontSize: 20),
|
style: TextStyle(fontSize: 20),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (_sub.importIsLoading)
|
if (sub.importIsLoading)
|
||||||
const CircularProgressIndicator(),
|
const CircularProgressIndicator(),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
|
@ -144,9 +146,9 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
onPrimary: Colors.black, // foreground
|
onPrimary: Colors.black, // foreground
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await _sub.generateMnemonic();
|
await sub.generateMnemonic();
|
||||||
_sub.importIsLoading = false;
|
sub.importIsLoading = false;
|
||||||
_sub.reload();
|
sub.reload();
|
||||||
snack(context, 'Le mnemonic a été copié');
|
snack(context, 'Le mnemonic a été copié');
|
||||||
},
|
},
|
||||||
child: const Text(
|
child: const Text(
|
||||||
|
@ -158,13 +160,13 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 400,
|
width: 400,
|
||||||
child: Text(
|
child: Text(
|
||||||
_sub.generatedMnemonic,
|
sub.generatedMnemonic,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Text('-〰️---〰️---〰️-'),
|
const Text('-〰️---〰️---〰️-'),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Text(_sub.debugConnection)
|
Text(sub.debugConnection)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,123 +18,123 @@ class TransactionInProgress extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: true);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: true);
|
||||||
WalletsProfilesProvider _walletViewProvider =
|
WalletsProfilesProvider walletViewProvider =
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
bool isValid = false;
|
bool isValid = false;
|
||||||
|
|
||||||
String _resultText;
|
String resultText;
|
||||||
bool isLoading = true;
|
bool isLoading = true;
|
||||||
// Map jsonResult;
|
// Map jsonResult;
|
||||||
final _result = _sub.transactionStatus;
|
final result = sub.transactionStatus;
|
||||||
|
|
||||||
log.d(_walletViewProvider.address!);
|
log.d(walletViewProvider.address!);
|
||||||
|
|
||||||
final from = _myWalletProvider.getDefaultWallet().name!;
|
final from = myWalletProvider.getDefaultWallet().name!;
|
||||||
final to = getShortPubkey(_walletViewProvider.address!);
|
final to = getShortPubkey(walletViewProvider.address!);
|
||||||
final amount = _walletViewProvider.payAmount.text;
|
final amount = walletViewProvider.payAmount.text;
|
||||||
String _actionName = '';
|
String actionName = '';
|
||||||
|
|
||||||
switch (transType) {
|
switch (transType) {
|
||||||
case 'pay':
|
case 'pay':
|
||||||
{
|
{
|
||||||
_actionName = 'transaction'.tr();
|
actionName = 'transaction'.tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'cert':
|
case 'cert':
|
||||||
{
|
{
|
||||||
_actionName = 'certification'.tr();
|
actionName = 'certification'.tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'comfirmIdty':
|
case 'comfirmIdty':
|
||||||
{
|
{
|
||||||
_actionName = "identityConfirm".tr();
|
actionName = "identityConfirm".tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'revokeIdty':
|
case 'revokeIdty':
|
||||||
{
|
{
|
||||||
_actionName = "revokeAdhesion".tr();
|
actionName = "revokeAdhesion".tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
_actionName = 'strangeTransaction'.tr();
|
actionName = 'strangeTransaction'.tr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (_result) {
|
switch (result) {
|
||||||
case '':
|
case '':
|
||||||
{
|
{
|
||||||
_resultText = 'sending'.tr();
|
resultText = 'sending'.tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Ready':
|
case 'Ready':
|
||||||
{
|
{
|
||||||
_resultText = 'propagating'.tr();
|
resultText = 'propagating'.tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Broadcast':
|
case 'Broadcast':
|
||||||
{
|
{
|
||||||
_resultText = 'validating'.tr();
|
resultText = 'validating'.tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
// jsonResult = json.decode(_result);
|
// jsonResult = json.decode(_result);
|
||||||
log.d(_result);
|
log.d(result);
|
||||||
if (_result.contains('blockHash: ')) {
|
if (result.contains('blockHash: ')) {
|
||||||
isValid = true;
|
isValid = true;
|
||||||
_resultText = 'extrinsicValidated'.tr(args: [_actionName]);
|
resultText = 'extrinsicValidated'.tr(args: [actionName]);
|
||||||
} else {
|
} else {
|
||||||
isValid = false;
|
isValid = false;
|
||||||
_resultText = "anErrorOccured".tr() + ":\n";
|
resultText = "${"anErrorOccured".tr()}:\n";
|
||||||
final List _exceptionSplit = _result.split('Exception: ');
|
final List exceptionSplit = result.split('Exception: ');
|
||||||
String _exception;
|
String exception;
|
||||||
if (_exceptionSplit.length > 1) {
|
if (exceptionSplit.length > 1) {
|
||||||
_exception = _exceptionSplit[1];
|
exception = exceptionSplit[1];
|
||||||
} else {
|
} else {
|
||||||
_exception = _exceptionSplit[0];
|
exception = exceptionSplit[0];
|
||||||
}
|
}
|
||||||
// log.d('expection: $_exception');
|
// log.d('expection: $_exception');
|
||||||
switch (_exception) {
|
switch (exception) {
|
||||||
case 'cert.NotRespectCertPeriod':
|
case 'cert.NotRespectCertPeriod':
|
||||||
case 'identity.CreatorNotAllowedToCreateIdty':
|
case 'identity.CreatorNotAllowedToCreateIdty':
|
||||||
{
|
{
|
||||||
_resultText = "24hbetweenCerts".tr();
|
resultText = "24hbetweenCerts".tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'cert.CannotCertifySelf':
|
case 'cert.CannotCertifySelf':
|
||||||
{
|
{
|
||||||
_resultText = "canNotCertifySelf".tr();
|
resultText = "canNotCertifySelf".tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'identity.IdtyNameAlreadyExist':
|
case 'identity.IdtyNameAlreadyExist':
|
||||||
{
|
{
|
||||||
_resultText = "nameAlreadyExist".tr();
|
resultText = "nameAlreadyExist".tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'balances.KeepAlive':
|
case 'balances.KeepAlive':
|
||||||
{
|
{
|
||||||
_resultText = "2GDtoKeepAlive".tr();
|
resultText = "2GDtoKeepAlive".tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low':
|
case '1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low':
|
||||||
{
|
{
|
||||||
_resultText = "youHaveToFeedThisAccountBeforeUsing".tr();
|
resultText = "youHaveToFeedThisAccountBeforeUsing".tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'timeout':
|
case 'timeout':
|
||||||
{
|
{
|
||||||
_resultText += "execTimeoutOver".tr();
|
resultText += "execTimeoutOver".tr();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
_resultText += "\n$_exception";
|
resultText += "\n$exception";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ class TransactionInProgress extends StatelessWidget {
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
_sub.transactionStatus = '';
|
sub.transactionStatus = '';
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
if (transType == 'pay') Navigator.pop(context);
|
if (transType == 'pay') Navigator.pop(context);
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
|
@ -160,7 +160,7 @@ class TransactionInProgress extends StatelessWidget {
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text('extrinsicInProgress'.tr(args: [_actionName]))
|
Text('extrinsicInProgress'.tr(args: [actionName]))
|
||||||
]),
|
]),
|
||||||
)),
|
)),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
|
@ -238,7 +238,7 @@ class TransactionInProgress extends StatelessWidget {
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Text(
|
Text(
|
||||||
_resultText,
|
resultText,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(fontSize: 19 * ratio),
|
style: TextStyle(fontSize: 19 * ratio),
|
||||||
),
|
),
|
||||||
|
@ -258,7 +258,7 @@ class TransactionInProgress extends StatelessWidget {
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
_sub.transactionStatus = '';
|
sub.transactionStatus = '';
|
||||||
if (transType == 'pay') Navigator.pop(context);
|
if (transType == 'pay') Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
|
@ -31,19 +33,19 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
WalletsProfilesProvider _walletProfile =
|
WalletsProfilesProvider walletProfile =
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
CesiumPlusProvider _cesiumPlusProvider =
|
CesiumPlusProvider cesiumPlusProvider =
|
||||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
_walletProfile.address = pubkey!;
|
walletProfile.address = pubkey!;
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
HomeProvider _homeProvider =
|
HomeProvider homeProvider =
|
||||||
Provider.of<HomeProvider>(context, listen: false);
|
Provider.of<HomeProvider>(context, listen: false);
|
||||||
|
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
WalletData? defaultWallet = _myWalletProvider.getDefaultWallet();
|
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
_sub.setCurrentWallet(defaultWallet);
|
sub.setCurrentWallet(defaultWallet);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: backgroundColor,
|
backgroundColor: backgroundColor,
|
||||||
|
@ -58,13 +60,13 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return QrCodeFullscreen(
|
return QrCodeFullscreen(
|
||||||
_walletProfile.address!,
|
walletProfile.address!,
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: QrImageWidget(
|
child: QrImageWidget(
|
||||||
data: _walletProfile.address!,
|
data: walletProfile.address!,
|
||||||
version: QrVersions.auto,
|
version: QrVersions.auto,
|
||||||
size: 80,
|
size: 80,
|
||||||
),
|
),
|
||||||
|
@ -75,10 +77,10 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
child: Text('seeAWallet'.tr()),
|
child: Text('seeAWallet'.tr()),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: _homeProvider.bottomAppBar(context),
|
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
_walletProfile.headerProfileView(context, pubkey!, username),
|
walletProfile.headerProfileView(context, pubkey!, 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>[
|
||||||
|
@ -104,7 +106,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
return ActivityScreen(
|
return ActivityScreen(
|
||||||
address: pubkey,
|
address: pubkey,
|
||||||
avatar:
|
avatar:
|
||||||
_cesiumPlusProvider.defaultAvatar(50));
|
cesiumPlusProvider.defaultAvatar(50));
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
@ -119,53 +121,52 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
fontSize: buttonFontSize, fontWeight: FontWeight.w500),
|
fontSize: buttonFontSize, fontWeight: FontWeight.w500),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
WalletData? _defaultWallet =
|
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
_myWalletProvider.getDefaultWallet();
|
|
||||||
return FutureBuilder(
|
return FutureBuilder(
|
||||||
future: _sub.certState(_defaultWallet.address!,
|
future: sub.certState(defaultWallet.address!,
|
||||||
pubkey!), // .canCertify(_defaultWallet.address!, pubkey!),
|
pubkey!), // .canCertify(_defaultWallet.address!, pubkey!),
|
||||||
builder: (context, AsyncSnapshot<Map<String, int>> snapshot) {
|
builder: (context, AsyncSnapshot<Map<String, int>> snapshot) {
|
||||||
// log.d(snapshot.data);
|
// log.d(snapshot.data);
|
||||||
if (snapshot.data == null) return const SizedBox();
|
if (snapshot.data == null) return const SizedBox();
|
||||||
String _duration = '';
|
String duration = '';
|
||||||
if (snapshot.data!['certDelay'] != null ||
|
if (snapshot.data!['certDelay'] != null ||
|
||||||
snapshot.data!['certRenewable'] != null) {
|
snapshot.data!['certRenewable'] != null) {
|
||||||
final Duration _durationSeconds = Duration(
|
final Duration durationSeconds = Duration(
|
||||||
seconds: snapshot.data!['certDelay'] ??
|
seconds: snapshot.data!['certDelay'] ??
|
||||||
snapshot.data!['certRenewable']!);
|
snapshot.data!['certRenewable']!);
|
||||||
final int _seconds = _durationSeconds.inSeconds;
|
final int seconds = durationSeconds.inSeconds;
|
||||||
final int _minutes = _durationSeconds.inMinutes;
|
final int minutes = durationSeconds.inMinutes;
|
||||||
|
|
||||||
if (_seconds <= 0) {
|
if (seconds <= 0) {
|
||||||
_duration = 'seconds'.tr(args: ['0']);
|
duration = 'seconds'.tr(args: ['0']);
|
||||||
} else if (_seconds <= 60) {
|
} else if (seconds <= 60) {
|
||||||
_duration = 'seconds'.tr(args: [_seconds.toString()]);
|
duration = 'seconds'.tr(args: [seconds.toString()]);
|
||||||
} else if (_seconds <= 3600) {
|
} else if (seconds <= 3600) {
|
||||||
_duration = 'minutes'.tr(args: [_minutes.toString()]);
|
duration = 'minutes'.tr(args: [minutes.toString()]);
|
||||||
} else if (_seconds <= 86400) {
|
} else if (seconds <= 86400) {
|
||||||
final int _hours = _durationSeconds.inHours;
|
final int hours = durationSeconds.inHours;
|
||||||
final int _minutesLeft = _minutes - _hours * 60;
|
final int minutesLeft = minutes - hours * 60;
|
||||||
String _showMinutes = '';
|
String showMinutes = '';
|
||||||
if (_minutesLeft < 60) {}
|
if (minutesLeft < 60) {}
|
||||||
_showMinutes =
|
showMinutes =
|
||||||
'minutes'.tr(args: [_minutesLeft.toString()]);
|
'minutes'.tr(args: [minutesLeft.toString()]);
|
||||||
_duration =
|
duration =
|
||||||
'hours'.tr(args: [_hours.toString(), _showMinutes]);
|
'hours'.tr(args: [hours.toString(), showMinutes]);
|
||||||
} else if (_seconds <= 2592000) {
|
} else if (seconds <= 2592000) {
|
||||||
final int _days = _durationSeconds.inDays;
|
final int days = durationSeconds.inDays;
|
||||||
_duration = 'days'.tr(args: [_days.toString()]);
|
duration = 'days'.tr(args: [days.toString()]);
|
||||||
} else {
|
} else {
|
||||||
final int _months =
|
final int months =
|
||||||
(_durationSeconds.inDays / 30).round();
|
(durationSeconds.inDays / 30).round();
|
||||||
_duration = 'months'.tr(args: [_months.toString()]);
|
duration = 'months'.tr(args: [months.toString()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible: (snapshot.data != {}),
|
visible: (snapshot.data != {}),
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
if (snapshot.data!['canCert'] != null ||
|
if (snapshot.data!['canCert'] != null ||
|
||||||
_duration == 'seconds'.tr(args: ['0']))
|
duration == 'seconds'.tr(args: ['0']))
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: buttonSize,
|
height: buttonSize,
|
||||||
|
@ -183,18 +184,17 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
'assets/gecko_certify.png')),
|
'assets/gecko_certify.png')),
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final bool? _result =
|
final bool? result = await confirmPopup(
|
||||||
await confirmPopup(
|
context,
|
||||||
context,
|
"areYouSureYouWantToCertify".tr(
|
||||||
"areYouSureYouWantToCertify".tr(
|
args: [
|
||||||
args: [
|
getShortPubkey(pubkey!)
|
||||||
getShortPubkey(pubkey!)
|
]));
|
||||||
]));
|
|
||||||
|
|
||||||
if (_result ?? false) {
|
if (result ?? false) {
|
||||||
String? _pin;
|
String? pin;
|
||||||
if (_myWalletProvider.pinCode == '') {
|
if (myWalletProvider.pinCode == '') {
|
||||||
_pin = await Navigator.push(
|
pin = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (homeContext) {
|
builder: (homeContext) {
|
||||||
|
@ -204,19 +204,18 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (_pin != null ||
|
if (pin != null ||
|
||||||
_myWalletProvider.pinCode != '') {
|
myWalletProvider.pinCode != '') {
|
||||||
WalletsProfilesProvider
|
WalletsProfilesProvider
|
||||||
_walletViewProvider = Provider
|
walletViewProvider = Provider
|
||||||
.of<WalletsProfilesProvider>(
|
.of<WalletsProfilesProvider>(
|
||||||
context,
|
context,
|
||||||
listen: false);
|
listen: false);
|
||||||
final acc = _sub.getCurrentWallet();
|
final acc = sub.getCurrentWallet();
|
||||||
_sub.certify(
|
sub.certify(
|
||||||
acc.address!,
|
acc.address!,
|
||||||
_pin ??
|
pin ?? myWalletProvider.pinCode,
|
||||||
_myWalletProvider.pinCode,
|
walletViewProvider.address!);
|
||||||
_walletViewProvider.address!);
|
|
||||||
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
@ -263,7 +262,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"mustWaitXBeforeCertify"
|
"mustWaitXBeforeCertify"
|
||||||
.tr(args: [_duration.toString()]),
|
.tr(args: [duration.toString()]),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: buttonFontSize - 4,
|
fontSize: buttonFontSize - 4,
|
||||||
|
@ -272,7 +271,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
if (snapshot.data!['certRenewable'] != null &&
|
if (snapshot.data!['certRenewable'] != null &&
|
||||||
_duration != 'seconds'.tr(args: ['0']))
|
duration != 'seconds'.tr(args: ['0']))
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: buttonSize,
|
height: buttonSize,
|
||||||
|
@ -293,8 +292,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"canRenewCertInX"
|
"canRenewCertInX".tr(args: [duration.toString()]),
|
||||||
.tr(args: [_duration.toString()]),
|
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: buttonFontSize - 4,
|
fontSize: buttonFontSize - 4,
|
||||||
|
@ -338,9 +336,9 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return Opacity(
|
return Opacity(
|
||||||
opacity: _sub.nodeConnected ? 1 : 0.5,
|
opacity: sub.nodeConnected ? 1 : 0.5,
|
||||||
child: Container(
|
child: Container(
|
||||||
height: buttonSize,
|
height: buttonSize,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
@ -356,29 +354,29 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
color: orangeC, // button color
|
color: orangeC, // button color
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
key: const Key('pay'),
|
key: const Key('pay'),
|
||||||
splashColor: yellowC, // inkwell color
|
splashColor: yellowC,
|
||||||
|
onTap: sub.nodeConnected
|
||||||
|
? () {
|
||||||
|
paymentPopup(context, walletProfile);
|
||||||
|
}
|
||||||
|
: null, // inkwell color
|
||||||
child: const Padding(
|
child: const Padding(
|
||||||
padding: EdgeInsets.all(14),
|
padding: EdgeInsets.all(14),
|
||||||
child: Image(
|
child: Image(
|
||||||
image: AssetImage('assets/vector_white.png'),
|
image: AssetImage('assets/vector_white.png'),
|
||||||
)),
|
))),
|
||||||
onTap: _sub.nodeConnected
|
|
||||||
? () {
|
|
||||||
paymentPopup(context, _walletProfile);
|
|
||||||
}
|
|
||||||
: null),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
const SizedBox(height: 9),
|
const SizedBox(height: 9),
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return Text(
|
return Text(
|
||||||
'doATransfer'.tr(),
|
'doATransfer'.tr(),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: _sub.nodeConnected ? Colors.black : Colors.grey[500],
|
color: sub.nodeConnected ? Colors.black : Colors.grey[500],
|
||||||
fontSize: buttonFontSize,
|
fontSize: buttonFontSize,
|
||||||
fontWeight: FontWeight.w500),
|
fontWeight: FontWeight.w500),
|
||||||
);
|
);
|
||||||
|
@ -389,16 +387,16 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
void paymentPopup(
|
void paymentPopup(
|
||||||
BuildContext context, WalletsProfilesProvider _walletViewProvider) {
|
BuildContext context, WalletsProfilesProvider walletViewProvider) {
|
||||||
// WalletsProfilesProvider _walletViewProvider =
|
// WalletsProfilesProvider _walletViewProvider =
|
||||||
// Provider.of<WalletsProfilesProvider>(context, listen: false);
|
// Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
|
|
||||||
MyWalletsProvider _myWalletProvider =
|
MyWalletsProvider myWalletProvider =
|
||||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
const double shapeSize = 20;
|
const double shapeSize = 20;
|
||||||
WalletData? defaultWallet = _myWalletProvider.getDefaultWallet();
|
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
log.d(defaultWallet.address);
|
log.d(defaultWallet.address);
|
||||||
|
|
||||||
bool canValidate = false;
|
bool canValidate = false;
|
||||||
|
@ -415,12 +413,12 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return StatefulBuilder(
|
return StatefulBuilder(
|
||||||
builder: (BuildContext context, StateSetter setState) {
|
builder: (BuildContext context, StateSetter setState) {
|
||||||
if (_walletViewProvider.payAmount.text != '' &&
|
if (walletViewProvider.payAmount.text != '' &&
|
||||||
(double.parse(_walletViewProvider.payAmount.text) + 2) <=
|
(double.parse(walletViewProvider.payAmount.text) + 2) <=
|
||||||
(balanceCache[defaultWallet.address] ?? 0) &&
|
(balanceCache[defaultWallet.address] ?? 0) &&
|
||||||
_walletViewProvider.address != defaultWallet.address) {
|
walletViewProvider.address != defaultWallet.address) {
|
||||||
if ((balanceCache[pubkey] == 0 || balanceCache[pubkey] == null) &&
|
if ((balanceCache[pubkey] == 0 || balanceCache[pubkey] == null) &&
|
||||||
double.parse(_walletViewProvider.payAmount.text) < 5) {
|
double.parse(walletViewProvider.payAmount.text) < 5) {
|
||||||
canValidate = false;
|
canValidate = false;
|
||||||
} else {
|
} else {
|
||||||
canValidate = true;
|
canValidate = true;
|
||||||
|
@ -474,12 +472,12 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
color: Colors.grey[600]),
|
color: Colors.grey[600]),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Consumer<SubstrateSdk>(builder: (context, _sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
String? _pin;
|
String? pin;
|
||||||
if (_myWalletProvider.pinCode == '') {
|
if (myWalletProvider.pinCode == '') {
|
||||||
_pin = await Navigator.push(
|
pin = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (homeContext) {
|
builder: (homeContext) {
|
||||||
|
@ -489,13 +487,13 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (_pin != null ||
|
if (pin != null ||
|
||||||
_myWalletProvider.pinCode != '') {
|
myWalletProvider.pinCode != '') {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return ChooseWalletScreen(
|
return ChooseWalletScreen(
|
||||||
pin: _pin ?? _myWalletProvider.pinCode);
|
pin: pin ?? myWalletProvider.pinCode);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -515,12 +513,12 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future:
|
future:
|
||||||
_sub.getBalance(defaultWallet.address!),
|
sub.getBalance(defaultWallet.address!),
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
AsyncSnapshot<double> _balance) {
|
AsyncSnapshot<double> balance) {
|
||||||
if (_balance.connectionState !=
|
if (balance.connectionState !=
|
||||||
ConnectionState.done ||
|
ConnectionState.done ||
|
||||||
_balance.hasError) {
|
balance.hasError) {
|
||||||
if (balanceCache[
|
if (balanceCache[
|
||||||
defaultWallet.address!] !=
|
defaultWallet.address!] !=
|
||||||
null) {
|
null) {
|
||||||
|
@ -541,7 +539,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
balanceCache[defaultWallet.address!] =
|
balanceCache[defaultWallet.address!] =
|
||||||
_balance.data!;
|
balance.data!;
|
||||||
return Text(
|
return Text(
|
||||||
"${balanceCache[defaultWallet.address!]} $currencyName",
|
"${balanceCache[defaultWallet.address!]} $currencyName",
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
@ -565,7 +563,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
TextField(
|
TextField(
|
||||||
controller: _walletViewProvider.payAmount,
|
controller: walletViewProvider.payAmount,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
@ -617,9 +615,9 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
onPressed: canValidate
|
onPressed: canValidate
|
||||||
? () async {
|
? () async {
|
||||||
String? _pin;
|
String? pin;
|
||||||
if (_myWalletProvider.pinCode == '') {
|
if (myWalletProvider.pinCode == '') {
|
||||||
_pin = await Navigator.push(
|
pin = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (homeContext) {
|
builder: (homeContext) {
|
||||||
|
@ -629,30 +627,30 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
log.d(_pin);
|
log.d(pin);
|
||||||
if (_pin != null ||
|
if (pin != null ||
|
||||||
_myWalletProvider.pinCode != '') {
|
myWalletProvider.pinCode != '') {
|
||||||
// Payment workflow !
|
// Payment workflow !
|
||||||
WalletsProfilesProvider
|
WalletsProfilesProvider
|
||||||
_walletViewProvider =
|
walletViewProvider =
|
||||||
Provider.of<WalletsProfilesProvider>(
|
Provider.of<WalletsProfilesProvider>(
|
||||||
context,
|
context,
|
||||||
listen: false);
|
listen: false);
|
||||||
SubstrateSdk _sub =
|
SubstrateSdk sub =
|
||||||
Provider.of<SubstrateSdk>(context,
|
Provider.of<SubstrateSdk>(context,
|
||||||
listen: false);
|
listen: false);
|
||||||
final acc = _sub.getCurrentWallet();
|
final acc = sub.getCurrentWallet();
|
||||||
log.d(
|
log.d(
|
||||||
"fromAddress: ${acc.address!},destAddress: ${_walletViewProvider.address!}, amount: ${double.parse(_walletViewProvider.payAmount.text)}, password: $_pin");
|
"fromAddress: ${acc.address!},destAddress: ${walletViewProvider.address!}, amount: ${double.parse(walletViewProvider.payAmount.text)}, password: $pin");
|
||||||
_sub.pay(
|
sub.pay(
|
||||||
fromAddress: acc.address!,
|
fromAddress: acc.address!,
|
||||||
destAddress:
|
destAddress:
|
||||||
_walletViewProvider.address!,
|
walletViewProvider.address!,
|
||||||
amount: double.parse(
|
amount: double.parse(
|
||||||
_walletViewProvider
|
walletViewProvider
|
||||||
.payAmount.text),
|
.payAmount.text),
|
||||||
password: _pin ??
|
password:
|
||||||
_myWalletProvider.pinCode);
|
pin ?? myWalletProvider.pinCode);
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
|
@ -675,6 +673,6 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}).then((value) => _walletViewProvider.payAmount.text = '');
|
}).then((value) => walletViewProvider.payAmount.text = '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
146
pubspec.lock
146
pubspec.lock
|
@ -7,14 +7,14 @@ packages:
|
||||||
name: _fe_analyzer_shared
|
name: _fe_analyzer_shared
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "40.0.0"
|
version: "44.0.0"
|
||||||
analyzer:
|
analyzer:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: analyzer
|
name: analyzer
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.0"
|
version: "4.4.0"
|
||||||
archive:
|
archive:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -35,7 +35,7 @@ packages:
|
||||||
name: assorted_layout_widgets
|
name: assorted_layout_widgets
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.8.5"
|
version: "6.1.1"
|
||||||
async:
|
async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -70,7 +70,7 @@ packages:
|
||||||
name: bip32_ed25519
|
name: bip32_ed25519
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.1"
|
version: "0.2.2"
|
||||||
bip39_multi_nullsafety:
|
bip39_multi_nullsafety:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -105,7 +105,7 @@ packages:
|
||||||
name: build_config
|
name: build_config
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.0"
|
version: "1.1.0"
|
||||||
build_daemon:
|
build_daemon:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -126,7 +126,7 @@ packages:
|
||||||
name: build_runner
|
name: build_runner
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.11"
|
version: "2.2.0"
|
||||||
build_runner_core:
|
build_runner_core:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -147,7 +147,7 @@ packages:
|
||||||
name: built_value
|
name: built_value
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.3.2"
|
version: "8.4.0"
|
||||||
carousel_slider:
|
carousel_slider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -189,7 +189,7 @@ packages:
|
||||||
name: code_builder
|
name: code_builder
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.0"
|
version: "4.2.0"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -210,7 +210,7 @@ packages:
|
||||||
name: connectivity_plus
|
name: connectivity_plus
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.3"
|
version: "2.3.6"
|
||||||
connectivity_plus_linux:
|
connectivity_plus_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -224,7 +224,7 @@ packages:
|
||||||
name: connectivity_plus_macos
|
name: connectivity_plus_macos
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.3"
|
version: "1.2.4"
|
||||||
connectivity_plus_platform_interface:
|
connectivity_plus_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -238,7 +238,7 @@ packages:
|
||||||
name: connectivity_plus_web
|
name: connectivity_plus_web
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.1"
|
version: "1.2.3"
|
||||||
connectivity_plus_windows:
|
connectivity_plus_windows:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -287,7 +287,7 @@ packages:
|
||||||
name: dbus
|
name: dbus
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.3"
|
version: "0.7.4"
|
||||||
desktop_window:
|
desktop_window:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -315,7 +315,7 @@ packages:
|
||||||
name: dropdown_button2
|
name: dropdown_button2
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.6.3"
|
version: "1.7.1"
|
||||||
durt:
|
durt:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -395,7 +395,7 @@ packages:
|
||||||
name: flutter_hooks
|
name: flutter_hooks
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.18.4"
|
version: "0.18.5+1"
|
||||||
flutter_inappwebview:
|
flutter_inappwebview:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -409,7 +409,7 @@ packages:
|
||||||
name: flutter_lints
|
name: flutter_lints
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "2.0.1"
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -421,28 +421,28 @@ packages:
|
||||||
name: flutter_logs
|
name: flutter_logs
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.6"
|
version: "2.1.7"
|
||||||
flutter_markdown:
|
flutter_markdown:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: flutter_markdown
|
name: flutter_markdown
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.10+2"
|
version: "0.6.10+3"
|
||||||
flutter_plugin_android_lifecycle:
|
flutter_plugin_android_lifecycle:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: flutter_plugin_android_lifecycle
|
name: flutter_plugin_android_lifecycle
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.6"
|
version: "2.0.7"
|
||||||
flutter_svg:
|
flutter_svg:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: flutter_svg
|
name: flutter_svg
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.22.0"
|
version: "1.1.3"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -485,7 +485,7 @@ packages:
|
||||||
name: glob
|
name: glob
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.1.0"
|
||||||
gql:
|
gql:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -541,14 +541,14 @@ packages:
|
||||||
name: graphql
|
name: graphql
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.1.2-beta.2"
|
version: "5.1.2-beta.4"
|
||||||
graphql_flutter:
|
graphql_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: graphql_flutter
|
name: graphql_flutter
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.1.1-beta.3"
|
version: "5.1.1-beta.4"
|
||||||
graphs:
|
graphs:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -569,7 +569,7 @@ packages:
|
||||||
name: hive
|
name: hive
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "2.2.3"
|
||||||
hive_flutter:
|
hive_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -590,14 +590,14 @@ packages:
|
||||||
name: http
|
name: http
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.13.4"
|
version: "0.13.5"
|
||||||
http_multi_server:
|
http_multi_server:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: http_multi_server
|
name: http_multi_server
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.2.0"
|
version: "3.2.1"
|
||||||
http_parser:
|
http_parser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -618,14 +618,14 @@ packages:
|
||||||
name: icons_launcher
|
name: icons_launcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.9"
|
version: "2.0.2"
|
||||||
image:
|
image:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image
|
name: image
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.3"
|
version: "3.2.0"
|
||||||
image_cropper:
|
image_cropper:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -660,7 +660,7 @@ packages:
|
||||||
name: image_picker_android
|
name: image_picker_android
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.4+13"
|
version: "0.8.5+2"
|
||||||
image_picker_for_web:
|
image_picker_for_web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -674,14 +674,14 @@ packages:
|
||||||
name: image_picker_ios
|
name: image_picker_ios
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.5+5"
|
version: "0.8.5+6"
|
||||||
image_picker_platform_interface:
|
image_picker_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image_picker_platform_interface
|
name: image_picker_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.5.0"
|
version: "2.6.1"
|
||||||
infinite_scroll_pagination:
|
infinite_scroll_pagination:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -749,14 +749,14 @@ packages:
|
||||||
name: json_annotation
|
name: json_annotation
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.5.0"
|
version: "4.6.0"
|
||||||
lints:
|
lints:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: lints
|
name: lints
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.1"
|
version: "2.0.0"
|
||||||
logger:
|
logger:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -819,7 +819,7 @@ packages:
|
||||||
name: mobx
|
name: mobx
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.7+2"
|
version: "2.0.7+5"
|
||||||
nested:
|
nested:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -854,7 +854,7 @@ packages:
|
||||||
name: package_config
|
name: package_config
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.2"
|
version: "2.1.0"
|
||||||
package_info_plus:
|
package_info_plus:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -910,35 +910,35 @@ packages:
|
||||||
name: path_drawing
|
name: path_drawing
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.1+1"
|
version: "1.0.1"
|
||||||
path_parsing:
|
path_parsing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_parsing
|
name: path_parsing
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.1"
|
version: "1.0.1"
|
||||||
path_provider:
|
path_provider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: path_provider
|
name: path_provider
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.10"
|
version: "2.0.11"
|
||||||
path_provider_android:
|
path_provider_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_android
|
name: path_provider_android
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.14"
|
version: "2.0.17"
|
||||||
path_provider_ios:
|
path_provider_ios:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_ios
|
name: path_provider_ios
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.9"
|
version: "2.0.11"
|
||||||
path_provider_linux:
|
path_provider_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -980,14 +980,28 @@ packages:
|
||||||
name: pdf
|
name: pdf
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.8.1"
|
version: "3.8.2"
|
||||||
permission_handler:
|
permission_handler:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: permission_handler
|
name: permission_handler
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.3.0"
|
version: "10.0.0"
|
||||||
|
permission_handler_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_android
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "10.0.0"
|
||||||
|
permission_handler_apple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_apple
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "9.0.4"
|
||||||
permission_handler_platform_interface:
|
permission_handler_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -995,6 +1009,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.7.0"
|
version: "3.7.0"
|
||||||
|
permission_handler_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_windows
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.0"
|
||||||
petitparser:
|
petitparser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1036,7 +1057,7 @@ packages:
|
||||||
name: pointycastle
|
name: pointycastle
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.6.0"
|
version: "3.6.1"
|
||||||
polkawallet_sdk:
|
polkawallet_sdk:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -1052,14 +1073,14 @@ packages:
|
||||||
name: pool
|
name: pool
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.5.0"
|
version: "1.5.1"
|
||||||
printing:
|
printing:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: printing
|
name: printing
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.9.1"
|
version: "5.9.2"
|
||||||
process:
|
process:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1073,7 +1094,7 @@ packages:
|
||||||
name: protobuf
|
name: protobuf
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "2.1.0"
|
||||||
provider:
|
provider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -1138,21 +1159,21 @@ packages:
|
||||||
name: rxdart
|
name: rxdart
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.27.4"
|
version: "0.27.5"
|
||||||
sentry:
|
sentry:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: sentry
|
name: sentry
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.5.1"
|
version: "6.9.0"
|
||||||
sentry_flutter:
|
sentry_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: sentry_flutter
|
name: sentry_flutter
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.5.1"
|
version: "6.9.0"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -1215,28 +1236,28 @@ packages:
|
||||||
name: shelf
|
name: shelf
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.3.2"
|
||||||
shelf_packages_handler:
|
shelf_packages_handler:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf_packages_handler
|
name: shelf_packages_handler
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.0"
|
version: "3.0.1"
|
||||||
shelf_static:
|
shelf_static:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf_static
|
name: shelf_static
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.1.1"
|
||||||
shelf_web_socket:
|
shelf_web_socket:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf_web_socket
|
name: shelf_web_socket
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.1"
|
version: "1.0.2"
|
||||||
sky_engine:
|
sky_engine:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -1248,7 +1269,7 @@ packages:
|
||||||
name: sliver_tools
|
name: sliver_tools
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.6"
|
version: "0.2.7"
|
||||||
source_gen:
|
source_gen:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1444,21 +1465,21 @@ packages:
|
||||||
name: webview_flutter_android
|
name: webview_flutter_android
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.8.9"
|
version: "2.9.3"
|
||||||
webview_flutter_platform_interface:
|
webview_flutter_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: webview_flutter_platform_interface
|
name: webview_flutter_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.0"
|
version: "1.9.1"
|
||||||
webview_flutter_wkwebview:
|
webview_flutter_wkwebview:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: webview_flutter_wkwebview
|
name: webview_flutter_wkwebview
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.8.0"
|
version: "2.9.3"
|
||||||
win32:
|
win32:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1466,15 +1487,6 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.6.1"
|
version: "2.6.1"
|
||||||
window_size:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
path: "plugins/window_size"
|
|
||||||
ref: HEAD
|
|
||||||
resolved-ref: "5c51870ced62a00e809ba4b81a846a052d241c9f"
|
|
||||||
url: "https://github.com/google/flutter-desktop-embedding.git"
|
|
||||||
source: git
|
|
||||||
version: "0.1.0"
|
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1488,7 +1500,7 @@ packages:
|
||||||
name: xml
|
name: xml
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.4.1"
|
version: "6.1.0"
|
||||||
yaml:
|
yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1497,5 +1509,5 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.1"
|
version: "3.1.1"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.17.0 <3.0.0"
|
dart: ">=2.17.1 <3.0.0"
|
||||||
flutter: ">=3.0.0"
|
flutter: ">=3.0.0"
|
||||||
|
|
20
pubspec.yaml
20
pubspec.yaml
|
@ -5,7 +5,7 @@ description: Pay with G1.
|
||||||
# pub.dev using `pub publish`. This is preferred for private packages.
|
# pub.dev using `pub publish`. This is preferred for private packages.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 0.0.9+15
|
version: 0.0.9+16
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
@ -15,19 +15,15 @@ dependencies:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_driver:
|
flutter_driver:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
window_size:
|
assorted_layout_widgets: ^6.1.1
|
||||||
git:
|
|
||||||
url: https://github.com/google/flutter-desktop-embedding.git
|
|
||||||
path: plugins/window_size
|
|
||||||
assorted_layout_widgets: ^5.2.1
|
|
||||||
bubble: ^1.2.1
|
bubble: ^1.2.1
|
||||||
carousel_slider: ^4.0.0
|
carousel_slider: ^4.0.0
|
||||||
confirm_dialog: ^1.0.0
|
confirm_dialog: ^1.0.0
|
||||||
crypto: ^3.0.1
|
crypto: ^3.0.1
|
||||||
fast_base58: ^0.2.0
|
fast_base58: ^0.2.0
|
||||||
flutter_lints: ^1.0.4
|
flutter_lints: ^2.0.1
|
||||||
flutter_logs: ^2.1.4
|
flutter_logs: ^2.1.4
|
||||||
flutter_svg: ^0.22.0
|
flutter_svg: ^1.1.3
|
||||||
graphql_flutter: ^5.1.1-beta.3
|
graphql_flutter: ^5.1.1-beta.3
|
||||||
hive: ^2.0.4
|
hive: ^2.0.4
|
||||||
hive_flutter: ^1.1.0
|
hive_flutter: ^1.1.0
|
||||||
|
@ -40,7 +36,7 @@ dependencies:
|
||||||
logger: ^1.1.0
|
logger: ^1.1.0
|
||||||
path_provider: ^2.0.9
|
path_provider: ^2.0.9
|
||||||
pdf: ^3.7.1
|
pdf: ^3.7.1
|
||||||
permission_handler: ^8.3.0
|
permission_handler: ^10.0.0
|
||||||
pin_code_fields: ^7.3.0
|
pin_code_fields: ^7.3.0
|
||||||
printing: ^5.9.1
|
printing: ^5.9.1
|
||||||
provider: ^6.0.1
|
provider: ^6.0.1
|
||||||
|
@ -58,7 +54,7 @@ dependencies:
|
||||||
test: ^1.17.10
|
test: ^1.17.10
|
||||||
truncate: ^3.0.1
|
truncate: ^3.0.1
|
||||||
unorm_dart: ^0.2.0
|
unorm_dart: ^0.2.0
|
||||||
xml: ^5.3.0
|
xml: ^6.1.0
|
||||||
pull_to_refresh: ^2.0.0
|
pull_to_refresh: ^2.0.0
|
||||||
dio: ^4.0.4
|
dio: ^4.0.4
|
||||||
desktop_window: ^0.4.0
|
desktop_window: ^0.4.0
|
||||||
|
@ -66,7 +62,7 @@ dependencies:
|
||||||
package_info_plus: ^1.4.2
|
package_info_plus: ^1.4.2
|
||||||
polkawallet_sdk: #^0.4.8
|
polkawallet_sdk: #^0.4.8
|
||||||
git:
|
git:
|
||||||
url: https://github.com/poka-IT/sdk.git #https://github.com/poka-IT/sdk.git
|
url: https://github.com/poka-IT/sdk.git
|
||||||
ref: gecko-old
|
ref: gecko-old
|
||||||
dots_indicator: ^2.1.0
|
dots_indicator: ^2.1.0
|
||||||
web_socket_channel: ^2.2.0
|
web_socket_channel: ^2.2.0
|
||||||
|
@ -79,7 +75,7 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
# flutter_launcher_icons: ^0.9.2
|
# flutter_launcher_icons: ^0.9.2
|
||||||
# flutter_launcher_icons_maker: ^^0.10.2
|
# flutter_launcher_icons_maker: ^^0.10.2
|
||||||
icons_launcher: ^1.1.8
|
icons_launcher: ^2.0.2
|
||||||
build_runner: ^2.1.2
|
build_runner: ^2.1.2
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
// ignore_for_file: avoid_print
|
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter_driver/flutter_driver.dart';
|
import 'package:flutter_driver/flutter_driver.dart';
|
||||||
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
// import 'package:flutter/services.dart';
|
// import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
@ -56,8 +55,8 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Easy sleep
|
// Easy sleep
|
||||||
Future sleep(int _time) async {
|
Future sleep(int time) async {
|
||||||
await Future.delayed(Duration(milliseconds: _time));
|
await Future.delayed(Duration(milliseconds: time));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test if widget exist on screen, return a boolean
|
// Test if widget exist on screen, return a boolean
|
||||||
|
@ -78,10 +77,10 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete a derivation
|
// Delete a derivation
|
||||||
Future deleteWallet(bool _confirm) async {
|
Future deleteWallet(bool confirm) async {
|
||||||
await tapOn('deleteWallet');
|
await tapOn('deleteWallet');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
_confirm ? await tapOn('confirmDeleting') : await tapOn('cancelDeleting');
|
confirm ? await tapOn('confirmDeleting') : await tapOn('cancelDeleting');
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +104,7 @@ void main() {
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
await tapOn('generateKeychain');
|
await tapOn('generateKeychain');
|
||||||
while (await getText('generatedPin') == '') {
|
while (await getText('generatedPin') == '') {
|
||||||
print('Waiting for pin code generation...');
|
log.d('Waiting for pin code generation...');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
}
|
}
|
||||||
pinCode = await getText('generatedPin');
|
pinCode = await getText('generatedPin');
|
||||||
|
@ -169,7 +168,7 @@ void main() {
|
||||||
await tapOn('goStep7');
|
await tapOn('goStep7');
|
||||||
|
|
||||||
while (await getText('word1') == '...') {
|
while (await getText('word1') == '...') {
|
||||||
print('Waiting for Mnemonic generation...');
|
log.d('Waiting for Mnemonic generation...');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +223,7 @@ void main() {
|
||||||
await tapOn('goStep11');
|
await tapOn('goStep11');
|
||||||
|
|
||||||
while (await getText('generatedPin') == '') {
|
while (await getText('generatedPin') == '') {
|
||||||
print('Waiting for pin code generation...');
|
log.d('Waiting for pin code generation...');
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue