Remake watch wallet view; improve search list results view
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 460 B After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 585 B After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 482 B After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 719 B After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 492 B After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 14 KiB |
|
@ -51,7 +51,6 @@ Future<void> main() async {
|
||||||
|
|
||||||
HomeProvider _homeProvider = HomeProvider();
|
HomeProvider _homeProvider = HomeProvider();
|
||||||
appPath = await getApplicationDocumentsDirectory();
|
appPath = await getApplicationDocumentsDirectory();
|
||||||
await _homeProvider.createDefaultAvatar();
|
|
||||||
appVersion = await _homeProvider.getAppVersion();
|
appVersion = await _homeProvider.getAppVersion();
|
||||||
prefs = await SharedPreferences.getInstance();
|
prefs = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@ import 'package:path_provider/path_provider.dart';
|
||||||
|
|
||||||
class CesiumPlusProvider with ChangeNotifier {
|
class CesiumPlusProvider with ChangeNotifier {
|
||||||
TextEditingController cesiumName = TextEditingController();
|
TextEditingController cesiumName = TextEditingController();
|
||||||
bool isComplete = false;
|
Image defaultAvatar(double size) =>
|
||||||
|
Image.asset(('assets/icon_user.png'), height: size);
|
||||||
|
|
||||||
Future<List> _buildQuery(_pubkey) async {
|
Future<List> _buildQuery(_pubkey) async {
|
||||||
var queryGetAvatar = json.encode({
|
var queryGetAvatar = json.encode({
|
||||||
|
@ -77,27 +78,34 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List> getAvatar(String _pubkey) async {
|
Future<Image> getAvatar(String _pubkey, double size) async {
|
||||||
List queryOptions = await _buildQuery(_pubkey);
|
List queryOptions = await _buildQuery(_pubkey);
|
||||||
final response = await http.post((Uri.parse(queryOptions[0])),
|
|
||||||
body: queryOptions[1], headers: queryOptions[2]);
|
http.Response response;
|
||||||
|
try {
|
||||||
|
response = await http.post((Uri.parse(queryOptions[0])),
|
||||||
|
body: queryOptions[1], headers: queryOptions[2]);
|
||||||
|
} catch (e) {
|
||||||
|
log.e(e);
|
||||||
|
}
|
||||||
final responseJson = json.decode(response.body);
|
final responseJson = json.decode(response.body);
|
||||||
if (responseJson['hits']['hits'].toString() == '[]') {
|
|
||||||
return [File(appPath.path + '/default_avatar.png')];
|
if (responseJson['hits']['hits'].toString() == '[]' ||
|
||||||
}
|
!responseJson['hits']['hits'][0]['_source'].containsKey("avatar")) {
|
||||||
final bool avatarExist =
|
return defaultAvatar(size);
|
||||||
responseJson['hits']['hits'][0]['_source'].containsKey("avatar");
|
|
||||||
if (!avatarExist) {
|
|
||||||
return [File(appPath.path + '/default_avatar.png')];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final _avatar =
|
final _avatar =
|
||||||
responseJson['hits']['hits'][0]['_source']['avatar']['_content'];
|
responseJson['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));
|
||||||
isComplete = true;
|
|
||||||
|
|
||||||
return [avatarFile];
|
return Image.file(
|
||||||
|
avatarFile,
|
||||||
|
height: size,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/my_wallets.dart';
|
import 'package:gecko/models/my_wallets.dart';
|
||||||
import 'package:gecko/models/wallet_data.dart';
|
import 'package:gecko/models/wallet_data.dart';
|
||||||
import 'package:gecko/screens/history.dart';
|
import 'package:gecko/screens/wallet_view.dart';
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'package:jdenticon_dart/jdenticon_dart.dart';
|
import 'package:jdenticon_dart/jdenticon_dart.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
@ -81,7 +81,7 @@ class HistoryProvider with ChangeNotifier {
|
||||||
if (regExp.hasMatch(pubkey) == true &&
|
if (regExp.hasMatch(pubkey) == true &&
|
||||||
pubkey.length > 42 &&
|
pubkey.length > 42 &&
|
||||||
pubkey.length < 45) {
|
pubkey.length < 45) {
|
||||||
log.d("C'est une pubkey !!!");
|
log.d("C'est une pubkey !");
|
||||||
|
|
||||||
this.pubkey = pubkey;
|
this.pubkey = pubkey;
|
||||||
getShortPubkey(pubkey);
|
getShortPubkey(pubkey);
|
||||||
|
@ -101,7 +101,7 @@ class HistoryProvider with ChangeNotifier {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) {
|
MaterialPageRoute(builder: (context) {
|
||||||
return HistoryScreen();
|
return WalletViewScreen();
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
@ -238,6 +238,7 @@ class HistoryProvider with ChangeNotifier {
|
||||||
|
|
||||||
snackCopyKey(context) {
|
snackCopyKey(context) {
|
||||||
const snackBar = SnackBar(
|
const snackBar = SnackBar(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
content:
|
content:
|
||||||
Text("Cette clé publique a été copié dans votre presse-papier."),
|
Text("Cette clé publique a été copié dans votre presse-papier."),
|
||||||
duration: Duration(seconds: 2));
|
duration: Duration(seconds: 2));
|
||||||
|
|
|
@ -100,16 +100,6 @@ class HomeProvider with ChangeNotifier {
|
||||||
return _endpoint;
|
return _endpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future createDefaultAvatar() async {
|
|
||||||
File defaultAvatar = File(appPath.path + '/default_avatar.png');
|
|
||||||
final bool isAvatarExist = await defaultAvatar.exists();
|
|
||||||
if (!isAvatarExist) {
|
|
||||||
final byteData = await rootBundle.load('assets/icon_user.png');
|
|
||||||
await defaultAvatar.writeAsBytes(byteData.buffer
|
|
||||||
.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
T getRandomElement<T>(List<T> list) {
|
T getRandomElement<T>(List<T> list) {
|
||||||
final random = Random();
|
final random = Random();
|
||||||
var i = random.nextInt(list.length);
|
var i = random.nextInt(list.length);
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'dart:io';
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/cesium_plus.dart';
|
import 'package:gecko/models/cesium_plus.dart';
|
||||||
|
@ -191,40 +190,36 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future:
|
future:
|
||||||
_cesiumPlusProvider.getAvatar(
|
_cesiumPlusProvider.getAvatar(
|
||||||
_historyProvider.pubkey),
|
_historyProvider.pubkey,
|
||||||
initialData: [
|
55),
|
||||||
File(appPath.path +
|
|
||||||
'/default_avatar.png')
|
|
||||||
],
|
|
||||||
builder: (BuildContext context,
|
builder: (BuildContext context,
|
||||||
AsyncSnapshot<List> _avatar) {
|
AsyncSnapshot<Image> _avatar) {
|
||||||
// _cesiumPlusProvider.isComplete = true;
|
|
||||||
if (_avatar.connectionState !=
|
if (_avatar.connectionState !=
|
||||||
ConnectionState.done) {
|
ConnectionState.done ||
|
||||||
return Image.file(
|
_avatar.hasError) {
|
||||||
File(appPath.path +
|
return Stack(children: [
|
||||||
'/default_avatar.png'),
|
_cesiumPlusProvider
|
||||||
height: avatarsSize);
|
.defaultAvatar(55),
|
||||||
}
|
Positioned(
|
||||||
if (_avatar.hasError) {
|
top: 8,
|
||||||
return Image.file(
|
right: 0,
|
||||||
File(appPath.path +
|
width: 12,
|
||||||
'/default_avatar.png'),
|
height: 12,
|
||||||
height: avatarsSize);
|
child:
|
||||||
|
CircularProgressIndicator(
|
||||||
|
strokeWidth: 1,
|
||||||
|
color: orangeC,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
if (_avatar.hasData) {
|
if (_avatar.hasData) {
|
||||||
return SingleChildScrollView(
|
return ClipOval(
|
||||||
padding:
|
child: _avatar.data,
|
||||||
const EdgeInsets.all(
|
);
|
||||||
0.0),
|
|
||||||
child: Image.file(
|
|
||||||
_avatar.data[0],
|
|
||||||
height: avatarsSize));
|
|
||||||
}
|
}
|
||||||
return Image.file(
|
return _cesiumPlusProvider
|
||||||
File(appPath.path +
|
.defaultAvatar(55);
|
||||||
'/default_avatar.png'),
|
|
||||||
height: avatarsSize);
|
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
|
@ -448,7 +443,8 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
if (result.isLoading)
|
if (result.isLoading &&
|
||||||
|
_historyProvider.pageInfo['hasPreviousPage'])
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: const <Widget>[
|
children: const <Widget>[
|
||||||
|
|
|
@ -57,357 +57,362 @@ class WalletOptions extends StatelessWidget {
|
||||||
log.d("Wallet options: $currentChest:${wallet.number}");
|
log.d("Wallet options: $currentChest:${wallet.number}");
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
_walletOptions.isEditing = false;
|
_walletOptions.isEditing = false;
|
||||||
_walletOptions.isBalanceBlur = true;
|
_walletOptions.isBalanceBlur = true;
|
||||||
Navigator.popUntil(
|
Navigator.popUntil(
|
||||||
context,
|
context,
|
||||||
ModalRoute.withName('/mywallets'),
|
ModalRoute.withName('/mywallets'),
|
||||||
);
|
);
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
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 = true;
|
_walletOptions.isBalanceBlur = true;
|
||||||
Navigator.popUntil(
|
Navigator.popUntil(
|
||||||
context,
|
context,
|
||||||
ModalRoute.withName('/mywallets'),
|
ModalRoute.withName('/mywallets'),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
height: 22,
|
height: 22,
|
||||||
child: Text(_walletOptions.nameController.text),
|
child: Text(_walletOptions.nameController.text),
|
||||||
)),
|
)),
|
||||||
body: Builder(
|
body: Builder(
|
||||||
builder: (ctx) => SafeArea(
|
builder: (ctx) => SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
height: isTall ? 15 : 0,
|
height: isTall ? 15 : 0,
|
||||||
color: yellowC,
|
color: yellowC,
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
colors: [
|
colors: [
|
||||||
yellowC,
|
yellowC,
|
||||||
const Color(0xfffafafa),
|
const Color(0xfffafafa),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
child: Row(children: <Widget>[
|
child: Row(children: <Widget>[
|
||||||
const SizedBox(width: 25),
|
const SizedBox(width: 25),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
File newAvatar =
|
File newAvatar = await _walletOptions.changeAvatar();
|
||||||
await _walletOptions.changeAvatar();
|
if (newAvatar != null) {
|
||||||
if (newAvatar != null) {
|
wallet.imageFile = newAvatar;
|
||||||
wallet.imageFile = newAvatar;
|
}
|
||||||
}
|
_walletOptions.reloadBuild();
|
||||||
_walletOptions.reloadBuild();
|
},
|
||||||
},
|
child: wallet.imageFile == null
|
||||||
child: wallet.imageFile == null
|
? Image.asset(
|
||||||
? Image.asset(
|
'assets/avatars/${wallet.imageName}',
|
||||||
'assets/avatars/${wallet.imageName}',
|
width: 110,
|
||||||
width: 110,
|
)
|
||||||
)
|
: Image.file(
|
||||||
: Image.file(
|
wallet.imageFile,
|
||||||
wallet.imageFile,
|
width: 110,
|
||||||
width: 110,
|
)),
|
||||||
)),
|
InkWell(
|
||||||
InkWell(
|
onTap: () async {
|
||||||
onTap: () async {
|
File newAvatar = await _walletOptions.changeAvatar();
|
||||||
File newAvatar =
|
if (newAvatar != null) {
|
||||||
await _walletOptions.changeAvatar();
|
wallet.imageFile = newAvatar;
|
||||||
if (newAvatar != null) {
|
}
|
||||||
wallet.imageFile = newAvatar;
|
_walletOptions.reloadBuild();
|
||||||
}
|
},
|
||||||
_walletOptions.reloadBuild();
|
child: Column(children: <Widget>[
|
||||||
},
|
Image.asset(
|
||||||
child: Column(children: <Widget>[
|
'assets/walletOptions/camera.png',
|
||||||
Image.asset(
|
),
|
||||||
'assets/walletOptions/camera.png',
|
const SizedBox(height: 100)
|
||||||
|
])),
|
||||||
|
Column(children: <Widget>[
|
||||||
|
Row(children: <Widget>[
|
||||||
|
Column(children: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
width: 260,
|
||||||
|
child: TextField(
|
||||||
|
key: const Key('walletName'),
|
||||||
|
autofocus: false,
|
||||||
|
focusNode: _walletOptions.walletNameFocus,
|
||||||
|
enabled: _walletOptions.isEditing,
|
||||||
|
controller: _walletOptions.nameController,
|
||||||
|
maxLines: _nbrLinesName,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
focusedBorder: InputBorder.none,
|
||||||
|
enabledBorder: InputBorder.none,
|
||||||
|
disabledBorder: InputBorder.none,
|
||||||
|
contentPadding: EdgeInsets.all(15.0),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: isTall ? 27 : 23,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontFamily: 'Monospace')),
|
||||||
|
),
|
||||||
|
SizedBox(height: isTall ? 5 : 0),
|
||||||
|
Query(
|
||||||
|
options: QueryOptions(
|
||||||
|
document: gql(getBalance),
|
||||||
|
variables: {
|
||||||
|
'pubkey': _walletOptions.pubkey.text,
|
||||||
|
},
|
||||||
|
// pollInterval: Duration(seconds: 1),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 100)
|
builder: (QueryResult result,
|
||||||
])),
|
{VoidCallback refetch, FetchMore fetchMore}) {
|
||||||
Column(children: <Widget>[
|
if (result.hasException) {
|
||||||
Row(children: <Widget>[
|
return Text(result.exception.toString());
|
||||||
Column(children: <Widget>[
|
}
|
||||||
SizedBox(
|
|
||||||
width: 260,
|
|
||||||
child: TextField(
|
|
||||||
key: const Key('walletName'),
|
|
||||||
autofocus: false,
|
|
||||||
focusNode: _walletOptions.walletNameFocus,
|
|
||||||
enabled: _walletOptions.isEditing,
|
|
||||||
controller: _walletOptions.nameController,
|
|
||||||
maxLines: _nbrLinesName,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
border: InputBorder.none,
|
|
||||||
focusedBorder: InputBorder.none,
|
|
||||||
enabledBorder: InputBorder.none,
|
|
||||||
disabledBorder: InputBorder.none,
|
|
||||||
contentPadding: EdgeInsets.all(15.0),
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: isTall ? 27 : 23,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
fontFamily: 'Monospace')),
|
|
||||||
),
|
|
||||||
SizedBox(height: isTall ? 5 : 0),
|
|
||||||
Query(
|
|
||||||
options: QueryOptions(
|
|
||||||
document: gql(getBalance),
|
|
||||||
variables: {
|
|
||||||
'pubkey': _walletOptions.pubkey.text,
|
|
||||||
},
|
|
||||||
// pollInterval: Duration(seconds: 1),
|
|
||||||
),
|
|
||||||
builder: (QueryResult result,
|
|
||||||
{VoidCallback refetch, FetchMore fetchMore}) {
|
|
||||||
if (result.hasException) {
|
|
||||||
return Text(result.exception.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.isLoading) {
|
if (result.isLoading) {
|
||||||
return const Text('Loading');
|
return const Text('Loading');
|
||||||
}
|
}
|
||||||
|
|
||||||
// List repositories = result.data['viewer']['repositories']['nodes'];
|
// List repositories = result.data['viewer']['repositories']['nodes'];
|
||||||
String wBalanceUD;
|
String wBalanceUD;
|
||||||
if (result.data['balance'] == null) {
|
if (result.data['balance'] == null) {
|
||||||
wBalanceUD = '0.0';
|
wBalanceUD = '0.0';
|
||||||
} else {
|
} else {
|
||||||
int wBalanceG1 =
|
int wBalanceG1 =
|
||||||
result.data['balance']['amount'];
|
result.data['balance']['amount'];
|
||||||
int currentUD =
|
int currentUD =
|
||||||
result.data['currentUd']['amount'];
|
result.data['currentUd']['amount'];
|
||||||
double wBalanceUDBrut =
|
double wBalanceUDBrut =
|
||||||
wBalanceG1 / currentUD; // .toString();
|
wBalanceG1 / currentUD; // .toString();
|
||||||
wBalanceUD = double.parse(
|
wBalanceUD = double.parse(
|
||||||
(wBalanceUDBrut).toStringAsFixed(2))
|
(wBalanceUDBrut).toStringAsFixed(2))
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
return Row(children: <Widget>[
|
return Row(children: <Widget>[
|
||||||
ImageFiltered(
|
ImageFiltered(
|
||||||
imageFilter: ImageFilter.blur(
|
imageFilter: ImageFilter.blur(
|
||||||
sigmaX: _walletOptions.isBalanceBlur
|
sigmaX:
|
||||||
? 6
|
_walletOptions.isBalanceBlur ? 6 : 0,
|
||||||
: 0,
|
sigmaY:
|
||||||
sigmaY: _walletOptions.isBalanceBlur
|
_walletOptions.isBalanceBlur ? 5 : 0),
|
||||||
? 5
|
child: Text(wBalanceUD,
|
||||||
: 0),
|
|
||||||
child: Text(wBalanceUD,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: isTall ? 20 : 18,
|
|
||||||
color: Colors.black)),
|
|
||||||
),
|
|
||||||
Text(' DU',
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: isTall ? 20 : 18,
|
fontSize: isTall ? 20 : 18,
|
||||||
color: Colors.black))
|
color: Colors.black)),
|
||||||
]);
|
),
|
||||||
|
Text(' DU',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: isTall ? 20 : 18,
|
||||||
|
color: Colors.black))
|
||||||
|
]);
|
||||||
|
|
||||||
// Text(
|
// Text(
|
||||||
// '$wBalanceUD DU',
|
// '$wBalanceUD DU',
|
||||||
// style: TextStyle(
|
// style: TextStyle(
|
||||||
// fontSize: 20, color: Colors.black),
|
// fontSize: 20, color: Colors.black),
|
||||||
// );
|
// );
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
InkWell(
|
||||||
|
key: const Key('displayBalance'),
|
||||||
|
onTap: () {
|
||||||
|
_walletOptions.bluringBalance();
|
||||||
},
|
},
|
||||||
),
|
|
||||||
const SizedBox(height: 5),
|
|
||||||
InkWell(
|
|
||||||
key: const Key('displayBalance'),
|
|
||||||
onTap: () {
|
|
||||||
_walletOptions.bluringBalance();
|
|
||||||
},
|
|
||||||
child: Image.asset(
|
|
||||||
_walletOptions.isBalanceBlur
|
|
||||||
? 'assets/walletOptions/icon_oeuil.png'
|
|
||||||
: 'assets/walletOptions/icon_oeuil_close.png',
|
|
||||||
)),
|
|
||||||
]),
|
|
||||||
const SizedBox(width: 0),
|
|
||||||
Column(children: <Widget>[
|
|
||||||
InkWell(
|
|
||||||
key: const Key('renameWallet'),
|
|
||||||
onTap: () async {
|
|
||||||
_isNewNameValid =
|
|
||||||
_walletOptions.editWalletName(wallet.id(),
|
|
||||||
isCesium: false);
|
|
||||||
await Future.delayed(
|
|
||||||
const Duration(milliseconds: 30));
|
|
||||||
_walletOptions.walletNameFocus.requestFocus();
|
|
||||||
},
|
|
||||||
child: ClipRRect(
|
|
||||||
child: Image.asset(
|
|
||||||
_walletOptions.isEditing
|
|
||||||
? 'assets/walletOptions/android-checkmark.png'
|
|
||||||
: 'assets/walletOptions/edit.png',
|
|
||||||
width: 20,
|
|
||||||
height: 20),
|
|
||||||
)),
|
|
||||||
const SizedBox(
|
|
||||||
height: 60,
|
|
||||||
)
|
|
||||||
])
|
|
||||||
]),
|
|
||||||
]),
|
|
||||||
])),
|
|
||||||
SizedBox(height: 4 * ratio),
|
|
||||||
FutureBuilder(
|
|
||||||
future: _walletOptions
|
|
||||||
.generateQRcode(_walletOptions.pubkey.text),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
return snapshot.data != null
|
|
||||||
? Image.memory(snapshot.data,
|
|
||||||
height: isTall ? 300 : 270)
|
|
||||||
: const Text('-', style: TextStyle(fontSize: 20));
|
|
||||||
}),
|
|
||||||
SizedBox(height: 15 * ratio),
|
|
||||||
GestureDetector(
|
|
||||||
key: const Key('copyPubkey'),
|
|
||||||
onTap: () {
|
|
||||||
Clipboard.setData(
|
|
||||||
ClipboardData(text: _walletOptions.pubkey.text));
|
|
||||||
_walletOptions.snackCopyKey(ctx);
|
|
||||||
},
|
|
||||||
child: SizedBox(
|
|
||||||
height: 50,
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
const SizedBox(width: 30),
|
|
||||||
Image.asset(
|
|
||||||
'assets/walletOptions/key.png',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 20),
|
|
||||||
Text("${shortPubkey.split(':')[0]}:",
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
fontFamily: 'Monospace',
|
|
||||||
color: Colors.black)),
|
|
||||||
Text(shortPubkey.split(':')[1],
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
fontFamily: 'Monospace')),
|
|
||||||
const SizedBox(width: 15),
|
|
||||||
SizedBox(
|
|
||||||
height: 40,
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
elevation: 1,
|
|
||||||
primary: orangeC, // background
|
|
||||||
onPrimary: Colors.black, // foreground
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Clipboard.setData(ClipboardData(
|
|
||||||
text: _walletOptions.pubkey.text));
|
|
||||||
_walletOptions.snackCopyKey(ctx);
|
|
||||||
},
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
Image.asset(
|
|
||||||
'assets/walletOptions/copy-white.png',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 7),
|
|
||||||
Text('Copier',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
color: Colors.grey[50]))
|
|
||||||
]))),
|
|
||||||
]))),
|
|
||||||
SizedBox(height: 10 * ratio),
|
|
||||||
InkWell(
|
|
||||||
key: const Key('displayHistory'),
|
|
||||||
onTap: () {
|
|
||||||
_historyProvider.isPubkey(ctx, _walletOptions.pubkey.text,
|
|
||||||
goHistory: true);
|
|
||||||
},
|
|
||||||
child: SizedBox(
|
|
||||||
height: 50,
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
const SizedBox(width: 30),
|
|
||||||
Image.asset(
|
|
||||||
'assets/walletOptions/clock.png',
|
|
||||||
),
|
|
||||||
const SizedBox(width: 22),
|
|
||||||
const Text('Historique des transactions',
|
|
||||||
style:
|
|
||||||
TextStyle(fontSize: 20, color: Colors.black)),
|
|
||||||
]))),
|
|
||||||
SizedBox(height: 12 * ratio),
|
|
||||||
InkWell(
|
|
||||||
key: const Key('setDefaultWallet'),
|
|
||||||
onTap: !_walletOptions.isDefaultWallet
|
|
||||||
? () {
|
|
||||||
defaultWallet = wallet;
|
|
||||||
chestBox.get(currentChest).defaultWallet =
|
|
||||||
wallet.number;
|
|
||||||
_myWalletProvider.readAllWallets(_currentChest);
|
|
||||||
_myWalletProvider.rebuildWidget();
|
|
||||||
}
|
|
||||||
: null,
|
|
||||||
child: SizedBox(
|
|
||||||
height: 50,
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
const SizedBox(width: 31),
|
|
||||||
CircleAvatar(
|
|
||||||
backgroundColor: Colors.grey[
|
|
||||||
_walletOptions.isDefaultWallet ? 300 : 500],
|
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/walletOptions/android-checkmark.png',
|
_walletOptions.isBalanceBlur
|
||||||
|
? 'assets/walletOptions/icon_oeuil.png'
|
||||||
|
: 'assets/walletOptions/icon_oeuil_close.png',
|
||||||
)),
|
)),
|
||||||
const SizedBox(width: 22),
|
]),
|
||||||
Text(
|
const SizedBox(width: 0),
|
||||||
_walletOptions.isDefaultWallet
|
Column(children: <Widget>[
|
||||||
? 'Ce portefeuille est celui par defaut'
|
InkWell(
|
||||||
: 'Définir comme portefeuille par défaut',
|
key: const Key('renameWallet'),
|
||||||
style: TextStyle(
|
onTap: () async {
|
||||||
fontSize: 20,
|
_isNewNameValid = _walletOptions.editWalletName(
|
||||||
color: _walletOptions.isDefaultWallet
|
wallet.id(),
|
||||||
? Colors.grey[500]
|
isCesium: false);
|
||||||
: Colors.black)),
|
await Future.delayed(
|
||||||
]))),
|
const Duration(milliseconds: 30));
|
||||||
SizedBox(height: 17 * ratio),
|
_walletOptions.walletNameFocus.requestFocus();
|
||||||
if (!_walletOptions.isDefaultWallet)
|
},
|
||||||
InkWell(
|
child: ClipRRect(
|
||||||
key: const Key('deleteWallet'),
|
child: Image.asset(
|
||||||
onTap: !_walletOptions.isDefaultWallet
|
_walletOptions.isEditing
|
||||||
? () async {
|
? 'assets/walletOptions/android-checkmark.png'
|
||||||
await _walletOptions.deleteWallet(
|
: 'assets/walletOptions/edit.png',
|
||||||
context, wallet);
|
width: 20,
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
height: 20),
|
||||||
_myWalletProvider.listWallets =
|
)),
|
||||||
_myWalletProvider
|
const SizedBox(
|
||||||
.readAllWallets(_currentChest);
|
height: 60,
|
||||||
_myWalletProvider.rebuildWidget();
|
)
|
||||||
});
|
])
|
||||||
}
|
]),
|
||||||
: null,
|
]),
|
||||||
child: Row(children: <Widget>[
|
])),
|
||||||
const SizedBox(width: 33),
|
SizedBox(height: 4 * ratio),
|
||||||
Image.asset(
|
FutureBuilder(
|
||||||
'assets/walletOptions/trash.png',
|
future:
|
||||||
|
_walletOptions.generateQRcode(_walletOptions.pubkey.text),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return snapshot.data != null
|
||||||
|
? Image.memory(snapshot.data,
|
||||||
|
height: isTall ? 300 : 270)
|
||||||
|
: const Text('-', style: TextStyle(fontSize: 20));
|
||||||
|
}),
|
||||||
|
SizedBox(height: 15 * ratio),
|
||||||
|
GestureDetector(
|
||||||
|
key: const Key('copyPubkey'),
|
||||||
|
onTap: () {
|
||||||
|
Clipboard.setData(
|
||||||
|
ClipboardData(text: _walletOptions.pubkey.text));
|
||||||
|
_walletOptions.snackCopyKey(ctx);
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
const SizedBox(width: 30),
|
||||||
|
Image.asset(
|
||||||
|
'assets/walletOptions/key.png',
|
||||||
|
),
|
||||||
|
const SizedBox(width: 20),
|
||||||
|
Text("${shortPubkey.split(':')[0]}:",
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
fontFamily: 'Monospace',
|
||||||
|
color: Colors.black)),
|
||||||
|
Text(shortPubkey.split(':')[1],
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
fontFamily: 'Monospace')),
|
||||||
|
const SizedBox(width: 15),
|
||||||
|
SizedBox(
|
||||||
|
height: 40,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
elevation: 1,
|
||||||
|
primary: orangeC, // background
|
||||||
|
onPrimary: Colors.black, // foreground
|
||||||
),
|
),
|
||||||
const SizedBox(width: 24),
|
onPressed: () {
|
||||||
const Text('Supprimer ce portefeuille',
|
Clipboard.setData(
|
||||||
style: TextStyle(
|
ClipboardData(text: _walletOptions.pubkey.text));
|
||||||
fontSize: 20, color: Color(0xffD80000))),
|
_walletOptions.snackCopyKey(ctx);
|
||||||
])),
|
},
|
||||||
]),
|
child: Row(children: <Widget>[
|
||||||
),
|
Image.asset(
|
||||||
|
'assets/walletOptions/copy-white.png',
|
||||||
|
),
|
||||||
|
const SizedBox(width: 7),
|
||||||
|
Text(
|
||||||
|
'Copier',
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 15, color: Colors.grey[50]),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10 * ratio),
|
||||||
|
InkWell(
|
||||||
|
key: const Key('displayHistory'),
|
||||||
|
onTap: () {
|
||||||
|
_historyProvider.isPubkey(ctx, _walletOptions.pubkey.text,
|
||||||
|
goHistory: true);
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
const SizedBox(width: 30),
|
||||||
|
Image.asset(
|
||||||
|
'assets/walletOptions/clock.png',
|
||||||
|
),
|
||||||
|
const SizedBox(width: 22),
|
||||||
|
const Text('Historique des transactions',
|
||||||
|
style: TextStyle(fontSize: 20, color: Colors.black)),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 12 * ratio),
|
||||||
|
InkWell(
|
||||||
|
key: const Key('setDefaultWallet'),
|
||||||
|
onTap: !_walletOptions.isDefaultWallet
|
||||||
|
? () {
|
||||||
|
defaultWallet = wallet;
|
||||||
|
chestBox.get(currentChest).defaultWallet =
|
||||||
|
wallet.number;
|
||||||
|
_myWalletProvider.readAllWallets(_currentChest);
|
||||||
|
_myWalletProvider.rebuildWidget();
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
const SizedBox(width: 31),
|
||||||
|
CircleAvatar(
|
||||||
|
backgroundColor: Colors
|
||||||
|
.grey[_walletOptions.isDefaultWallet ? 300 : 500],
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/walletOptions/android-checkmark.png',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 22),
|
||||||
|
Text(
|
||||||
|
_walletOptions.isDefaultWallet
|
||||||
|
? 'Ce portefeuille est celui par defaut'
|
||||||
|
: 'Définir comme portefeuille par défaut',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: _walletOptions.isDefaultWallet
|
||||||
|
? Colors.grey[500]
|
||||||
|
: Colors.black)),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 17 * ratio),
|
||||||
|
if (!_walletOptions.isDefaultWallet)
|
||||||
|
InkWell(
|
||||||
|
key: const Key('deleteWallet'),
|
||||||
|
onTap: !_walletOptions.isDefaultWallet
|
||||||
|
? () async {
|
||||||
|
await _walletOptions.deleteWallet(context, wallet);
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
_myWalletProvider.listWallets =
|
||||||
|
_myWalletProvider.readAllWallets(_currentChest);
|
||||||
|
_myWalletProvider.rebuildWidget();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
const SizedBox(width: 33),
|
||||||
|
Image.asset(
|
||||||
|
'assets/walletOptions/trash.png',
|
||||||
|
),
|
||||||
|
const SizedBox(width: 24),
|
||||||
|
const Text('Supprimer ce portefeuille',
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 20, color: Color(0xffD80000))),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
));
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'dart:io';
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -20,11 +19,8 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
HistoryProvider _historyClass =
|
HistoryProvider _historyClass =
|
||||||
Provider.of<HistoryProvider>(context, listen: false);
|
Provider.of<HistoryProvider>(context, listen: false);
|
||||||
|
|
||||||
// int nbrResult = 0;
|
|
||||||
int keyID = 0;
|
int keyID = 0;
|
||||||
const double avatarsSize = 50;
|
double _avatarSize = 55;
|
||||||
|
|
||||||
// _searchProvider.searchPubkey();
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
@ -37,113 +33,117 @@ 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(
|
const Text(
|
||||||
text: "Résultats pour ",
|
'Dans la blockchain Ğ1',
|
||||||
),
|
style: TextStyle(fontSize: 20),
|
||||||
TextSpan(
|
),
|
||||||
text: '"${_searchProvider.searchController.text}"',
|
const SizedBox(height: 20),
|
||||||
style: const TextStyle(fontStyle: FontStyle.italic),
|
FutureBuilder(
|
||||||
),
|
future: _searchProvider.searchBlockchain(),
|
||||||
],
|
builder: (context, snapshot) {
|
||||||
),
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
),
|
return Expanded(
|
||||||
const SizedBox(height: 40),
|
child: ListView(children: <Widget>[
|
||||||
const Text(
|
for (G1WalletsList g1Wallet in snapshot.data)
|
||||||
'Dans la blockchain Ğ1',
|
Padding(
|
||||||
style: TextStyle(fontSize: 20),
|
padding:
|
||||||
),
|
const EdgeInsets.symmetric(horizontal: 5),
|
||||||
const SizedBox(height: 20),
|
child: ListTile(
|
||||||
FutureBuilder(
|
key: Key('searchResult${keyID++}'),
|
||||||
future: _searchProvider.searchBlockchain(),
|
horizontalTitleGap: 40,
|
||||||
// initialData: const [],
|
contentPadding: const EdgeInsets.all(5),
|
||||||
builder: (context, snapshot) {
|
leading: FutureBuilder(
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
future: _cesiumPlusProvider.getAvatar(
|
||||||
return Expanded(
|
g1Wallet.pubkey, _avatarSize),
|
||||||
child: ListView(children: <Widget>[
|
builder: (BuildContext context,
|
||||||
for (G1WalletsList g1Wallet in snapshot.data)
|
AsyncSnapshot<Image> _avatar) {
|
||||||
Padding(
|
if (_avatar.connectionState !=
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 5),
|
ConnectionState.done ||
|
||||||
child: ListTile(
|
_avatar.hasError) {
|
||||||
key: Key('searchResult${keyID++}'),
|
return Stack(children: [
|
||||||
contentPadding: const EdgeInsets.all(5),
|
_cesiumPlusProvider
|
||||||
leading: FutureBuilder(
|
.defaultAvatar(_avatarSize),
|
||||||
future: _cesiumPlusProvider
|
Positioned(
|
||||||
.getAvatar(g1Wallet.pubkey),
|
top: 8,
|
||||||
initialData: [
|
right: 0,
|
||||||
File(appPath.path + '/default_avatar.png')
|
width: 12,
|
||||||
],
|
height: 12,
|
||||||
builder: (BuildContext context,
|
child: CircularProgressIndicator(
|
||||||
AsyncSnapshot<List> _avatar) {
|
strokeWidth: 1,
|
||||||
if (_avatar.connectionState !=
|
color: orangeC,
|
||||||
ConnectionState.done) {
|
),
|
||||||
return Image.file(
|
),
|
||||||
File(appPath.path +
|
]);
|
||||||
'/default_avatar.png'),
|
}
|
||||||
height: avatarsSize);
|
if (_avatar.hasData) {
|
||||||
}
|
return ClipOval(child: _avatar.data);
|
||||||
if (_avatar.hasError) {
|
}
|
||||||
return Image.file(
|
return _cesiumPlusProvider
|
||||||
File(appPath.path +
|
.defaultAvatar(_avatarSize);
|
||||||
'/default_avatar.png'),
|
}),
|
||||||
height: avatarsSize);
|
title: Row(children: <Widget>[
|
||||||
}
|
Text(
|
||||||
if (_avatar.hasData) {
|
_historyClass
|
||||||
return SingleChildScrollView(
|
.getShortPubkey(g1Wallet.pubkey),
|
||||||
padding: const EdgeInsets.all(0.0),
|
style: const TextStyle(
|
||||||
child: Image.file(_avatar.data.single,
|
fontSize: 18,
|
||||||
height: avatarsSize));
|
fontFamily: 'Monospace',
|
||||||
}
|
fontWeight: FontWeight.w500),
|
||||||
return Image.file(
|
textAlign: TextAlign.center),
|
||||||
File(appPath.path +
|
]),
|
||||||
'/default_avatar.png'),
|
subtitle: Row(children: <Widget>[
|
||||||
height: avatarsSize);
|
Text(g1Wallet?.id?.username ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.w500),
|
||||||
|
textAlign: TextAlign.center),
|
||||||
|
]),
|
||||||
|
dense: false,
|
||||||
|
isThreeLine: false,
|
||||||
|
onTap: () {
|
||||||
|
_historyClass.isPubkey(
|
||||||
|
context, g1Wallet.pubkey);
|
||||||
}),
|
}),
|
||||||
title: Text(
|
),
|
||||||
_historyClass.getShortPubkey(g1Wallet.pubkey),
|
]),
|
||||||
style: const TextStyle(
|
);
|
||||||
fontSize: 15.0, fontFamily: 'Monospace'),
|
}
|
||||||
textAlign: TextAlign.center),
|
return Center(
|
||||||
subtitle: Text(g1Wallet?.id?.username ?? '',
|
heightFactor: 5,
|
||||||
style: const TextStyle(fontSize: 12.0),
|
child: CircularProgressIndicator(
|
||||||
textAlign: TextAlign.center),
|
strokeWidth: 3,
|
||||||
trailing: Text("${g1Wallet.balance} Ğ1",
|
backgroundColor: yellowC,
|
||||||
style: const TextStyle(fontSize: 14.0),
|
color: orangeC,
|
||||||
textAlign: TextAlign.justify),
|
),
|
||||||
dense: false,
|
);
|
||||||
isThreeLine: false,
|
},
|
||||||
onTap: () {
|
),
|
||||||
_historyClass.isPubkey(
|
// Text(
|
||||||
context, g1Wallet.pubkey);
|
// _searchProvider.searchResult.toString(),
|
||||||
}),
|
// )
|
||||||
),
|
]),
|
||||||
]),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Center(
|
|
||||||
heightFactor: 5,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
strokeWidth: 3,
|
|
||||||
backgroundColor: yellowC,
|
|
||||||
color: orangeC,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
// Text(
|
|
||||||
// _searchProvider.searchResult.toString(),
|
|
||||||
// )
|
|
||||||
]),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,228 @@
|
||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gecko/models/cesium_plus.dart';
|
||||||
|
import 'package:gecko/models/history.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
// import 'package:gecko/models/home.dart';
|
||||||
|
// import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
|
class WalletViewScreen extends StatelessWidget {
|
||||||
|
TextEditingController tplController = TextEditingController();
|
||||||
|
|
||||||
|
WalletViewScreen({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
|
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
||||||
|
CesiumPlusProvider _cesiumPlusProvider =
|
||||||
|
Provider.of<CesiumPlusProvider>(context);
|
||||||
|
double _avatarSize = 150;
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
elevation: 0,
|
||||||
|
toolbarHeight: 60 * ratio,
|
||||||
|
title: const SizedBox(
|
||||||
|
height: 22,
|
||||||
|
child: Text('Voir un portefeuille'),
|
||||||
|
)),
|
||||||
|
body: SafeArea(
|
||||||
|
child: Column(children: <Widget>[
|
||||||
|
Container(
|
||||||
|
height: isTall ? 30 : 10,
|
||||||
|
color: yellowC,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topCenter,
|
||||||
|
end: Alignment.bottomCenter,
|
||||||
|
colors: [
|
||||||
|
yellowC,
|
||||||
|
const Color(0xFFE7811A),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
GestureDetector(
|
||||||
|
key: const Key('copyPubkey'),
|
||||||
|
onTap: () {
|
||||||
|
Clipboard.setData(
|
||||||
|
ClipboardData(text: _historyProvider.pubkey));
|
||||||
|
_historyProvider.snackCopyKey(context);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
_historyProvider
|
||||||
|
.getShortPubkey(_historyProvider.pubkey),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 30,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
FutureBuilder(
|
||||||
|
future: _cesiumPlusProvider
|
||||||
|
.getName(_historyProvider.pubkey),
|
||||||
|
initialData: '...',
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return SizedBox(
|
||||||
|
width: 230,
|
||||||
|
child: Text(
|
||||||
|
snapshot.data ?? '-',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20, color: Color(0xff814C00)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
]),
|
||||||
|
const Spacer(),
|
||||||
|
Column(children: <Widget>[
|
||||||
|
FutureBuilder(
|
||||||
|
future: _cesiumPlusProvider.getAvatar(
|
||||||
|
_historyProvider.pubkey, _avatarSize),
|
||||||
|
builder: (BuildContext context,
|
||||||
|
AsyncSnapshot<Image> _avatar) {
|
||||||
|
if (_avatar.connectionState != ConnectionState.done ||
|
||||||
|
_avatar.hasError) {
|
||||||
|
return Stack(children: [
|
||||||
|
ClipOval(
|
||||||
|
child: _cesiumPlusProvider
|
||||||
|
.defaultAvatar(_avatarSize),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 16.5,
|
||||||
|
right: 47.5,
|
||||||
|
width: 55,
|
||||||
|
height: 55,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 6,
|
||||||
|
color: orangeC,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if (_avatar.hasData) {
|
||||||
|
return ClipOval(
|
||||||
|
child: _avatar.data,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ClipOval(
|
||||||
|
child:
|
||||||
|
_cesiumPlusProvider.defaultAvatar(_avatarSize),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: isTall ? 60 : 30),
|
||||||
|
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||||
|
Column(children: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
height: 120,
|
||||||
|
child: ClipOval(
|
||||||
|
child: Material(
|
||||||
|
color: const Color(0xffFFD58D), // button color
|
||||||
|
child: InkWell(
|
||||||
|
key: const Key('viewHistory'),
|
||||||
|
splashColor: orangeC, // inkwell color
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(15),
|
||||||
|
child: Image(
|
||||||
|
image: AssetImage(
|
||||||
|
'assets/walletOptions/clock.png'),
|
||||||
|
height: 90)),
|
||||||
|
onTap: () {
|
||||||
|
null;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 9),
|
||||||
|
const Text(
|
||||||
|
"Voir\nl'historique",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
Column(children: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
height: 120,
|
||||||
|
child: ClipOval(
|
||||||
|
child: Material(
|
||||||
|
color: const Color(0xffFFD58D), // button color
|
||||||
|
child: InkWell(
|
||||||
|
key: const Key('copyKey'),
|
||||||
|
splashColor: orangeC, // inkwell color
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: Image(
|
||||||
|
image: AssetImage('assets/copy_key.png'),
|
||||||
|
height: 90)),
|
||||||
|
onTap: () {
|
||||||
|
Clipboard.setData(
|
||||||
|
ClipboardData(text: _historyProvider.pubkey));
|
||||||
|
_historyProvider.snackCopyKey(context);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 9),
|
||||||
|
const Text(
|
||||||
|
"Copier\nla clef",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
const Spacer(),
|
||||||
|
Container(
|
||||||
|
height: 120,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xff7c94b6),
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(100)),
|
||||||
|
border: Border.all(
|
||||||
|
color: const Color(0xFF6c4204),
|
||||||
|
width: 4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: ClipOval(
|
||||||
|
child: Material(
|
||||||
|
color: orangeC, // button color
|
||||||
|
child: InkWell(
|
||||||
|
key: const Key('pay'),
|
||||||
|
splashColor: yellowC, // inkwell color
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Image(
|
||||||
|
image: AssetImage('assets/vector_white.png'),
|
||||||
|
)),
|
||||||
|
onTap: () {
|
||||||
|
null;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 9),
|
||||||
|
const Text(
|
||||||
|
"Faire un\nvirement",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
SizedBox(height: isTall ? 100 : 50)
|
||||||
|
]),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
20
pubspec.yaml
|
@ -5,13 +5,16 @@ 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.3+7
|
version: 0.0.3+8
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
assorted_layout_widgets: ^5.2.1
|
||||||
bubble: ^1.2.1
|
bubble: ^1.2.1
|
||||||
|
carousel_slider: ^4.0.0
|
||||||
|
confirm_dialog: ^1.0.0
|
||||||
crypto: ^3.0.1
|
crypto: ^3.0.1
|
||||||
dubp:
|
dubp:
|
||||||
path: packages/dubp_rs
|
path: packages/dubp_rs
|
||||||
|
@ -21,6 +24,7 @@ dependencies:
|
||||||
flutter_driver:
|
flutter_driver:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_launcher_icons: ^0.9.2
|
flutter_launcher_icons: ^0.9.2
|
||||||
|
flutter_lints: ^1.0.4
|
||||||
flutter_logs: ^2.1.4
|
flutter_logs: ^2.1.4
|
||||||
flutter_svg: ^0.22.0
|
flutter_svg: ^0.22.0
|
||||||
graphql_flutter: ^5.0.0
|
graphql_flutter: ^5.0.0
|
||||||
|
@ -29,6 +33,7 @@ dependencies:
|
||||||
http: ^0.13.4
|
http: ^0.13.4
|
||||||
image_gallery_saver: ^1.6.9
|
image_gallery_saver: ^1.6.9
|
||||||
image_picker: ^0.8.4
|
image_picker: ^0.8.4
|
||||||
|
infinite_scroll_pagination: ^3.1.0
|
||||||
intl: ^0.17.0
|
intl: ^0.17.0
|
||||||
jdenticon_dart: ^2.0.0
|
jdenticon_dart: ^2.0.0
|
||||||
logger: ^1.1.0
|
logger: ^1.1.0
|
||||||
|
@ -38,7 +43,7 @@ dependencies:
|
||||||
permission_handler: 8.1.6
|
permission_handler: 8.1.6
|
||||||
pin_code_fields: ^7.3.0
|
pin_code_fields: ^7.3.0
|
||||||
printing: ^5.6.0
|
printing: ^5.6.0
|
||||||
provider: ^6.0.0
|
provider: ^6.0.1
|
||||||
qrscan: ^0.3.2
|
qrscan: ^0.3.2
|
||||||
responsive_builder: ^0.4.1
|
responsive_builder: ^0.4.1
|
||||||
responsive_framework: ^0.1.4
|
responsive_framework: ^0.1.4
|
||||||
|
@ -48,16 +53,9 @@ dependencies:
|
||||||
super_tooltip: ^1.0.1
|
super_tooltip: ^1.0.1
|
||||||
sync_http: ^0.3.0
|
sync_http: ^0.3.0
|
||||||
test: ^1.17.10
|
test: ^1.17.10
|
||||||
# test_api: ^0.4.7
|
|
||||||
# test: ^1.19.3
|
|
||||||
truncate: ^3.0.1
|
truncate: ^3.0.1
|
||||||
unorm_dart: ^0.2.0
|
unorm_dart: ^0.2.0
|
||||||
xml: ^5.3.0
|
xml: ^5.3.0
|
||||||
assorted_layout_widgets: ^5.2.1
|
|
||||||
carousel_slider: ^4.0.0
|
|
||||||
flutter_lints: ^1.0.4
|
|
||||||
confirm_dialog: ^1.0.0
|
|
||||||
infinite_scroll_pagination: ^3.1.0
|
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: "ic_launcher"
|
android: "ic_launcher"
|
||||||
|
@ -66,12 +64,12 @@ flutter_icons:
|
||||||
cupertino_icons: ^1.0.0
|
cupertino_icons: ^1.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
build_runner: ^2.1.2
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
hive_generator: ^1.1.1
|
||||||
integration_test:
|
integration_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
hive_generator: ^1.1.1
|
|
||||||
build_runner: ^2.1.2
|
|
||||||
|
|
||||||
# The following section is specific to Flutter.
|
# The following section is specific to Flutter.
|
||||||
flutter:
|
flutter:
|
||||||
|
|
|
@ -20,8 +20,8 @@ if [[ $1 == "bundle" ]]; then
|
||||||
flutter build appbundle --release --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD
|
flutter build appbundle --release --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD
|
||||||
else
|
else
|
||||||
# flutter build apk --release --split-per-abi --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD
|
# flutter build apk --release --split-per-abi --target-platform android-arm,android-arm64 --build-name $VERSION --build-number $BUILD
|
||||||
# flutter build apk --release --split-per-abi --build-name $VERSION --build-number $BUILD
|
flutter build apk --release --split-per-abi --build-name $VERSION --build-number $BUILD
|
||||||
flutter build apk --release --build-name $VERSION --build-number $BUILD
|
# flutter build apk --release --build-name $VERSION --build-number $BUILD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d $HOME/Téléchargements ]]; then
|
if [[ -d $HOME/Téléchargements ]]; then
|
||||||
|
|