so much UI changes/refacto

This commit is contained in:
poka 2022-05-21 06:47:26 +02:00
parent 81d1b7dd30
commit 3df8b44d67
44 changed files with 254 additions and 772 deletions

View File

@ -19,6 +19,8 @@
<activity
android:requestLegacyExternalStorage="true"
android:name=".MainActivity"
android:resource="@style/NormalTheme"
android:icon="@mipmap/ic_launcher"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
@ -29,16 +31,12 @@
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
<!-- <meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
android:icon="@mipmap/ic_launcher"
/> -->
<!-- Theme to apply as soon as Flutter begins rendering frames -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

View File

@ -492,4 +492,4 @@
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -155,25 +155,6 @@ class GenerateWalletsProvider with ChangeNotifier {
notifyListeners();
}
Future<durt.NewWallet?> generateWallet(String generatedMnemonic,
{required bool isImport}) async {
try {
actualWallet = await durt.Dewif().generateDewif(
generatedMnemonic, durt.randomSecretCode(pinLength),
lang: appLang);
} catch (e) {
log.e(e);
}
if (!isImport) {
mnemonicController.text = generatedMnemonic;
pin.text = actualWallet!.password;
}
// notifyListeners();
return actualWallet;
}
String changePinCode({required bool reload}) {
pin.text = durt.randomSecretCode(pinLength);
if (reload) {
@ -229,56 +210,6 @@ class GenerateWalletsProvider with ChangeNotifier {
log.d(_walletPubkey);
}
// Future<int?> importCesiumWallet() async {
// // String _walletPubkey = await DubpRust.getLegacyPublicKey(
// // salt: _cesiumID, password: _cesiumPWD);
// // String shortPubkey = truncate(_walletPubkey, 9,
// // omission: "...", position: TruncatePosition.end);
// // await storeWallet(
// // actualWallet, 'Portefeuille Cesium - $shortPubkey', context);
// // NewWallet myCesiumWallet = await DubpRust.genWalletFromDeprecatedSaltPassword(salt: _cesiumID, password: _cesiumPWD);
// cesiumID.text = '';
// cesiumPWD.text = '';
// cesiumPubkey.text = '';
// canImport = false;
// isCesiumIDVisible = false;
// isCesiumPWDVisible = false;
// int chestNumber = 0;
// chestBox.toMap().forEach((key, value) {
// if (value.isCesium!) {
// chestNumber++;
// }
// });
// String chestName;
// if (chestNumber == 0) {
// chestName = 'Coffre à Césium';
// } else {
// chestName = 'Coffre à Césium ${chestNumber + 1}';
// }
// log.d(pin.text);
// durt.NewWallet cesiumDewif =
// await durt.Dewif().generateCesiumDewif(cesiumWallet.seed, pin.text);
// ChestData cesiumChest = ChestData(
// dewif: cesiumDewif.dewif,
// name: chestName,
// imageName: 'cesium.png',
// defaultWallet: 0,
// isCesium: true);
// await chestBox.add(cesiumChest).then((value) => null);
// int? chestKey = await chestBox.toMap().keys.last;
// // chestBox.toMap().
// await configBox.put('currentChest', chestKey);
// pin.text = '';
// return chestKey;
// }
void cesiumIDisVisible() {
isCesiumIDVisible = !isCesiumIDVisible;
notifyListeners();
@ -371,25 +302,6 @@ class GenerateWalletsProvider with ChangeNotifier {
}
}
Future<bool> isSentenceValid() async {
String inputMnemonic =
'${cellController0.text} ${cellController1.text} ${cellController2.text} ${cellController3.text} ${cellController4.text} ${cellController5.text} ${cellController6.text} ${cellController7.text} ${cellController8.text} ${cellController9.text} ${cellController10.text} ${cellController11.text}';
// Needed for bad encoding of UTF-8
inputMnemonic = inputMnemonic.replaceAll('é', '');
inputMnemonic = inputMnemonic.replaceAll('è', '');
durt.NewWallet? generatedWallet =
await generateWallet(inputMnemonic, isImport: true);
if (generatedWallet == null) {
return false;
} else {
generatedMnemonic = inputMnemonic;
return true;
}
}
Future pasteMnemonic(BuildContext context) async {
final sentence = await Clipboard.getData('text/plain');
int nbr = 0;

View File

@ -26,7 +26,7 @@ class MyWalletsProvider with ChangeNotifier {
// configBox.delete('endpoint');
if (!configBox.containsKey('endpoint') || configBox.get('endpoint') == '') {
log.d('No endpoint, configure...');
configBox.put('endpoint', 'ws://192.168.1.72:9944');
configBox.put('endpoint', 'ws://127.0.0.1:9944');
}
if (chestBox.isEmpty) {

View File

@ -315,6 +315,14 @@ class SubstrateSdk with ChangeNotifier {
return await importAccount(fromMnemonic: true, derivePath: '//$number');
}
Future<bool> isMnemonicValid(String mnemonic) async {
// Needed for bad encoding of UTF-8
mnemonic = mnemonic.replaceAll('é', '');
mnemonic = mnemonic.replaceAll('è', '');
return await sdk.api.keyring.checkMnemonicValid(mnemonic);
}
}
void snack(BuildContext context, String message, {int duration = 2}) {
@ -339,8 +347,10 @@ void snackNode(BuildContext context, bool isConnected) {
_message =
"Vous êtes connecté au noeud\n${configBox.get('endpoint').split('//')[1]}";
}
final snackBar =
SnackBar(content: Text(_message), duration: const Duration(seconds: 2));
final snackBar = SnackBar(
padding: const EdgeInsets.all(20),
content: Text(_message, style: const TextStyle(fontSize: 16)),
duration: const Duration(seconds: 2));
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}

View File

@ -4,10 +4,11 @@ import 'package:fast_base58/fast_base58.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:gecko/globals.dart';
import 'package:gecko/models/chest_data.dart';
import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/providers/substrate_sdk.dart';
import 'package:image_picker/image_picker.dart';
import 'package:provider/provider.dart';
import 'package:truncate/truncate.dart';
class WalletOptionsProvider with ChangeNotifier {
@ -25,33 +26,16 @@ class WalletOptionsProvider with ChangeNotifier {
Future<NewWallet>? get badWallet => null;
int getPinLenght(_walletNbr) {
// TODOo: Get real Dewif lenght
// String _localDewif;
// if (_walletNbr is int || _walletNbr == null) {
// _localDewif = chestBox.get(configBox.get('currentChest')).dewif;
// } else {
// _localDewif = _walletNbr;
// }
// final int _pinLenght = DubpRust.getDewifSecretCodeLen(
// dewif: _localDewif, secretCodeType: SecretCodeType.letters);
return pinLength;
}
void _renameWallet(List<int?> _walletID, _newName,
void _renameWallet(List<int?> _walletID, String _newName,
{required bool isCesium}) async {
if (isCesium) {
ChestData _chestTarget = chestBox.get(_walletID[0])!;
_chestTarget.name = _newName;
await chestBox.put(_chestTarget.key, _chestTarget);
} else {
MyWalletsProvider myWalletClass = MyWalletsProvider();
MyWalletsProvider myWalletClass = MyWalletsProvider();
WalletData _walletTarget = myWalletClass.getWalletData(_walletID)!;
_walletTarget.name = _newName;
await walletBox.put(_walletTarget.key, _walletTarget);
}
WalletData _walletTarget = myWalletClass.getWalletData(_walletID)!;
_walletTarget.name = _newName;
await walletBox.put(_walletTarget.key, _walletTarget);
_newWalletName.text = '';
}
@ -124,14 +108,6 @@ class WalletOptionsProvider with ChangeNotifier {
);
}
snackCopyKey(context) {
const snackBar = SnackBar(
content:
Text("Cette clé publique a été copié dans votre presse-papier."),
duration: Duration(seconds: 2));
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}
String getShortPubkey(String pubkey) {
List<int> pubkeyByte = Base58Decode(pubkey);
Digest pubkeyS256 = sha256.convert(sha256.convert(pubkeyByte).bytes);
@ -161,10 +137,14 @@ class WalletOptionsProvider with ChangeNotifier {
if (pickedFile != null) {
_image = File(pickedFile.path);
////TODO: Store image on disk, store path in walletBox.imagePath
log.i(pickedFile.path);
return _image;
} else {
log.w('No image selected.');
return null;
}
}
@ -186,3 +166,30 @@ class WalletOptionsProvider with ChangeNotifier {
return _address;
}
}
Widget balance(BuildContext context, String address, double size) {
String balanceCache = '';
return Column(children: <Widget>[
Consumer<SubstrateSdk>(builder: (context, _sdk, _) {
return FutureBuilder(
future: _sdk.getBalance(address),
builder: (BuildContext context, AsyncSnapshot<num?> _balance) {
if (_balance.connectionState != ConnectionState.done ||
_balance.hasError) {
return Text(balanceCache,
style: TextStyle(
fontSize: isTall ? size : size * 0.9,
));
}
balanceCache = "${_balance.data.toString()} $currencyName";
return Text(
balanceCache,
style: TextStyle(
fontSize: isTall ? size : 18,
),
);
});
}),
]);
}

View File

@ -239,25 +239,6 @@ class WalletsProfilesProvider with ChangeNotifier {
return num.parse(result);
}
snackCopyKey(context) {
const snackBar = SnackBar(
padding: EdgeInsets.all(20),
content:
Text("Cette clé publique a été copié dans votre presse-papier."),
duration: Duration(seconds: 2));
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}
void switchProfileView() {
isHistoryScreen = !isHistoryScreen;
if (isHistoryScreen) {
historySwitchButtun = "Payer";
} else {
historySwitchButtun = "Voir l'historique";
}
notifyListeners();
}
String generateIdenticon(String _pubkey) {
return Jdenticon.toSvg(_pubkey);
}
@ -285,3 +266,12 @@ class WalletsProfilesProvider with ChangeNotifier {
return balance;
}
}
snackCopyKey(context) {
const snackBar = SnackBar(
padding: EdgeInsets.all(20),
content: Text("Cette clé publique a été copié dans votre presse-papier.",
style: TextStyle(fontSize: 16)),
duration: Duration(seconds: 2));
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}

View File

@ -403,7 +403,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
key: const Key('copyPubkey'),
onTap: () {
Clipboard.setData(ClipboardData(text: pubkey));
_historyProvider.snackCopyKey(context);
snackCopyKey(context);
},
child: Text(
_historyProvider.getShortPubkey(pubkey!),

View File

@ -1,410 +0,0 @@
import 'dart:async';
import 'dart:io';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/models/chest_data.dart';
import 'package:gecko/providers/chest_provider.dart';
import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/models/queries.dart';
import 'package:gecko/providers/wallet_options.dart';
import 'package:gecko/screens/history.dart';
import 'package:gecko/screens/myWallets/change_pin.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart';
import 'package:flutter/services.dart';
import 'package:qr_flutter/qr_flutter.dart';
bool _isNewNameValid = false;
class CesiumWalletOptions extends StatelessWidget {
const CesiumWalletOptions(
{Key? key, Key? keyMyWallets, required this.cesiumWallet})
: super(key: key);
final ChestData cesiumWallet;
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
WalletOptionsProvider _walletOptions =
Provider.of<WalletOptionsProvider>(context, listen: false);
ChestProvider _chestProvider =
Provider.of<ChestProvider>(context, listen: false);
WalletsProfilesProvider _historyProvider =
Provider.of<WalletsProfilesProvider>(context, listen: false);
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context, listen: false);
final String shortPubkey =
_walletOptions.getShortPubkey(_walletOptions.address.text);
if (_isNewNameValid == false) {
_walletOptions.nameController.text = cesiumWallet.name!;
} else {
cesiumWallet.name = _walletOptions.nameController.text;
}
return WillPopScope(
onWillPop: () {
_walletOptions.isEditing = false;
_walletOptions.isBalanceBlur = true;
Navigator.popUntil(
context,
ModalRoute.withName('/'),
);
return Future<bool>.value(true);
},
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
toolbarHeight: 60 * ratio,
elevation: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () {
_walletOptions.isEditing = false;
_walletOptions.isBalanceBlur = true;
Navigator.popUntil(
context,
ModalRoute.withName('/'),
);
}),
title: SizedBox(
height: 22,
child: Consumer<WalletOptionsProvider>(
builder: (context, walletProvider, _) {
return Text(_walletOptions.nameController.text);
}),
),
),
body: Builder(
builder: (ctx) => SafeArea(
child: Column(children: <Widget>[
Consumer<WalletOptionsProvider>(
builder: (context, walletProvider, _) {
return Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
yellowC,
const Color(0xfffafafa),
],
)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
const Spacer(flex: 1),
InkWell(
onTap: () async {
File newAvatar =
await (_walletOptions.changeAvatar());
cesiumWallet.imageFile = newAvatar;
_walletOptions.reloadBuild();
},
child: cesiumWallet.imageFile == null
? Image.asset(
'assets/chests/${cesiumWallet.imageName}',
width: 110,
)
: Image.file(cesiumWallet.imageFile!, width: 110),
),
InkWell(
onTap: () async {
File newAvatar =
await (_walletOptions.changeAvatar());
cesiumWallet.imageFile = newAvatar;
_walletOptions.reloadBuild();
},
child: Column(children: <Widget>[
Image.asset(
'assets/walletOptions/camera.png',
height: 40,
),
const SizedBox(height: 80)
])),
const Spacer(flex: 1),
Column(children: <Widget>[
SizedBox(
width: 260,
child: TextField(
key: const Key('walletName'),
autofocus: false,
focusNode: _walletOptions.walletNameFocus,
enabled: _walletOptions.isEditing,
controller: _walletOptions.nameController,
minLines: 1,
maxLines: 3,
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,
)),
),
SizedBox(height: isTall ? 5 : 0),
Query(
options: QueryOptions(
document: gql(getBalance),
variables: {
'pubkey': _walletOptions.address.text,
},
// pollInterval: Duration(seconds: 1),
),
builder: (QueryResult result,
{VoidCallback? refetch, FetchMore? fetchMore}) {
if (result.hasException) {
return Text(result.exception.toString());
}
if (result.isLoading) {
return const Text('Loading');
}
// List repositories = result.data['viewer']['repositories']['nodes'];
String wBalanceUD;
if (result.data!['balance'] == null) {
wBalanceUD = '0.0';
} else {
int wBalanceG1 =
result.data!['balance']['amount'];
int currentUD =
result.data!['currentUd']['amount'];
double wBalanceUDBrut =
wBalanceG1 / currentUD; // .toString();
wBalanceUD = double.parse(
(wBalanceUDBrut).toStringAsFixed(2))
.toString();
}
return Row(children: <Widget>[
ImageFiltered(
imageFilter: ImageFilter.blur(
sigmaX: _walletOptions.isBalanceBlur
? 6
: 0.001,
sigmaY: _walletOptions.isBalanceBlur
? 5
: 0.001),
child: Text(wBalanceUD,
style: TextStyle(
fontSize: isTall ? 20 : 18,
color: Colors.black)),
),
Text(' DU',
style: TextStyle(
fontSize: isTall ? 20 : 18,
color: Colors.black))
]);
// Text(
// '$wBalanceUD DU',
// style: TextStyle(
// fontSize: 20, color: Colors.black),
// );
},
),
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',
height: 35,
),
),
]),
Column(children: <Widget>[
InkWell(
key: const Key('renameWallet'),
onTap: () async {
_isNewNameValid = _walletOptions.editWalletName(
[cesiumWallet.key, 0],
isCesium: cesiumWallet.isCesium);
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,
)
]),
const Spacer(flex: 3),
]),
);
}),
SizedBox(height: 4 * ratio),
QrImageWidget(
data: _walletOptions.address.text,
version: QrVersions.auto,
size: isTall ? 300 : 270,
),
SizedBox(height: 15 * ratio),
GestureDetector(
key: const Key('copyPubkey'),
onTap: () {
Clipboard.setData(
ClipboardData(text: _walletOptions.address.text));
_walletOptions.snackCopyKey(ctx);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 30),
Image.asset(
'assets/walletOptions/key.png',
height: 45,
),
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.address.text));
_walletOptions.snackCopyKey(ctx);
},
child: Row(children: <Widget>[
Image.asset(
'assets/walletOptions/copy-white.png',
height: 25,
),
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.nPage = 1;
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return HistoryScreen(
pubkey: _walletOptions.address.text);
}),
);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 30),
Image.asset(
'assets/walletOptions/clock.png',
height: 45,
),
const SizedBox(width: 22),
const Text('Historique des transactions',
style:
TextStyle(fontSize: 20, color: Colors.black)),
]))),
SizedBox(height: 7 * ratio),
InkWell(
key: const Key('changePin'),
onTap: () async {
// await _chestProvider.changePin(context, cesiumWallet);
String? newPin = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return ChangePinScreen(
walletName: cesiumWallet.name,
walletProvider: _myWalletProvider,
);
},
),
);
if (newPin != null) _myWalletProvider.pinCode = newPin;
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 31),
Image.asset(
'assets/chests/secret_code.png',
height: 24,
),
const SizedBox(width: 20),
const Text('Changer mon code secret',
style: TextStyle(fontSize: 20, color: Colors.black)),
]),
),
),
SizedBox(height: 7 * ratio),
InkWell(
key: const Key('deleteWallet'),
onTap: () async {
await _chestProvider.deleteChest(context, cesiumWallet);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 33),
Image.asset(
'assets/walletOptions/trash.png',
height: 45,
),
const SizedBox(width: 21),
const Text(
'Supprimer ce coffre',
style: TextStyle(
fontSize: 20,
color: Color(0xffD80000),
),
),
]),
),
),
]),
),
),
),
);
}
}

