Disconnect completly GVA and Cs+
This commit is contained in:
parent
7bef4a9cd3
commit
1a6dfdd617
|
@ -15,7 +15,6 @@ Directory? appPath;
|
||||||
|
|
||||||
late String appVersion;
|
late String appVersion;
|
||||||
late SharedPreferences prefs;
|
late SharedPreferences prefs;
|
||||||
late String endPointGVA;
|
|
||||||
const int pinLength = 5;
|
const int pinLength = 5;
|
||||||
const String appLang = 'english';
|
const String appLang = 'english';
|
||||||
|
|
||||||
|
|
106
lib/main.dart
106
lib/main.dart
|
@ -36,7 +36,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
import 'package:gecko/screens/myWallets/wallets_home.dart';
|
||||||
import 'package:gecko/screens/search.dart';
|
import 'package:gecko/screens/search.dart';
|
||||||
import 'package:gecko/screens/search_result.dart';
|
import 'package:gecko/screens/search_result.dart';
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
|
||||||
import 'package:hive_flutter/hive_flutter.dart';
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
@ -73,26 +72,9 @@ Future<void> main() async {
|
||||||
await Hive.deleteBoxFromDisk('g1WalletsBox');
|
await Hive.deleteBoxFromDisk('g1WalletsBox');
|
||||||
g1WalletsBox = await Hive.openBox<G1WalletsList>("g1WalletsBox");
|
g1WalletsBox = await Hive.openBox<G1WalletsList>("g1WalletsBox");
|
||||||
|
|
||||||
|
|
||||||
// keystoreBox = await Hive.openBox("keystoreBox");
|
|
||||||
|
|
||||||
// g1WalletsBox.clear();
|
|
||||||
|
|
||||||
// final HiveStore _store =
|
|
||||||
// await HiveStore.open(path: '${appPath.path}/gqlCache');
|
|
||||||
|
|
||||||
// Get a valid GVA endpoint
|
|
||||||
endPointGVA = 'https://g1.librelois.fr/gva';
|
|
||||||
// endPointGVA = 'https://duniter-g1.p2p.legal/gva';
|
|
||||||
await _homeProvider.getValidEndpoints();
|
await _homeProvider.getValidEndpoints();
|
||||||
// log.d(await configBox.get('endpoint'));
|
// log.d(await configBox.get('endpoint'));
|
||||||
|
|
||||||
// if (endPointGVA == 'HS') {
|
|
||||||
// _homeProvider.playSound('faché', 0.8);
|
|
||||||
// } else {
|
|
||||||
// _homeProvider.playSound('start', 0.2);
|
|
||||||
// }
|
|
||||||
|
|
||||||
HttpOverrides.global = MyHttpOverrides();
|
HttpOverrides.global = MyHttpOverrides();
|
||||||
|
|
||||||
if (kReleaseMode && enableSentry) {
|
if (kReleaseMode && enableSentry) {
|
||||||
|
@ -109,7 +91,7 @@ Future<void> main() async {
|
||||||
await SentryFlutter.init((options) {
|
await SentryFlutter.init((options) {
|
||||||
options.dsn =
|
options.dsn =
|
||||||
'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
|
'https://c09587b46eaa42e8b9fda28d838ed180@o496840.ingest.sentry.io/5572110';
|
||||||
}, appRunner: () => runApp(Gecko(endPointGVA)));
|
}, appRunner: () => runApp(const Gecko()));
|
||||||
|
|
||||||
// runZoned<Future<void>>(
|
// runZoned<Future<void>>(
|
||||||
// () async {
|
// () async {
|
||||||
|
@ -126,30 +108,17 @@ Future<void> main() async {
|
||||||
} else {
|
} else {
|
||||||
print('Debug mode enabled: No sentry alerte');
|
print('Debug mode enabled: No sentry alerte');
|
||||||
|
|
||||||
runApp(Gecko(endPointGVA));
|
runApp(const Gecko());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Gecko extends StatelessWidget {
|
class Gecko extends StatelessWidget {
|
||||||
const Gecko(this.randomEndpoint, {Key? key}) : super(key: key);
|
const Gecko({Key? key}) : super(key: key);
|
||||||
final String? randomEndpoint;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
final _httpLink = HttpLink(
|
|
||||||
randomEndpoint!,
|
|
||||||
);
|
|
||||||
|
|
||||||
final _client = ValueNotifier(
|
|
||||||
GraphQLClient(
|
|
||||||
cache: GraphQLCache(),
|
|
||||||
link: _httpLink,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
// HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
|
||||||
// HistoryProvider('').snackNode(context);
|
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
providers: [
|
providers: [
|
||||||
// Provider(create: (context) => HistoryProvider()),
|
// Provider(create: (context) => HistoryProvider()),
|
||||||
|
@ -163,44 +132,41 @@ class Gecko extends StatelessWidget {
|
||||||
ChangeNotifierProvider(create: (_) => CesiumPlusProvider()),
|
ChangeNotifierProvider(create: (_) => CesiumPlusProvider()),
|
||||||
ChangeNotifierProvider(create: (_) => SubstrateSdk())
|
ChangeNotifierProvider(create: (_) => SubstrateSdk())
|
||||||
],
|
],
|
||||||
child: GraphQLProvider(
|
child: MaterialApp(
|
||||||
client: _client,
|
builder: (context, widget) => ResponsiveWrapper.builder(
|
||||||
child: MaterialApp(
|
BouncingScrollWrapper.builder(context, widget!),
|
||||||
builder: (context, widget) => ResponsiveWrapper.builder(
|
maxWidth: 1200,
|
||||||
BouncingScrollWrapper.builder(context, widget!),
|
minWidth: 480,
|
||||||
maxWidth: 1200,
|
defaultScale: true,
|
||||||
minWidth: 480,
|
breakpoints: [
|
||||||
defaultScale: true,
|
const ResponsiveBreakpoint.resize(480, name: MOBILE),
|
||||||
breakpoints: [
|
const ResponsiveBreakpoint.autoScale(800, name: TABLET),
|
||||||
const ResponsiveBreakpoint.resize(480, name: MOBILE),
|
const ResponsiveBreakpoint.resize(1000, name: DESKTOP),
|
||||||
const ResponsiveBreakpoint.autoScale(800, name: TABLET),
|
],
|
||||||
const ResponsiveBreakpoint.resize(1000, name: DESKTOP),
|
background: Container(color: backgroundColor)),
|
||||||
],
|
title: 'Ğecko',
|
||||||
background: Container(color: backgroundColor)),
|
theme: ThemeData(
|
||||||
title: 'Ğecko',
|
appBarTheme: const AppBarTheme(
|
||||||
theme: ThemeData(
|
color: Color(0xffFFD58D),
|
||||||
appBarTheme: const AppBarTheme(
|
foregroundColor: Color(0xFF000000),
|
||||||
color: Color(0xffFFD58D),
|
|
||||||
foregroundColor: Color(0xFF000000),
|
|
||||||
),
|
|
||||||
primaryColor: const Color(0xffFFD58D),
|
|
||||||
textTheme: const TextTheme(
|
|
||||||
bodyText1: TextStyle(fontSize: 16),
|
|
||||||
bodyText2: TextStyle(fontSize: 18),
|
|
||||||
).apply(
|
|
||||||
bodyColor: const Color(0xFF000000),
|
|
||||||
),
|
|
||||||
colorScheme:
|
|
||||||
ColorScheme.fromSwatch().copyWith(secondary: Colors.grey[850]),
|
|
||||||
),
|
),
|
||||||
home: const HomeScreen(),
|
primaryColor: const Color(0xffFFD58D),
|
||||||
initialRoute: "/",
|
textTheme: const TextTheme(
|
||||||
routes: {
|
bodyText1: TextStyle(fontSize: 16),
|
||||||
'/mywallets': (context) => const WalletsHome(),
|
bodyText2: TextStyle(fontSize: 18),
|
||||||
'/search': (context) => const SearchScreen(),
|
).apply(
|
||||||
'/searchResult': (context) => const SearchResultScreen(),
|
bodyColor: const Color(0xFF000000),
|
||||||
},
|
),
|
||||||
|
colorScheme:
|
||||||
|
ColorScheme.fromSwatch().copyWith(secondary: Colors.grey[850]),
|
||||||
),
|
),
|
||||||
|
home: const HomeScreen(),
|
||||||
|
initialRoute: "/",
|
||||||
|
routes: {
|
||||||
|
'/mywallets': (context) => const WalletsHome(),
|
||||||
|
'/search': (context) => const SearchScreen(),
|
||||||
|
'/searchResult': (context) => const SearchResultScreen(),
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
const String getHistory = r'''
|
|
||||||
query ($pubkey: String!, $number: Int!, $cursor: String) {
|
|
||||||
txsHistoryBc(
|
|
||||||
script: $pubkey
|
|
||||||
pagination: { pageSize: $number, ord: DESC, cursor: $cursor }
|
|
||||||
) {
|
|
||||||
both {
|
|
||||||
pageInfo {
|
|
||||||
hasPreviousPage
|
|
||||||
hasNextPage
|
|
||||||
startCursor
|
|
||||||
endCursor
|
|
||||||
}
|
|
||||||
edges {
|
|
||||||
direction
|
|
||||||
node {
|
|
||||||
currency
|
|
||||||
issuers
|
|
||||||
outputs
|
|
||||||
comment
|
|
||||||
writtenTime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
txsHistoryMp(pubkey: $pubkey) {
|
|
||||||
receiving {
|
|
||||||
currency
|
|
||||||
issuers
|
|
||||||
comment
|
|
||||||
outputs
|
|
||||||
}
|
|
||||||
sending {
|
|
||||||
currency
|
|
||||||
issuers
|
|
||||||
comment
|
|
||||||
outputs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
currentUd {
|
|
||||||
amount
|
|
||||||
base
|
|
||||||
}
|
|
||||||
balance(script: $pubkey) {
|
|
||||||
amount
|
|
||||||
base
|
|
||||||
}
|
|
||||||
}
|
|
||||||
''';
|
|
||||||
|
|
||||||
const String getBalance = r'''
|
|
||||||
query ($pubkey: String!) {
|
|
||||||
balance(script: $pubkey) {
|
|
||||||
amount
|
|
||||||
base
|
|
||||||
}
|
|
||||||
currentUd {
|
|
||||||
amount
|
|
||||||
base
|
|
||||||
}
|
|
||||||
}
|
|
||||||
''';
|
|
||||||
|
|
||||||
const String getWallets = r'''
|
|
||||||
query ($number: Int!, $cursor: String) {
|
|
||||||
wallets(pagination: {ord: ASC, pageSize: $number, cursor: $cursor}) {
|
|
||||||
pageInfo {
|
|
||||||
hasNextPage
|
|
||||||
endCursor
|
|
||||||
}
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
script
|
|
||||||
balance {
|
|
||||||
amount
|
|
||||||
base
|
|
||||||
}
|
|
||||||
idty {
|
|
||||||
isMember
|
|
||||||
username
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
''';
|
|
||||||
|
|
||||||
const String getId = r'''
|
|
||||||
query ($pubkey: PubKeyGva!) {
|
|
||||||
idty(pubkey: $pubkey) {
|
|
||||||
isMember
|
|
||||||
username
|
|
||||||
}
|
|
||||||
}
|
|
||||||
''';
|
|
|
@ -14,66 +14,78 @@ class SearchProvider with ChangeNotifier {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List> searchBlockchain() async {
|
// Future<List> searchBlockchain() async {
|
||||||
searchResult.clear();
|
// searchResult.clear();
|
||||||
int searchTime = DateTime.now().millisecondsSinceEpoch;
|
// int searchTime = DateTime.now().millisecondsSinceEpoch;
|
||||||
WalletsProfilesProvider _walletProfiles = WalletsProfilesProvider('pubkey');
|
// WalletsProfilesProvider _walletProfiles = WalletsProfilesProvider('pubkey');
|
||||||
|
|
||||||
if (cacheTime + cacheDuring <= searchTime) {
|
// if (cacheTime + cacheDuring <= searchTime) {
|
||||||
g1WalletsBox.clear();
|
// g1WalletsBox.clear();
|
||||||
// final url = Uri.parse('https://g1-stats.axiom-team.fr/data/forbes.json');
|
// // final url = Uri.parse('https://g1-stats.axiom-team.fr/data/forbes.json');
|
||||||
// final response = await http.get(url);
|
// // final response = await http.get(url);
|
||||||
|
|
||||||
var dio = Dio();
|
// var dio = Dio();
|
||||||
late Response response;
|
// late Response response;
|
||||||
try {
|
// try {
|
||||||
response = await dio.get(
|
// response = await dio.get(
|
||||||
'https://g1-stats.axiom-team.fr/data/forbes.json',
|
// 'https://g1-stats.axiom-team.fr/data/forbes.json',
|
||||||
options: Options(
|
// options: Options(
|
||||||
sendTimeout: 5000,
|
// sendTimeout: 5000,
|
||||||
receiveTimeout: 10000,
|
// receiveTimeout: 10000,
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
// response = await http.post((Uri.parse(queryOptions[0])),
|
// // response = await http.post((Uri.parse(queryOptions[0])),
|
||||||
// body: queryOptions[1], headers: queryOptions[2]);
|
// // body: queryOptions[1], headers: queryOptions[2]);
|
||||||
} catch (e) {
|
// } catch (e) {
|
||||||
log.e(e);
|
// log.e(e);
|
||||||
}
|
// }
|
||||||
|
|
||||||
List<G1WalletsList> _listWallets = _parseG1Wallets(response.data)!;
|
// List<G1WalletsList> _listWallets = _parseG1Wallets(response.data)!;
|
||||||
Map<String?, G1WalletsList> _mapWallets = {
|
// Map<String?, G1WalletsList> _mapWallets = {
|
||||||
for (var e in _listWallets) e.pubkey: e
|
// for (var e in _listWallets) e.pubkey: e
|
||||||
};
|
// };
|
||||||
|
|
||||||
await g1WalletsBox.putAll(_mapWallets);
|
// await g1WalletsBox.putAll(_mapWallets);
|
||||||
cacheTime = DateTime.now().millisecondsSinceEpoch;
|
// cacheTime = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// g1WalletsBox.toMap().forEach((key, value) {
|
||||||
|
// if ((value.id != null &&
|
||||||
|
// value.id!.username != null &&
|
||||||
|
// value.id!.username!
|
||||||
|
// .toLowerCase()
|
||||||
|
// .contains(searchController.text)) ||
|
||||||
|
// value.pubkey!.contains(searchController.text)) {
|
||||||
|
// searchResult.add(value);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// if (searchResult.isEmpty &&
|
||||||
|
// _walletProfiles.isPubkey(searchController.text)) {
|
||||||
|
// searchResult = [G1WalletsList(pubkey: searchController.text)];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return searchResult;
|
||||||
|
// }
|
||||||
|
|
||||||
|
Future<List<G1WalletsList>> searchAddress() async {
|
||||||
|
final WalletsProfilesProvider _walletProfiles =
|
||||||
|
WalletsProfilesProvider('pubkey');
|
||||||
|
|
||||||
|
if (_walletProfiles.isAddress(searchController.text)) {
|
||||||
|
G1WalletsList _wallet = G1WalletsList(pubkey: searchController.text);
|
||||||
|
return [_wallet];
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
g1WalletsBox.toMap().forEach((key, value) {
|
|
||||||
if ((value.id != null &&
|
|
||||||
value.id!.username != null &&
|
|
||||||
value.id!.username!
|
|
||||||
.toLowerCase()
|
|
||||||
.contains(searchController.text)) ||
|
|
||||||
value.pubkey!.contains(searchController.text)) {
|
|
||||||
searchResult.add(value);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (searchResult.isEmpty &&
|
|
||||||
_walletProfiles.isPubkey(searchController.text)) {
|
|
||||||
searchResult = [G1WalletsList(pubkey: searchController.text)];
|
|
||||||
}
|
|
||||||
|
|
||||||
return searchResult;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<G1WalletsList>? _parseG1Wallets(var responseBody) {
|
// List<G1WalletsList>? _parseG1Wallets(var responseBody) {
|
||||||
final parsed = responseBody.cast<Map<String, dynamic>>();
|
// final parsed = responseBody.cast<Map<String, dynamic>>();
|
||||||
|
|
||||||
return parsed
|
// return parsed
|
||||||
.map<G1WalletsList>((json) => G1WalletsList.fromJson(json))
|
// .map<G1WalletsList>((json) => G1WalletsList.fromJson(json))
|
||||||
.toList();
|
// .toList();
|
||||||
}
|
// }
|
||||||
|
|
|
@ -11,9 +11,9 @@ import 'dart:math';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class WalletsProfilesProvider with ChangeNotifier {
|
class WalletsProfilesProvider with ChangeNotifier {
|
||||||
WalletsProfilesProvider(this.pubkey);
|
WalletsProfilesProvider(this.address);
|
||||||
|
|
||||||
String? pubkey = '';
|
String? address = '';
|
||||||
String pubkeyShort = '';
|
String pubkeyShort = '';
|
||||||
List? transBC;
|
List? transBC;
|
||||||
String? fetchMoreCursor;
|
String? fetchMoreCursor;
|
||||||
|
@ -38,7 +38,7 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
log.e(e);
|
log.e(e);
|
||||||
return 'false';
|
return 'false';
|
||||||
}
|
}
|
||||||
if (barcode != null && isPubkey(barcode)) {
|
if (barcode != null && isAddress(barcode)) {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
|
@ -70,19 +70,19 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
// return result;
|
// return result;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
bool isPubkey(pubkey) {
|
bool isAddress(address) {
|
||||||
final RegExp regExp = RegExp(
|
final RegExp regExp = RegExp(
|
||||||
r'^[a-zA-Z0-9]+$',
|
r'^[a-zA-Z0-9]+$',
|
||||||
caseSensitive: false,
|
caseSensitive: false,
|
||||||
multiLine: false,
|
multiLine: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (regExp.hasMatch(pubkey) == true &&
|
if (regExp.hasMatch(address) == true &&
|
||||||
pubkey.length > 42 &&
|
address.length > 47 &&
|
||||||
pubkey.length < 50) {
|
address.length < 50) {
|
||||||
log.d("C'est une pubkey !");
|
log.d("C'est une adresse !");
|
||||||
|
|
||||||
this.pubkey = pubkey;
|
this.address = address;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/providers/cesium_plus.dart';
|
import 'package:gecko/providers/cesium_plus.dart';
|
||||||
import 'package:gecko/models/queries.dart';
|
|
||||||
import 'package:gecko/providers/substrate_sdk.dart';
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
import 'package:gecko/providers/wallets_profiles.dart';
|
import 'package:gecko/providers/wallets_profiles.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -65,7 +64,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Query(
|
Query(
|
||||||
options: QueryOptions(
|
options: QueryOptions(
|
||||||
document: gql(getHistory),
|
document: gql('getHistory'),
|
||||||
variables: <String, dynamic>{
|
variables: <String, dynamic>{
|
||||||
'pubkey': pubkey,
|
'pubkey': pubkey,
|
||||||
'number': 10,
|
'number': 10,
|
||||||
|
@ -419,7 +418,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
if (username == null)
|
if (username == null)
|
||||||
Query(
|
Query(
|
||||||
options: QueryOptions(
|
options: QueryOptions(
|
||||||
document: gql(getId),
|
document: gql('getId'),
|
||||||
variables: {
|
variables: {
|
||||||
'pubkey': pubkey,
|
'pubkey': pubkey,
|
||||||
},
|
},
|
||||||
|
|
|
@ -240,10 +240,10 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
listen: false);
|
listen: false);
|
||||||
final acc = _sub.getCurrentWallet();
|
final acc = _sub.getCurrentWallet();
|
||||||
log.d(
|
log.d(
|
||||||
"fromAddress: ${acc.address!},destAddress: ${_walletViewProvider.pubkey!}, 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: _walletViewProvider.pubkey!,
|
destAddress: _walletViewProvider.address!,
|
||||||
amount:
|
amount:
|
||||||
double.parse(_walletViewProvider.payAmount.text),
|
double.parse(_walletViewProvider.payAmount.text),
|
||||||
password: _pin.toUpperCase());
|
password: _pin.toUpperCase());
|
||||||
|
@ -260,7 +260,7 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
listen: false);
|
listen: false);
|
||||||
final acc = _sub.getCurrentWallet();
|
final acc = _sub.getCurrentWallet();
|
||||||
_sub.certify(acc.address!, _pin.toUpperCase(),
|
_sub.certify(acc.address!, _pin.toUpperCase(),
|
||||||
_walletViewProvider.pubkey!);
|
_walletViewProvider.address!);
|
||||||
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
|
|
|
@ -43,153 +43,159 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||||
child:
|
child: Column(
|
||||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: <
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Widget>[
|
children: <Widget>[
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
RichText(
|
RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
color: Colors.grey[700],
|
color: Colors.grey[700],
|
||||||
|
),
|
||||||
|
children: <TextSpan>[
|
||||||
|
const TextSpan(
|
||||||
|
text: "Résultats pour ",
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: '"${_searchProvider.searchController.text}"',
|
||||||
|
style: const TextStyle(fontStyle: FontStyle.italic),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
children: <TextSpan>[
|
const SizedBox(height: 40),
|
||||||
const TextSpan(
|
Text(
|
||||||
text: "Résultats pour ",
|
'Dans la blockchain $currencyName',
|
||||||
),
|
style: const TextStyle(fontSize: 20),
|
||||||
TextSpan(
|
),
|
||||||
text: '"${_searchProvider.searchController.text}"',
|
const SizedBox(height: 20),
|
||||||
style: const TextStyle(fontStyle: FontStyle.italic),
|
FutureBuilder(
|
||||||
),
|
future: _searchProvider.searchAddress(),
|
||||||
],
|
builder: (context, AsyncSnapshot<List?> snapshot) {
|
||||||
),
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
),
|
log.d(snapshot.data);
|
||||||
const SizedBox(height: 40),
|
if (snapshot.data?.isEmpty ?? true) {
|
||||||
Text(
|
return const Text('Aucun résultat');
|
||||||
'Dans la blockchain $currencyName',
|
} else {
|
||||||
style: const TextStyle(fontSize: 20),
|
return Expanded(
|
||||||
),
|
child: ListView(children: <Widget>[
|
||||||
const SizedBox(height: 20),
|
for (G1WalletsList g1Wallet in snapshot.data ?? [])
|
||||||
FutureBuilder(
|
Padding(
|
||||||
future: _searchProvider.searchBlockchain(),
|
padding:
|
||||||
builder: (context, AsyncSnapshot<List?> snapshot) {
|
const EdgeInsets.symmetric(horizontal: 5),
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
child: ListTile(
|
||||||
return Expanded(
|
key: Key('searchResult${keyID++}'),
|
||||||
child: ListView(children: <Widget>[
|
horizontalTitleGap: 40,
|
||||||
for (G1WalletsList g1Wallet in snapshot.data ?? [])
|
contentPadding: const EdgeInsets.all(5),
|
||||||
Padding(
|
leading:
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
// g1WalletsBox.get(g1Wallet.pubkey)
|
||||||
child: ListTile(
|
// ?.avatar !=
|
||||||
key: Key('searchResult${keyID++}'),
|
// null
|
||||||
horizontalTitleGap: 40,
|
// ?
|
||||||
contentPadding: const EdgeInsets.all(5),
|
_cesiumPlusProvider
|
||||||
leading: g1WalletsBox
|
.defaultAvatar(_avatarSize),
|
||||||
.get(g1Wallet.pubkey)
|
// : FutureBuilder(
|
||||||
?.avatar !=
|
// future: _cesiumPlusProvider.getAvatar(
|
||||||
null
|
// g1Wallet.pubkey, _avatarSize),
|
||||||
? ClipOval(
|
// builder: (BuildContext context,
|
||||||
child: g1WalletsBox
|
// AsyncSnapshot<Image?> _avatar) {
|
||||||
.get(g1Wallet.pubkey)!
|
// if (_avatar.connectionState !=
|
||||||
.avatar)
|
// ConnectionState.done ||
|
||||||
: FutureBuilder(
|
// _avatar.hasError) {
|
||||||
future: _cesiumPlusProvider.getAvatar(
|
// return Stack(children: [
|
||||||
g1Wallet.pubkey, _avatarSize),
|
// _cesiumPlusProvider
|
||||||
builder: (BuildContext context,
|
// .defaultAvatar(_avatarSize),
|
||||||
AsyncSnapshot<Image?> _avatar) {
|
// Positioned(
|
||||||
if (_avatar.connectionState !=
|
// top: 8,
|
||||||
ConnectionState.done ||
|
// right: 0,
|
||||||
_avatar.hasError) {
|
// width: 12,
|
||||||
return Stack(children: [
|
// height: 12,
|
||||||
_cesiumPlusProvider
|
// child: CircularProgressIndicator(
|
||||||
.defaultAvatar(_avatarSize),
|
// strokeWidth: 1,
|
||||||
Positioned(
|
// color: orangeC,
|
||||||
top: 8,
|
// ),
|
||||||
right: 0,
|
// ),
|
||||||
width: 12,
|
// ]);
|
||||||
height: 12,
|
// }
|
||||||
child: CircularProgressIndicator(
|
// if (_avatar.hasData) {
|
||||||
strokeWidth: 1,
|
// final _w =
|
||||||
color: orangeC,
|
// g1WalletsBox.get(g1Wallet.pubkey);
|
||||||
),
|
// if (_w != null) {
|
||||||
),
|
// _w.avatar = _avatar.data;
|
||||||
]);
|
// }
|
||||||
}
|
// return ClipOval(child: _avatar.data);
|
||||||
if (_avatar.hasData) {
|
// } else {
|
||||||
final _w =
|
// g1WalletsBox
|
||||||
g1WalletsBox.get(g1Wallet.pubkey);
|
// .get(g1Wallet.pubkey)!
|
||||||
if (_w != null) {
|
// .avatar =
|
||||||
_w.avatar = _avatar.data;
|
// _cesiumPlusProvider
|
||||||
}
|
// .defaultAvatar(_avatarSize);
|
||||||
return ClipOval(child: _avatar.data);
|
// return _cesiumPlusProvider
|
||||||
} else {
|
// .defaultAvatar(_avatarSize);
|
||||||
g1WalletsBox
|
// }
|
||||||
.get(g1Wallet.pubkey)!
|
// }),
|
||||||
.avatar =
|
title: Row(children: <Widget>[
|
||||||
_cesiumPlusProvider
|
Text(getShortPubkey(g1Wallet.pubkey!),
|
||||||
.defaultAvatar(_avatarSize);
|
style: const TextStyle(
|
||||||
return _cesiumPlusProvider
|
fontSize: 18,
|
||||||
.defaultAvatar(_avatarSize);
|
fontFamily: 'Monospace',
|
||||||
}
|
fontWeight: FontWeight.w500),
|
||||||
}),
|
textAlign: TextAlign.center),
|
||||||
title: Row(children: <Widget>[
|
]),
|
||||||
Text(getShortPubkey(g1Wallet.pubkey!),
|
trailing: Column(
|
||||||
style: const TextStyle(
|
mainAxisAlignment:
|
||||||
fontSize: 18,
|
MainAxisAlignment.center,
|
||||||
fontFamily: 'Monospace',
|
children: [
|
||||||
fontWeight: FontWeight.w500),
|
balance(context, g1Wallet.pubkey!, 16)
|
||||||
textAlign: TextAlign.center),
|
]),
|
||||||
]),
|
subtitle: Row(children: <Widget>[
|
||||||
trailing: Column(
|
Text(g1Wallet.id?.username ?? '',
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
style: const TextStyle(
|
||||||
children: [
|
fontSize: 18,
|
||||||
balance(context, g1Wallet.pubkey!, 16)
|
fontWeight: FontWeight.w500),
|
||||||
]),
|
textAlign: TextAlign.center),
|
||||||
subtitle: Row(children: <Widget>[
|
]),
|
||||||
Text(g1Wallet.id?.username ?? '',
|
dense: false,
|
||||||
style: const TextStyle(
|
isThreeLine: false,
|
||||||
fontSize: 18,
|
onTap: () {
|
||||||
fontWeight: FontWeight.w500),
|
Navigator.push(
|
||||||
textAlign: TextAlign.center),
|
context,
|
||||||
]),
|
MaterialPageRoute(builder: (context) {
|
||||||
dense: false,
|
_walletsProfilesClass.address =
|
||||||
isThreeLine: false,
|
g1Wallet.pubkey;
|
||||||
onTap: () {
|
return WalletViewScreen(
|
||||||
Navigator.push(
|
pubkey: g1Wallet.pubkey,
|
||||||
context,
|
username: g1WalletsBox
|
||||||
MaterialPageRoute(builder: (context) {
|
.get(g1Wallet.pubkey)
|
||||||
_walletsProfilesClass.pubkey =
|
?.id
|
||||||
g1Wallet.pubkey;
|
?.username,
|
||||||
return WalletViewScreen(
|
avatar: g1WalletsBox
|
||||||
pubkey: g1Wallet.pubkey,
|
.get(g1Wallet.pubkey)
|
||||||
username: g1WalletsBox
|
?.avatar,
|
||||||
.get(g1Wallet.pubkey)
|
);
|
||||||
?.id
|
}),
|
||||||
?.username,
|
);
|
||||||
avatar: g1WalletsBox
|
}),
|
||||||
.get(g1Wallet.pubkey)
|
),
|
||||||
?.avatar,
|
]),
|
||||||
);
|
);
|
||||||
}),
|
}
|
||||||
);
|
}
|
||||||
}),
|
return Center(
|
||||||
),
|
heightFactor: 5,
|
||||||
]),
|
child: CircularProgressIndicator(
|
||||||
);
|
strokeWidth: 3,
|
||||||
}
|
backgroundColor: yellowC,
|
||||||
return Center(
|
color: orangeC,
|
||||||
heightFactor: 5,
|
),
|
||||||
child: CircularProgressIndicator(
|
);
|
||||||
strokeWidth: 3,
|
},
|
||||||
backgroundColor: yellowC,
|
),
|
||||||
color: orangeC,
|
// Text(
|
||||||
),
|
// _searchProvider.searchResult.toString(),
|
||||||
);
|
// )
|
||||||
},
|
]),
|
||||||
),
|
|
||||||
// Text(
|
|
||||||
// _searchProvider.searchResult.toString(),
|
|
||||||
// )
|
|
||||||
]),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -28,10 +28,10 @@ class TransactionInProgress extends StatelessWidget {
|
||||||
// Map jsonResult;
|
// Map jsonResult;
|
||||||
final _result = _sub.transactionStatus;
|
final _result = _sub.transactionStatus;
|
||||||
|
|
||||||
log.d(_walletViewProvider.pubkey!);
|
log.d(_walletViewProvider.address!);
|
||||||
|
|
||||||
final from = _myWalletProvider.getDefaultWallet()!.name!;
|
final from = _myWalletProvider.getDefaultWallet()!.name!;
|
||||||
final to = getShortPubkey(_walletViewProvider.pubkey!);
|
final to = getShortPubkey(_walletViewProvider.address!);
|
||||||
final amount = _walletViewProvider.payAmount.text;
|
final amount = _walletViewProvider.payAmount.text;
|
||||||
String _actionName = '';
|
String _actionName = '';
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
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);
|
||||||
_walletViewProvider.pubkey = pubkey!;
|
_walletViewProvider.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);
|
||||||
|
@ -278,7 +278,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
double.parse(_walletViewProvider.payAmount.text) <=
|
double.parse(_walletViewProvider.payAmount.text) <=
|
||||||
double.parse(
|
double.parse(
|
||||||
balanceCache[defaultWallet.address]!.split(' ')[0]) &&
|
balanceCache[defaultWallet.address]!.split(' ')[0]) &&
|
||||||
_walletViewProvider.pubkey != defaultWallet.address) {
|
_walletViewProvider.address != defaultWallet.address) {
|
||||||
canValidate = true;
|
canValidate = true;
|
||||||
} else {
|
} else {
|
||||||
canValidate = false;
|
canValidate = false;
|
||||||
|
|
Loading…
Reference in New Issue