Add icon; Add them colors; Add new page for validate wallet storage; Improve paddings
|
@ -12,7 +12,7 @@
|
||||||
<application
|
<application
|
||||||
android:name="io.flutter.app.FlutterApplication"
|
android:name="io.flutter.app.FlutterApplication"
|
||||||
android:label="gecko">
|
android:label="gecko">
|
||||||
<!-- android:icon="@mipmap/launcher_icon"> -->
|
<!-- android:icon="@mipmap/ic_launcher"> -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
|
|
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 111 KiB |
Before Width: | Height: | Size: 307 KiB After Width: | Height: | Size: 242 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 19 KiB |
|
@ -38,8 +38,17 @@ class Gecko extends StatelessWidget {
|
||||||
);
|
);
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Ğecko',
|
title: 'Ğecko',
|
||||||
theme:
|
theme: ThemeData(
|
||||||
ThemeData(primaryColor: Colors.blue[50], accentColor: Colors.black),
|
primaryColor: Color(0xffD28928),
|
||||||
|
accentColor: Color(0xffFFD68E),
|
||||||
|
textTheme: TextTheme(
|
||||||
|
bodyText1: TextStyle(),
|
||||||
|
bodyText2: TextStyle(),
|
||||||
|
).apply(
|
||||||
|
bodyColor: Color(0xff855F2D),
|
||||||
|
// displayColor: Colors.blue,
|
||||||
|
),
|
||||||
|
),
|
||||||
home: GraphQLProvider(
|
home: GraphQLProvider(
|
||||||
client: _client,
|
client: _client,
|
||||||
child: HomeScreen(),
|
child: HomeScreen(),
|
||||||
|
|
|
@ -17,25 +17,25 @@ class _GenerateWalletState extends State<GenerateWalletScreen> {
|
||||||
DubpRust.setup();
|
DubpRust.setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditingController _mnemonic = new TextEditingController();
|
TextEditingController _mnemonicController = new TextEditingController();
|
||||||
TextEditingController _pubkey = new TextEditingController();
|
TextEditingController _pubkey = new TextEditingController();
|
||||||
TextEditingController _pin = new TextEditingController();
|
TextEditingController _pin = new TextEditingController();
|
||||||
|
String generatedMnemonic;
|
||||||
|
NewWallet actualWallet;
|
||||||
final formKey = GlobalKey<FormState>();
|
final formKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
TextField(
|
SizedBox(height: 8),
|
||||||
enabled: false,
|
Text(
|
||||||
controller: this._mnemonic,
|
'Clé publique:',
|
||||||
maxLines: 2,
|
style: TextStyle(
|
||||||
textAlign: TextAlign.center,
|
fontSize: 15.0,
|
||||||
decoration: InputDecoration(),
|
color: Colors.grey[600],
|
||||||
style: TextStyle(
|
fontWeight: FontWeight.w400),
|
||||||
fontSize: 15.0,
|
),
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.bold)),
|
|
||||||
TextField(
|
TextField(
|
||||||
enabled: false,
|
enabled: false,
|
||||||
controller: this._pubkey,
|
controller: this._pubkey,
|
||||||
|
@ -46,6 +46,34 @@ class _GenerateWalletState extends State<GenerateWalletScreen> {
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.bold)),
|
fontWeight: FontWeight.bold)),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'Phrase secrète:',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
color: Colors.grey[600],
|
||||||
|
fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
enabled: false,
|
||||||
|
controller: this._mnemonicController,
|
||||||
|
maxLines: 3,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
contentPadding: EdgeInsets.all(15.0),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22.0,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w400)),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'Code PIN:',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
color: Colors.grey[600],
|
||||||
|
fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
TextField(
|
TextField(
|
||||||
enabled: false,
|
enabled: false,
|
||||||
controller: this._pin,
|
controller: this._pin,
|
||||||
|
@ -53,21 +81,47 @@ class _GenerateWalletState extends State<GenerateWalletScreen> {
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
decoration: InputDecoration(),
|
decoration: InputDecoration(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20.0,
|
fontSize: 30.0,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.bold)),
|
fontWeight: FontWeight.bold)),
|
||||||
SizedBox(height: 12),
|
SizedBox(height: 12),
|
||||||
new RaisedButton(
|
new RaisedButton(
|
||||||
|
color: Color(0xffFFD68E),
|
||||||
onPressed: () => generateMnemonic(),
|
onPressed: () => generateMnemonic(),
|
||||||
child: Text('Générer un wallet', style: TextStyle(fontSize: 20))),
|
child: Text('Générer un wallet', style: TextStyle(fontSize: 20))),
|
||||||
SizedBox(height: 20)
|
SizedBox(height: 30),
|
||||||
|
Expanded(
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: new RaisedButton(
|
||||||
|
color: Color(0xffFFD68E),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return ValidStoreWalletScreen(
|
||||||
|
generatedMnemonic: this.generatedMnemonic,
|
||||||
|
generatedWallet:
|
||||||
|
this.actualWallet); //, this.actualWallet);
|
||||||
|
}),
|
||||||
|
).then((value) => setState(() {
|
||||||
|
if (value) {
|
||||||
|
_pin.clear();
|
||||||
|
_mnemonicController.clear();
|
||||||
|
_pubkey.clear();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
},
|
||||||
|
child: Text('Enregistrer ce wallet',
|
||||||
|
style: TextStyle(fontSize: 20))))),
|
||||||
|
SizedBox(height: 15)
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future generateMnemonic() async {
|
Future generateMnemonic() async {
|
||||||
String generatedMnemonic;
|
|
||||||
try {
|
try {
|
||||||
generatedMnemonic = await DubpRust.genMnemonic(language: Language.french);
|
this.generatedMnemonic =
|
||||||
|
await DubpRust.genMnemonic(language: Language.french);
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
print(e);
|
print(e);
|
||||||
if (kReleaseMode) {
|
if (kReleaseMode) {
|
||||||
|
@ -77,15 +131,13 @@ class _GenerateWalletState extends State<GenerateWalletScreen> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.actualWallet = await generateWallet(this.generatedMnemonic);
|
||||||
generateWallet(generatedMnemonic);
|
return this.generatedMnemonic;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future generateWallet(generatedMnemonic) async {
|
Future generateWallet(generatedMnemonic) async {
|
||||||
final walletFile = await _localWallet;
|
|
||||||
NewWallet newWallet;
|
|
||||||
try {
|
try {
|
||||||
newWallet = await DubpRust.genWalletFromMnemonic(
|
this.actualWallet = await DubpRust.genWalletFromMnemonic(
|
||||||
language: Language.french, mnemonic: generatedMnemonic);
|
language: Language.french, mnemonic: generatedMnemonic);
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
print(e);
|
print(e);
|
||||||
|
@ -98,12 +150,82 @@ class _GenerateWalletState extends State<GenerateWalletScreen> {
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
this._mnemonic.text = generatedMnemonic;
|
this._mnemonicController.text = generatedMnemonic;
|
||||||
this._pubkey.text = newWallet.publicKey;
|
this._pubkey.text = actualWallet.publicKey;
|
||||||
this._pin.text = newWallet.pin;
|
this._pin.text = actualWallet.pin;
|
||||||
});
|
});
|
||||||
|
|
||||||
return walletFile.writeAsString('${newWallet.dewif}');
|
return actualWallet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ValidStoreWalletScreen extends StatefulWidget {
|
||||||
|
final String generatedMnemonic;
|
||||||
|
final NewWallet generatedWallet;
|
||||||
|
|
||||||
|
ValidStoreWalletScreen(
|
||||||
|
{Key validationKey,
|
||||||
|
@required this.generatedMnemonic,
|
||||||
|
@required this.generatedWallet})
|
||||||
|
: super(key: validationKey);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ValidStoreWalletScreen createState() => _ValidStoreWalletScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ValidStoreWalletScreen extends State<ValidStoreWalletScreen> {
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
// DubpRust.setup();
|
||||||
|
this._mnemonicController.text = widget.generatedMnemonic;
|
||||||
|
this._pubkey.text = widget.generatedWallet.publicKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextEditingController _mnemonicController = new TextEditingController();
|
||||||
|
TextEditingController _pubkey = new TextEditingController();
|
||||||
|
TextEditingController _pin = new TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(),
|
||||||
|
body: Center(
|
||||||
|
child: Column(children: <Widget>[
|
||||||
|
TextField(
|
||||||
|
enabled: false,
|
||||||
|
controller: this._mnemonicController,
|
||||||
|
maxLines: 2,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
decoration: InputDecoration(),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold)),
|
||||||
|
TextField(
|
||||||
|
enabled: false,
|
||||||
|
controller: this._pubkey,
|
||||||
|
maxLines: 1,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
decoration: InputDecoration(),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14.0,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold)),
|
||||||
|
new RaisedButton(
|
||||||
|
color: Color(0xffFFD68E),
|
||||||
|
onPressed: () => storeWallet(widget.generatedWallet),
|
||||||
|
child: Text('Confirmer', style: TextStyle(fontSize: 20))),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future storeWallet(actualWallet) async {
|
||||||
|
final walletFile = await _localWallet;
|
||||||
|
walletFile.writeAsString('${widget.generatedWallet.dewif}');
|
||||||
|
_pin.clear();
|
||||||
|
Navigator.pop(context, true);
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> get _localPath async {
|
Future<String> get _localPath async {
|
||||||
|
|
|
@ -64,6 +64,7 @@ class HistoryScreenState extends State<HistoryScreen> {
|
||||||
print('Build this.pubkey : ' + this.pubkey);
|
print('Build this.pubkey : ' + this.pubkey);
|
||||||
print('isBuilding: ' + isBuilding.toString());
|
print('isBuilding: ' + isBuilding.toString());
|
||||||
return Column(children: <Widget>[
|
return Column(children: <Widget>[
|
||||||
|
SizedBox(height: 8),
|
||||||
TextField(
|
TextField(
|
||||||
// Entrée de la pubkey
|
// Entrée de la pubkey
|
||||||
onChanged: (text) {
|
onChanged: (text) {
|
||||||
|
@ -84,10 +85,7 @@ class HistoryScreenState extends State<HistoryScreen> {
|
||||||
errorBorder: InputBorder.none,
|
errorBorder: InputBorder.none,
|
||||||
disabledBorder: InputBorder.none,
|
disabledBorder: InputBorder.none,
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold)),
|
||||||
fontSize: 15.0,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.bold)),
|
|
||||||
historyQuery(),
|
historyQuery(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +184,7 @@ class HistoryScreenState extends State<HistoryScreen> {
|
||||||
if (this.pubkey != '')
|
if (this.pubkey != '')
|
||||||
Text(balance.toString() + ' Ğ1',
|
Text(balance.toString() + ' Ğ1',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(fontSize: 30.0, color: Colors.black)),
|
style: TextStyle(fontSize: 30.0)),
|
||||||
for (var repository in _transBC)
|
for (var repository in _transBC)
|
||||||
ListTile(
|
ListTile(
|
||||||
contentPadding: const EdgeInsets.all(5.0),
|
contentPadding: const EdgeInsets.all(5.0),
|
||||||
|
|
|
@ -31,9 +31,8 @@ class HomeScreenState extends State<HomeScreen> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return Scaffold(
|
||||||
home: Scaffold(
|
backgroundColor: Color(0xffF9F9F1),
|
||||||
backgroundColor: Colors.grey[300],
|
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: IndexedStack(
|
child: IndexedStack(
|
||||||
index: currentIndex,
|
index: currentIndex,
|
||||||
|
@ -62,12 +61,15 @@ class HomeScreenState extends State<HomeScreen> {
|
||||||
height: 40.0,
|
height: 40.0,
|
||||||
width: 40.0,
|
width: 40.0,
|
||||||
child: Image.asset('images/scanner.png')),
|
child: Image.asset('images/scanner.png')),
|
||||||
backgroundColor: Color.fromARGB(500, 204, 255, 255),
|
backgroundColor: Color(
|
||||||
|
0xffEFEFBF), //Color(0xffFFD68E), //Color.fromARGB(500, 204, 255, 255),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
fixedColor: Colors.black,
|
backgroundColor: Color(0xffFFD68E),
|
||||||
|
fixedColor: Color(0xff855F2D),
|
||||||
|
unselectedItemColor: Color(0xffBD935C),
|
||||||
type: BottomNavigationBarType.fixed,
|
type: BottomNavigationBarType.fixed,
|
||||||
onTap: onTabTapped,
|
onTap: onTabTapped,
|
||||||
currentIndex: currentIndex,
|
currentIndex: currentIndex,
|
||||||
|
@ -86,6 +88,6 @@ class HomeScreenState extends State<HomeScreen> {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,13 @@ class _MyWalletState extends State<MyWalletsScreen> {
|
||||||
bool hasError = false;
|
bool hasError = false;
|
||||||
String validPin = 'NO PIN';
|
String validPin = 'NO PIN';
|
||||||
String currentText = "";
|
String currentText = "";
|
||||||
var pinColor = Colors.grey[300];
|
var pinColor = Color(0xffF9F9F1);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
|
SizedBox(height: 8),
|
||||||
InkWell(
|
InkWell(
|
||||||
child: TextField(
|
child: TextField(
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
@ -113,9 +114,9 @@ class _MyWalletState extends State<MyWalletsScreen> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
if (pinColor != Colors.grey[300]) {
|
if (pinColor != Color(0xffF9F9F1)) {
|
||||||
setState(() {
|
setState(() {
|
||||||
pinColor = Colors.grey[300];
|
pinColor = Color(0xffF9F9F1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
print(value);
|
print(value);
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: A new Flutter project.
|
||||||
# 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.0+7
|
version: 0.0.0+8
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
@ -29,10 +29,10 @@ dependencies:
|
||||||
|
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: "launcher_icon"
|
android: "ic_launcher"
|
||||||
ios: true
|
ios: true
|
||||||
image_path: "assets/icon/gecko5b96.png"
|
image_path: "assets/icon/gecko5bduniter2.png"
|
||||||
cupertino_icons: ^1.0.0
|
# cupertino_icons: ^1.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|