View File

@ -1,4 +1,3 @@
import 'package:durt/durt.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
@ -127,11 +126,6 @@ class GenerateFastChestScreen extends StatelessWidget {
? () async {
_generateWalletProvider.nbrWord =
_generateWalletProvider.getRandomInt();
_generateWalletProvider.actualWallet = await Dewif()
.generateDewif(
_generateWalletProvider.generatedMnemonic!,
_generateWalletProvider.pin.text,
lang: appLang);
await Navigator.push(
context,
MaterialPageRoute(builder: (context) {

View File

@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:flutter/material.dart';
import 'package:gecko/providers/generate_wallets.dart';
import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/onBoarding/11.dart';
import 'package:provider/provider.dart';
@ -15,14 +16,19 @@ class RestoreChest extends StatelessWidget {
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
GenerateWalletsProvider generateWalletProvider =
GenerateWalletsProvider genW =
Provider.of<GenerateWalletsProvider>(context, listen: false);
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
generateWalletProvider.actualWallet = null;
genW.actualWallet = null;
if (genW.isSentenceComplete(context)) {
genW.generatedMnemonic =
'${genW.cellController0.text} ${genW.cellController1.text} ${genW.cellController2.text} ${genW.cellController3.text} ${genW.cellController4.text} ${genW.cellController5.text} ${genW.cellController6.text} ${genW.cellController7.text} ${genW.cellController8.text} ${genW.cellController9.text} ${genW.cellController10.text} ${genW.cellController11.text}';
}
return WillPopScope(
onWillPop: () {
generateWalletProvider.resetImportView();
genW.resetImportView();
return Future<bool>.value(true);
},
child: Scaffold(
@ -31,7 +37,7 @@ class RestoreChest extends StatelessWidget {
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.black),
onPressed: () {
generateWalletProvider.resetImportView();
genW.resetImportView();
Navigator.of(context).pop();
}),
title: const SizedBox(
@ -48,32 +54,32 @@ class RestoreChest extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
arrayCell(context, generateWalletProvider.cellController0),
arrayCell(context, generateWalletProvider.cellController1),
arrayCell(context, generateWalletProvider.cellController2),
arrayCell(context, generateWalletProvider.cellController3),
arrayCell(context, genW.cellController0),
arrayCell(context, genW.cellController1),
arrayCell(context, genW.cellController2),
arrayCell(context, genW.cellController3),
]),
const SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
arrayCell(context, generateWalletProvider.cellController4),
arrayCell(context, generateWalletProvider.cellController5),
arrayCell(context, generateWalletProvider.cellController6),
arrayCell(context, generateWalletProvider.cellController7),
arrayCell(context, genW.cellController4),
arrayCell(context, genW.cellController5),
arrayCell(context, genW.cellController6),
arrayCell(context, genW.cellController7),
]),
const SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
arrayCell(context, generateWalletProvider.cellController8),
arrayCell(context, generateWalletProvider.cellController9),
arrayCell(context, generateWalletProvider.cellController10),
arrayCell(context, generateWalletProvider.cellController11),
arrayCell(context, genW.cellController8),
arrayCell(context, genW.cellController9),
arrayCell(context, genW.cellController10),
arrayCell(context, genW.cellController11),
]),
]),
// const Spacer(),
if (generateWalletProvider.isSentenceComplete(context))
if (genW.isSentenceComplete(context))
Expanded(
child: Align(
alignment: Alignment.center,
@ -87,8 +93,8 @@ class RestoreChest extends StatelessWidget {
onPrimary: Colors.white, // foreground
),
onPressed: () async {
if (await generateWalletProvider.isSentenceValid()) {
generateWalletProvider.resetImportView();
if (await _sub.isMnemonicValid(genW.generatedMnemonic!)) {
genW.resetImportView();
await Navigator.push(
context,
FaderTransition(
@ -121,7 +127,7 @@ class RestoreChest extends StatelessWidget {
onPrimary: Colors.black, // foreground
),
onPressed: () {
generateWalletProvider.pasteMnemonic(context);
genW.pasteMnemonic(context);
},
child: const Text(
'Coller depuis le\npresse-papier',
@ -193,7 +199,7 @@ class RestoreChest extends StatelessWidget {
return AlertDialog(
title: const Text('Phrase incorrecte'),
content: const Text(
'Votre phrase de restauration semble incorrecte, veuillez la corriger.'),
'Votre phrase de restauration semble incorrecte, les mots ne sont pas dans le bon ordre.\nVeuillez la corriger.'),
actions: <Widget>[
TextButton(
child: const Text("OK"),

View File

@ -8,7 +8,6 @@ import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/providers/wallet_options.dart';
import 'package:flutter/material.dart';
import 'package:gecko/screens/myWallets/cesium_wallet_options.dart';
import 'package:gecko/screens/myWallets/choose_chest.dart';
import 'package:gecko/screens/myWallets/choose_wallet.dart';
import 'package:gecko/screens/myWallets/wallets_home.dart';
@ -214,20 +213,12 @@ class UnlockingWallet extends StatelessWidget {
} else {
pinColor = Colors.green[400];
if (action == "mywallets") {
currentChest.isCesium!
? Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return CesiumWalletOptions(
cesiumWallet: currentChest);
}),
).then((value) => _myWalletProvider.mnemonic = '')
: Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const WalletsHome();
}),
);
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const WalletsHome();
}),
);
} else if (action == "pay") {
Navigator.push(
context,

View File

@ -1,11 +1,8 @@
import 'dart:async';
import 'dart:io';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/providers/substrate_sdk.dart';
import 'package:gecko/providers/wallet_options.dart';
import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/screens/history.dart';
@ -92,13 +89,13 @@ class WalletOptions extends StatelessWidget {
Column(children: <Widget>[
walletName(walletProvider, _walletOptions),
SizedBox(height: isTall ? 5 : 0),
balance(context, walletProvider),
balance(context, walletProvider.address.text, 20),
]),
const Spacer(flex: 3),
]),
);
}),
SizedBox(height: 4 * ratio),
SizedBox(height: 10 * ratio),
QrImageWidget(
data: _walletOptions.address.text,
version: QrVersions.auto,
@ -132,8 +129,10 @@ class WalletOptions extends StatelessWidget {
children: <Widget>[
InkWell(
onTap: () async {
File newAvatar = await (walletProvider.changeAvatar());
wallet.imageFile = newAvatar;
wallet.imageFile = await (walletProvider.changeAvatar());
if (wallet.imageFile != null) {
walletBox.put(wallet.key, wallet);
}
walletProvider.reloadBuild();
},
child: wallet.imageFile == null
@ -151,8 +150,7 @@ class WalletOptions extends StatelessWidget {
top: 0,
child: InkWell(
onTap: () async {
File newAvatar = await (walletProvider.changeAvatar());
wallet.imageFile = newAvatar;
wallet.imageFile = await (walletProvider.changeAvatar());
walletProvider.reloadBuild();
},
child: Image.asset(
@ -223,52 +221,6 @@ class WalletOptions extends StatelessWidget {
);
}
Widget balance(BuildContext context, WalletOptionsProvider walletProvider) {
String balanceCache = '';
return Column(children: <Widget>[
Consumer<SubstrateSdk>(builder: (context, _sdk, _) {
return FutureBuilder(
future: _sdk.getBalance(walletProvider.address.text),
builder: (BuildContext context, AsyncSnapshot<num?> _balance) {
if (_balance.connectionState != ConnectionState.done ||
_balance.hasError) {
return Text(balanceCache,
style: TextStyle(
fontSize: isTall ? 20 : 18,
));
}
balanceCache = "${_balance.data.toString()} $currencyName";
return ImageFiltered(
imageFilter: ImageFilter.blur(
sigmaX: walletProvider.isBalanceBlur ? 6 : 0,
sigmaY: walletProvider.isBalanceBlur ? 5 : 0),
child: Text(
balanceCache,
style: TextStyle(
fontSize: isTall ? 20 : 18,
),
),
);
});
}),
const SizedBox(height: 15),
// InkWell(
// key: const Key('displayBalance'),
// onTap: () {
// walletProvider.bluringBalance();
// },
// child: Image.asset(
// walletProvider.isBalanceBlur
// ? 'assets/walletOptions/icon_oeuil.png'
// : 'assets/walletOptions/icon_oeuil_close.png',
// height: 35,
// ),
// ),
]);
}
Widget pubkeyWidget(WalletOptionsProvider walletProvider, BuildContext ctx) {
final String shortPubkey =
walletProvider.getShortPubkey(walletProvider.address.text);
@ -276,7 +228,7 @@ class WalletOptions extends StatelessWidget {
key: const Key('copyPubkey'),
onTap: () {
Clipboard.setData(ClipboardData(text: walletProvider.address.text));
walletProvider.snackCopyKey(ctx);
snackCopyKey(ctx);
},
child: SizedBox(
height: 50,
@ -313,7 +265,7 @@ class WalletOptions extends StatelessWidget {
onPressed: () {
Clipboard.setData(
ClipboardData(text: walletProvider.address.text));
walletProvider.snackCopyKey(ctx);
snackCopyKey(ctx);
},
child: Row(children: <Widget>[
Image.asset(

View File

@ -18,20 +18,30 @@ class OnboardingStepOne extends StatelessWidget {
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
CommonElements common = CommonElements();
////TODO: Continue onbarding refactoring
return Scaffold(
appBar: AppBar(
toolbarHeight: 60 * ratio,
title: const SizedBox(
height: 22,
child: Text(
'Nouveau portefeuille',
style: TextStyle(fontWeight: FontWeight.w600),
),
),
),
extendBodyBehindAppBar: true,
body: SafeArea(
child: Column(children: <Widget>[
common.onboardingProgressBar(
context, 'Nouveau portefeuilles', progress),
common.bubbleSpeak(
"Il semblerait que vous nayez pas encore de coffre.\n\nUn coffre vous permet de gérer un ou plusieurs portefeuilles.",
textKey: const Key('step1')),
// common.onboardingProgressBar(
// context, 'Nouveau portefeuilles', progress),
// common.bubbleSpeak(
// "Il semblerait que vous nayez pas encore de coffre.\n\nUn coffre vous permet de gérer un ou plusieurs portefeuilles.",
// textKey: const Key('step1')),
const SizedBox(height: 90),
Image.asset(
'assets/onBoarding/keys-and-wallets-horizontal.png',
'assets/onBoarding/fabrication-de-portefeuille.png',
height: 200,
),
Expanded(

View File

@ -3,6 +3,7 @@ import 'package:gecko/globals.dart';
import 'package:flutter/material.dart';
import 'package:gecko/providers/cesium_plus.dart';
import 'package:gecko/models/g1_wallets_list.dart';
import 'package:gecko/providers/wallet_options.dart';
import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/providers/search.dart';
import 'package:gecko/screens/wallet_view.dart';
@ -133,6 +134,11 @@ class SearchResultScreen extends StatelessWidget {
fontWeight: FontWeight.w500),
textAlign: TextAlign.center),
]),
trailing: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
balance(context, g1Wallet.pubkey!, 16)
]),
subtitle: Row(children: <Widget>[
Text(g1Wallet.id?.username ?? '',
style: const TextStyle(

View File

@ -2,15 +2,12 @@ import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:flutter/material.dart';
import 'package:gecko/providers/cesium_plus.dart';
import 'package:gecko/providers/wallet_options.dart';
import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/models/queries.dart';
import 'package:gecko/screens/avatar_fullscreen.dart';
import 'package:gecko/screens/common_elements.dart';
import 'package:gecko/screens/history.dart';
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart';
class WalletViewScreen extends StatelessWidget {
@ -53,7 +50,8 @@ class WalletViewScreen extends StatelessWidget {
height: buttonSize,
child: ClipOval(
child: Material(
color: const Color(0xffFFD58D), // button color
color: Colors
.grey[300], //const Color(0xffFFD58D), // button color
child: InkWell(
key: const Key('viewHistory'),
splashColor: orangeC, // inkwell color
@ -64,19 +62,20 @@ class WalletViewScreen extends StatelessWidget {
'assets/walletOptions/clock.png'),
height: 90)),
onTap: () {
_historyProvider.nPage = 1;
Navigator.push(
context,
FaderTransition(
page: HistoryScreen(
pubkey: pubkey,
username: username ??
g1WalletsBox.get(pubkey)?.username,
avatar: avatar ??
g1WalletsBox.get(pubkey)?.avatar,
),
isFast: false),
);
////TODO: wait for subsquid indexer
// _historyProvider.nPage = 1;
// Navigator.push(
// context,
// FaderTransition(
// page: HistoryScreen(
// pubkey: pubkey,
// username: username ??
// g1WalletsBox.get(pubkey)?.username,
// avatar: avatar ??
// g1WalletsBox.get(pubkey)?.avatar,
// ),
// isFast: false),
// );
}),
),
),
@ -105,7 +104,7 @@ class WalletViewScreen extends StatelessWidget {
height: 90)),
onTap: () {
Clipboard.setData(ClipboardData(text: pubkey));
_historyProvider.snackCopyKey(context);
snackCopyKey(context);
}),
),
),
@ -286,21 +285,21 @@ class WalletViewScreen extends StatelessWidget {
primary: orangeC, // background
onPrimary: Colors.white, // foreground
),
onPressed:
_walletViewProvider.payAmount.text != ''
? () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return UnlockingWallet(
wallet: defaultWallet,
action: "pay");
},
),
);
}
: null,
onPressed: _walletViewProvider.payAmount.text !=
''
? () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return UnlockingWallet(
wallet: defaultWallet,
action: "pay");
},
),
);
}
: null,
child: const Text(
'Effectuer le virement',
style: TextStyle(
@ -352,7 +351,7 @@ class WalletViewScreen extends StatelessWidget {
key: const Key('copyPubkey'),
onTap: () {
Clipboard.setData(ClipboardData(text: pubkey));
_historyProvider.snackCopyKey(context);
snackCopyKey(context);
},
child: Text(
_historyProvider.getShortPubkey(pubkey!),
@ -363,40 +362,45 @@ class WalletViewScreen extends StatelessWidget {
),
),
]),
const SizedBox(height: 10),
if (username == null &&
g1WalletsBox.get(pubkey)?.username == null)
Query(
options: QueryOptions(
document: gql(getId),
variables: {
'pubkey': pubkey,
},
),
builder: (QueryResult result,
{VoidCallback? refetch, FetchMore? fetchMore}) {
if (result.isLoading || result.hasException) {
return const Text('...');
} else if (result.data!['idty'] == null ||
result.data!['idty']['username'] == null) {
g1WalletsBox.get(pubkey)?.username = '';
return const Text('');
} else {
g1WalletsBox.get(pubkey)?.username =
result.data!['idty']['username'] ?? '';
return SizedBox(
width: 230,
child: Text(
result.data!['idty']['username'] ?? '',
style: const TextStyle(
fontSize: 27,
color: Color(0xff814C00),
),
),
);
}
},
),
const SizedBox(height: 25),
Consumer<WalletOptionsProvider>(
builder: (context, walletProvider, _) {
return balance(context, pubkey!, 20);
}),
////
// if (username == null &&
// g1WalletsBox.get(pubkey)?.username == null)
// Query(
// options: QueryOptions(
// document: gql(getId),
// variables: {
// 'pubkey': pubkey,
// },
// ),
// builder: (QueryResult result,
// {VoidCallback? refetch, FetchMore? fetchMore}) {
// if (result.isLoading || result.hasException) {
// return const Text('...');
// } else if (result.data!['idty'] == null ||
// result.data!['idty']['username'] == null) {
// g1WalletsBox.get(pubkey)?.username = '';
// return const Text('');
// } else {
// g1WalletsBox.get(pubkey)?.username =
// result.data!['idty']['username'] ?? '';
// return SizedBox(
// width: 230,
// child: Text(
// result.data!['idty']['username'] ?? '',
// style: const TextStyle(
// fontSize: 27,
// color: Color(0xff814C00),
// ),
// ),
// );
// }
// },
// ),
if (username == null &&
g1WalletsBox.get(pubkey)?.username != null)
SizedBox(
@ -421,19 +425,20 @@ class WalletViewScreen extends StatelessWidget {
),
),
const SizedBox(height: 25),
FutureBuilder(
future: _cesiumPlusProvider.getName(pubkey),
initialData: '...',
builder: (context, snapshot) {
return SizedBox(
width: 230,
child: Text(
snapshot.data.toString(),
style: const TextStyle(
fontSize: 18, color: Colors.black),
),
);
}),
//// To get Cs+ name
// FutureBuilder(
// future: _cesiumPlusProvider.getName(pubkey),
// initialData: '...',
// builder: (context, snapshot) {
// return SizedBox(
// width: 230,
// child: Text(
// snapshot.data.toString(),
// style: const TextStyle(
// fontSize: 18, color: Colors.black),
// ),
// );
// }),
const SizedBox(height: 30),
]),
const Spacer(),

View File

@ -8,13 +8,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "40.0.0"
aes_ecb_pkcs5_flutter:
dependency: transitive
description:
name: aes_ecb_pkcs5_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
analyzer:
dependency: transitive
description:
@ -349,6 +342,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_aes_ecb_pkcs5:
dependency: transitive
description:
name: flutter_aes_ecb_pkcs5
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
flutter_driver:
dependency: "direct main"
description: flutter
@ -368,13 +368,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.4.3+7"
flutter_launcher_icons_maker:
dependency: "direct dev"
description:
name: flutter_launcher_icons_maker
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.2"
flutter_lints:
dependency: "direct main"
description:
@ -566,7 +559,7 @@ packages:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
version: "4.0.1"
http_server:
dependency: transitive
description:
@ -574,6 +567,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
icons_launcher:
dependency: "direct dev"
description:
name: icons_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
image:
dependency: transitive
description:
@ -615,7 +615,7 @@ packages:
name: image_picker_ios
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.5+4"
version: "0.8.5+5"
image_picker_platform_interface:
dependency: transitive
description:
@ -914,7 +914,7 @@ packages:
name: pdf
url: "https://pub.dartlang.org"
source: hosted
version: "3.8.0"
version: "3.8.1"
permission_handler:
dependency: "direct main"
description:
@ -976,7 +976,7 @@ packages:
description:
path: "."
ref: fixAndroidActivityVersion
resolved-ref: db17df1a7e421066dd88a16ed46c5cc945b77f82
resolved-ref: e33351cde5ea9b55d191772fe3b36f9dbb8277e6
url: "https://github.com/poka-IT/sdk.git"
source: git
version: "0.4.5"
@ -992,7 +992,7 @@ packages:
description:
path: printing
ref: HEAD
resolved-ref: "726aab13746a4f515601febfb0824ba71dbe4f80"
resolved-ref: "95bbc1f33b7cb45f7a4b98088b96bc541fefc495"
url: "https://github.com/DavBfr/dart_pdf.git"
source: git
version: "5.9.1"
@ -1069,7 +1069,7 @@ packages:
name: responsive_framework
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.8"
version: "0.1.9"
rxdart:
dependency: transitive
description:
@ -1306,6 +1306,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
universal_io:
dependency: transitive
description:
name: universal_io
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
unorm_dart:
dependency: "direct main"
description:
@ -1361,7 +1368,7 @@ packages:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.1.0"
webview_flutter:
dependency: transitive
description:

View File

@ -81,7 +81,9 @@ dependencies:
ref: fixAndroidActivityVersion
dev_dependencies:
flutter_launcher_icons_maker: ^0.10.2
# flutter_launcher_icons: ^0.9.2
# flutter_launcher_icons_maker: ^^0.10.2
icons_launcher: ^1.1.8
build_runner: ^2.1.2
flutter_test:
sdk: flutter
@ -95,6 +97,8 @@ flutter_icons:
image_path: "assets/icon/gecko_flat.png"
remove_alpha_ios: true
uses-material-design: true
# The following section is specific to Flutter.
flutter:
uses-material-design: true

View File

@ -19,7 +19,7 @@ cargo make
# Build APK
echo "Build APK..."
flutter clean
#flutter clean
flutter build apk --release --build-name $VERSION --build-number $BUILD
# Create artifacts folder

View File

@ -1,5 +1,5 @@
#!/bin/bash
flutter pub run flutter_launcher_icons_maker:main
flutter pub run icons_launcher:main
exit 0