diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 101936c..73c3d1d 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -11,7 +11,7 @@
+ android:label="Ğecko">
{
int currentIndex = 0;
Widget currentScreen;
+ String appName;
+ String version;
+ String buildNumber;
+
+ void initState() {
+ super.initState();
+ getAppVersion();
+ }
void onTabTapped(int index) {
setState(() {
@@ -25,11 +34,68 @@ class HomeScreenState extends State {
});
}
- Uint8List bytes = Uint8List(0);
-
@override
Widget build(BuildContext context) {
return Scaffold(
+ drawer: Drawer(
+ child: Column(
+ children: [
+ Expanded(
+ child: ListView(padding: EdgeInsets.zero, children: [
+ DrawerHeader(
+ child: Column(children: [
+ SizedBox(height: 0),
+ Image(
+ image: AssetImage('assets/icon/gecko_final.png'),
+ height: 130),
+ ]),
+ decoration: BoxDecoration(
+ color: Color(0xffD28928),
+ ),
+ ),
+ ListTile(
+ title: Text('Paramètres'),
+ onTap: () {
+ Navigator.pop(context);
+ Navigator.push(
+ context,
+ MaterialPageRoute(builder: (context) {
+ return SettingsScreen();
+ }),
+ );
+ },
+ ),
+ ListTile(
+ title: Text('A propos'),
+ onTap: () {
+ // Update the state of the app.
+ // ...
+ },
+ ),
+ ])),
+ Container(
+ child: Align(
+ alignment: FractionalOffset.bottomCenter,
+ child: Text('Ğecko v${this.version}+${this.buildNumber}'))),
+ SizedBox(height: 20)
+ ],
+ ),
+ ),
+ appBar: AppBar(
+ leading: Builder(
+ builder: (context) => IconButton(
+ icon: new Icon(Icons.menu, color: Colors.grey[850]),
+ onPressed: () => Scaffold.of(context).openDrawer(),
+ )),
+ title: Text('Ğecko', style: TextStyle(color: Colors.grey[850])),
+ actions: [
+ Padding(
+ padding: EdgeInsets.symmetric(horizontal: 16),
+ child: Icon(Icons.search, color: Colors.grey[850]),
+ ),
+ ],
+ backgroundColor: Color(0xffFFD58D),
+ ),
backgroundColor: Color(0xffF9F9F1),
body: SafeArea(
child: IndexedStack(
@@ -43,8 +109,8 @@ class HomeScreenState extends State {
),
),
bottomNavigationBar: BottomNavigationBar(
- backgroundColor: Color(0xffFFD68E),
- fixedColor: Color(0xff855F2D),
+ backgroundColor: Color(0xffFFD58D),
+ fixedColor: Colors.grey[850],
unselectedItemColor: Color(0xffBD935C),
type: BottomNavigationBarType.fixed,
onTap: onTabTapped,
@@ -63,4 +129,14 @@ class HomeScreenState extends State {
),
);
}
+
+ Future getAppVersion() async {
+ PackageInfo packageInfo = await PackageInfo.fromPlatform();
+ this.appName = packageInfo.appName;
+ this.version = packageInfo.version;
+ this.buildNumber = packageInfo.buildNumber;
+ print(this.appName);
+
+ setState(() {});
+ }
}
diff --git a/lib/ui/myWallets/changePin.dart b/lib/ui/myWallets/changePin.dart
index 43d65ef..a132c40 100644
--- a/lib/ui/myWallets/changePin.dart
+++ b/lib/ui/myWallets/changePin.dart
@@ -36,7 +36,7 @@ class ChangePinScreenState extends State {
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: SizedBox(
- height: 25,
+ height: 22,
child: Text(widget.walletName),
)),
body: Center(
@@ -44,7 +44,7 @@ class ChangePinScreenState extends State {
child: Column(children: [
SizedBox(height: 80),
Text(
- 'Veuillez tapper votre code secret pour en générer un nouveau :',
+ 'Choisissez un code secret autogénéré :',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 17.0,
diff --git a/lib/ui/myWallets/confirmWalletStorage.dart b/lib/ui/myWallets/confirmWalletStorage.dart
index 9d34b4c..8bbf99a 100644
--- a/lib/ui/myWallets/confirmWalletStorage.dart
+++ b/lib/ui/myWallets/confirmWalletStorage.dart
@@ -53,7 +53,7 @@ class ConfirmStoreWalletState extends State {
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: SizedBox(
- height: 25,
+ height: 22,
child: Text('Confirmez ce portefeuille'),
)),
body: Center(
diff --git a/lib/ui/myWallets/generateWalletsScreen.dart b/lib/ui/myWallets/generateWalletsScreen.dart
index 44cc3dd..9f1c75e 100644
--- a/lib/ui/myWallets/generateWalletsScreen.dart
+++ b/lib/ui/myWallets/generateWalletsScreen.dart
@@ -39,7 +39,7 @@ class GenerateWalletsState extends State {
return Scaffold(
appBar: AppBar(
title: SizedBox(
- height: 25,
+ height: 22,
child: Text('Générer un portefeuille'),
)),
floatingActionButton: Container(
@@ -54,7 +54,10 @@ class GenerateWalletsState extends State {
// onTabTapped(0);
// }
child: Container(
- height: 40.0, width: 40.0, child: Icon(Icons.replay)),
+ height: 40.0,
+ width: 40.0,
+ child: Icon(Icons.replay, color: Colors.grey[850]),
+ ),
backgroundColor: Color(
0xffEFEFBF), //Color(0xffFFD68E), //Color.fromARGB(500, 204, 255, 255),
))),
diff --git a/lib/ui/myWallets/walletOptions.dart b/lib/ui/myWallets/walletOptions.dart
index 9d2083c..d4f434c 100644
--- a/lib/ui/myWallets/walletOptions.dart
+++ b/lib/ui/myWallets/walletOptions.dart
@@ -22,6 +22,7 @@ class WalletOptionsState extends State {
Directory appPath;
TextEditingController _pubkey = new TextEditingController();
TextEditingController _enterPin = new TextEditingController();
+ TextEditingController _newWalletName = new TextEditingController();
final formKey = GlobalKey();
bool hasError = false;
String validPin = 'NO PIN';
@@ -44,7 +45,7 @@ class WalletOptionsState extends State {
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: SizedBox(
- height: 25,
+ height: 22,
child: Text(widget.walletName),
)),
body: Center(
@@ -83,18 +84,11 @@ class WalletOptionsState extends State {
0xffFFD68E), //Color(0xffFFD68E), // background
onPrimary: Colors.black, // foreground
),
- onPressed: () {
- // changePin(widget.walletName, this.walletPin);
- Navigator.push(
- context,
- MaterialPageRoute(builder: (context) {
- return ChangePinScreen(
- walletName: widget.walletName,
- oldPin: this.walletPin);
+ onPressed: () =>
+ _renameWalletAlerte().then((_) {
+ setState(() {});
}),
- );
- },
- child: Text('Changer mon code secret',
+ child: Text('Renommer ce portefeuille',
style: TextStyle(fontSize: 20)))))),
SizedBox(height: 30),
SizedBox(
@@ -102,13 +96,37 @@ class WalletOptionsState extends State {
width: 300,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
- elevation: 6,
- primary:
- Colors.red, //Color(0xffFFD68E), // background
+ elevation: 5,
+ primary: Color(
+ 0xffFFD68E), //Color(0xffFFD68E), // background
onPrimary: Colors.black, // foreground
),
onPressed: () {
- deleteWallet(widget.walletName);
+ // changePin(widget.walletName, this.walletPin);
+ Navigator.push(
+ context,
+ MaterialPageRoute(builder: (context) {
+ return ChangePinScreen(
+ walletName: widget.walletName,
+ oldPin: this.walletPin);
+ }),
+ );
+ },
+ child: Text('Changer mon code secret',
+ style: TextStyle(fontSize: 20)))),
+ SizedBox(height: 30),
+ SizedBox(
+ height: 50,
+ width: 300,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ elevation: 6,
+ primary: Colors
+ .redAccent, //Color(0xffFFD68E), // background
+ onPrimary: Colors.black, // foreground
+ ),
+ onPressed: () {
+ _deleteWallet(widget.walletName);
},
child: Text('Supprimer ce portefeuille',
style: TextStyle(fontSize: 20)))),
@@ -185,7 +203,7 @@ class WalletOptionsState extends State {
onCompleted: (_pin) async {
print("Completed");
final resultWallet =
- await readLocalWallet(_pin.toUpperCase());
+ await _readLocalWallet(_pin.toUpperCase());
if (resultWallet == 'bad') {
errorController.add(ErrorAnimationType
.shake); // Triggering error shake animation
@@ -216,7 +234,7 @@ class WalletOptionsState extends State {
]))));
}
- Future getPubkeyFromDewif(_dewif, _pin) async {
+ Future _getPubkeyFromDewif(_dewif, _pin) async {
String _pubkey;
RegExp regExp = new RegExp(
r'^[A-Z0-9]+$',
@@ -250,14 +268,14 @@ class WalletOptionsState extends State {
}
}
- Future readLocalWallet(String _pin) async {
+ Future _readLocalWallet(String _pin) async {
// print(pin);
try {
final file = await _localWallet(widget.walletName);
String _localDewif = await file.readAsString();
String _localPubkey;
- if ((_localPubkey = await getPubkeyFromDewif(_localDewif, _pin)) !=
+ if ((_localPubkey = await _getPubkeyFromDewif(_localDewif, _pin)) !=
'false') {
setState(() {
this._pubkey.text = _localPubkey;
@@ -276,7 +294,54 @@ class WalletOptionsState extends State {
}
}
- Future deleteWallet(_name) async {
+ Future _renameWallet(_newName) async {
+ final appPath = await _localPath;
+ final _walletFile = Directory('$appPath/wallets/${widget.walletName}');
+
+ try {
+ _walletFile.rename('$appPath/wallets/$_newName');
+ } catch (e) {
+ print('ERREUR lors du renommage du wallet: $e');
+ }
+ }
+
+ Future _renameWalletAlerte() async {
+ return showDialog(
+ context: context,
+ barrierDismissible: true, // user must tap button!
+ builder: (BuildContext context) {
+ return AlertDialog(
+ title: Text('Choisissez un nouveau nom pour ce portefeuille'),
+ content: SingleChildScrollView(
+ child: ListBody(
+ children: [
+ TextField(
+ controller: this._newWalletName,
+ maxLines: 1,
+ textAlign: TextAlign.center,
+ decoration: InputDecoration(),
+ style: TextStyle(
+ fontSize: 14.0,
+ color: Colors.black,
+ fontWeight: FontWeight.bold)),
+ ],
+ ),
+ ),
+ actions: [
+ TextButton(
+ child: Text("Valider"),
+ onPressed: () {
+ _renameWallet(this._newWalletName.text);
+ Navigator.pop(context, true);
+ },
+ ),
+ ],
+ );
+ },
+ );
+ }
+
+ Future _deleteWallet(_name) async {
try {
final appPath = await _localPath;
final _walletFile = Directory('$appPath/wallets/$_name');
diff --git a/lib/ui/myWallets/walletsHome.dart b/lib/ui/myWallets/walletsHome.dart
index d2feac2..1c415b2 100644
--- a/lib/ui/myWallets/walletsHome.dart
+++ b/lib/ui/myWallets/walletsHome.dart
@@ -63,7 +63,8 @@ class WalletsHomeState extends State {
child: Container(
height: 40.0,
width: 40.0,
- child: Icon(Icons.person_add_alt_1_rounded)),
+ child: Icon(Icons.person_add_alt_1_rounded,
+ color: Colors.grey[850])),
backgroundColor: Color(0xffEFEFBF))))),
body: SafeArea(
child: Column(children: [
diff --git a/lib/ui/settingsScreen.dart b/lib/ui/settingsScreen.dart
new file mode 100644
index 0000000..39cd682
--- /dev/null
+++ b/lib/ui/settingsScreen.dart
@@ -0,0 +1,116 @@
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:dubp/dubp.dart';
+import 'dart:io';
+import 'dart:async';
+import 'package:path_provider/path_provider.dart';
+
+class SettingsScreen extends StatefulWidget {
+ const SettingsScreen({Key keyGenWallet}) : super(key: keyGenWallet);
+ @override
+ _SettingsScreenState createState() => _SettingsScreenState();
+}
+
+class _SettingsScreenState extends State {
+ void initState() {
+ super.initState();
+ }
+
+ String generatedMnemonic;
+ bool walletIsGenerated = false;
+ NewWallet actualWallet;
+ String newWalletName;
+
+ bool hasError = false;
+ String validPin = 'NO PIN';
+ String currentText = "";
+ var pinColor = Colors.grey[300];
+ Directory appPath;
+
+ @override
+ Widget build(BuildContext context) {
+ // getAppDirectory();
+ return Scaffold(
+ appBar: AppBar(
+ title: SizedBox(
+ height: 22,
+ child: Text('Paramètres'),
+ )),
+ body: Column(children: [
+ SizedBox(height: 20),
+ Expanded(
+ child: Align(
+ alignment: Alignment.bottomCenter,
+ child: SizedBox(
+ height: 100,
+ width: 1000,
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ elevation: 5,
+ primary: Colors
+ .redAccent, //Color(0xffFFD68E), // background
+ onPrimary: Colors.black, // foreground
+ ),
+ onPressed: () => {
+ print('Suppression de tous les wallets'),
+ _deleteWallet()
+ },
+ child: Text(
+ "EFFACER TOUS MES PORTEFEUILLES, LE TEMPS DE L'ALPHA",
+ style: TextStyle(fontSize: 20)))))),
+ SizedBox(height: 50),
+ ]));
+ }
+
+ Future _deleteWallet() async {
+ try {
+ final appPath = await _localPath;
+ final _walletsFolder = Directory('$appPath/wallets');
+ print('DELETE THAT ?: $_walletsFolder');
+
+ final bool _answer = await _confirmDeletingWallets();
+
+ if (_answer) {
+ _walletsFolder.deleteSync(recursive: true);
+ _walletsFolder.createSync();
+ Navigator.pop(context);
+ }
+ return 0;
+ } catch (e) {
+ return 1;
+ }
+ }
+
+ Future _confirmDeletingWallets() async {
+ return showDialog(
+ context: context,
+ barrierDismissible: true, // user must tap button!
+ builder: (BuildContext context) {
+ return AlertDialog(
+ title: Text(
+ 'Êtes-vous sûr de vouloir supprimer tous vos portefeuilles ?'),
+ content: SingleChildScrollView(child: Text('')),
+ actions: [
+ TextButton(
+ child: Text("Non"),
+ onPressed: () {
+ Navigator.pop(context, false);
+ },
+ ),
+ TextButton(
+ child: Text("Oui"),
+ onPressed: () {
+ Navigator.pop(context, true);
+ },
+ ),
+ ],
+ );
+ },
+ );
+ }
+
+ Future get _localPath async {
+ final directory = await getApplicationDocumentsDirectory();
+ return directory.path;
+ }
+}
diff --git a/pubspec.lock b/pubspec.lock
index 4fe2df2..5960dc8 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -318,7 +318,7 @@ packages:
source: hosted
version: "0.4.5"
package_info:
- dependency: transitive
+ dependency: "direct main"
description:
name: package_info
url: "https://pub.dartlang.org"
diff --git a/pubspec.yaml b/pubspec.yaml
index bccd226..2ce0382 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -5,7 +5,7 @@ description: A new Flutter project.
# 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
-version: 0.0.0+11
+version: 0.0.0+13
environment:
sdk: ">=2.7.0 <3.0.0"
@@ -28,12 +28,13 @@ dependencies:
pin_code_fields: ^6.0.2
http: ^0.12.2
super_tooltip: ^0.9.6
+ package_info: ^0.4.3+2
flutter_icons:
android: "ic_launcher"
ios: true
- image_path: "assets/icon/gecko5bduniter2.png"
+ image_path: "assets/icon/gecko_final.png"
cupertino_icons: ^1.0.0
dev_dependencies:
@@ -47,3 +48,5 @@ flutter:
assets:
- images/
- config/
+ - assets/icon/gecko_final.png
+ - assets/
diff --git a/scripts/generateIcon.sh b/scripts/generateIcon.sh
new file mode 100755
index 0000000..b43b47e
--- /dev/null
+++ b/scripts/generateIcon.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+flutter pub run flutter_launcher_icons:main
+
+exit 0