Add screen to show chest mnemonic
This commit is contained in:
parent
10f04c1a5a
commit
98bb94ab78
|
@ -229,6 +229,23 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
return await sdk.api.keyring.checkPassword(account, pass);
|
return await sdk.api.keyring.checkPassword(account, pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<String> getSeed(String address, String _pin) async {
|
||||||
|
final account = getKeypair(address);
|
||||||
|
keyring.setCurrent(account);
|
||||||
|
|
||||||
|
final _seed = await sdk.api.keyring.getDecryptedSeed(keyring, _pin);
|
||||||
|
|
||||||
|
String _seedText;
|
||||||
|
if (_seed == null) {
|
||||||
|
_seedText = '';
|
||||||
|
} else {
|
||||||
|
_seedText = _seed.seed!.split('//')[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
log.d(_seedText);
|
||||||
|
return _seedText;
|
||||||
|
}
|
||||||
|
|
||||||
int getDerivationNumber(String address) {
|
int getDerivationNumber(String address) {
|
||||||
final account = getKeypair(address);
|
final account = getKeypair(address);
|
||||||
final deriveNbr = account.name!.split('//')[1];
|
final deriveNbr = account.name!.split('//')[1];
|
||||||
|
|
|
@ -85,8 +85,6 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
XFile? pickedFile = await picker.pickImage(source: ImageSource.gallery);
|
XFile? pickedFile = await picker.pickImage(source: ImageSource.gallery);
|
||||||
|
|
||||||
if (pickedFile != null) {
|
if (pickedFile != null) {
|
||||||
////TODO: Store image on disk, store path in walletBox.imagePath
|
|
||||||
|
|
||||||
File imageFile = File(pickedFile.path);
|
File imageFile = File(pickedFile.path);
|
||||||
if (!await imageDirectory.exists()) {
|
if (!await imageDirectory.exists()) {
|
||||||
log.e("Image folder doesn't exist");
|
log.e("Image folder doesn't exist");
|
||||||
|
|
|
@ -242,7 +242,7 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
snackCopyKey(context) {
|
snackCopyKey(context) {
|
||||||
const snackBar = SnackBar(
|
const snackBar = SnackBar(
|
||||||
padding: EdgeInsets.all(20),
|
padding: EdgeInsets.all(20),
|
||||||
content: Text("Cette clé publique a été copié dans votre presse-papier.",
|
content: Text("Cette adresse a été copié dans votre presse-papier.",
|
||||||
style: TextStyle(fontSize: 16)),
|
style: TextStyle(fontSize: 16)),
|
||||||
duration: Duration(seconds: 2));
|
duration: Duration(seconds: 2));
|
||||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
|
|
|
@ -539,7 +539,7 @@ Widget bubbleSpeak(String text, {double? long, Key? textKey}) {
|
||||||
? const BubbleEdges.all(20)
|
? const BubbleEdges.all(20)
|
||||||
: BubbleEdges.symmetric(horizontal: long, vertical: 30),
|
: BubbleEdges.symmetric(horizontal: long, vertical: 30),
|
||||||
elevation: 5,
|
elevation: 5,
|
||||||
color: Colors.white,
|
color: backgroundColor,
|
||||||
child: Text(
|
child: Text(
|
||||||
text,
|
text,
|
||||||
key: textKey,
|
key: textKey,
|
||||||
|
|
|
@ -6,6 +6,7 @@ import 'package:gecko/providers/chest_provider.dart';
|
||||||
import 'package:gecko/providers/home.dart';
|
import 'package:gecko/providers/home.dart';
|
||||||
import 'package:gecko/providers/my_wallets.dart';
|
import 'package:gecko/providers/my_wallets.dart';
|
||||||
import 'package:gecko/screens/myWallets/change_pin.dart';
|
import 'package:gecko/screens/myWallets/change_pin.dart';
|
||||||
|
import 'package:gecko/screens/myWallets/show_seed.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class ChestOptions extends StatelessWidget {
|
class ChestOptions extends StatelessWidget {
|
||||||
|
@ -24,6 +25,7 @@ class ChestOptions extends StatelessWidget {
|
||||||
ChestData currentChest = chestBox.get(configBox.get('currentChest'))!;
|
ChestData currentChest = chestBox.get(configBox.get('currentChest'))!;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
elevation: 1,
|
elevation: 1,
|
||||||
|
@ -46,6 +48,39 @@ class ChestOptions extends StatelessWidget {
|
||||||
builder: (ctx) => SafeArea(
|
builder: (ctx) => SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
SizedBox(height: 30 * ratio),
|
SizedBox(height: 30 * ratio),
|
||||||
|
InkWell(
|
||||||
|
key: const Key('showSeed'),
|
||||||
|
onTap: () async {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return ShowSeed(
|
||||||
|
walletName: currentChest.name,
|
||||||
|
walletProvider: walletProvider,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
height: 50,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
const SizedBox(width: 20),
|
||||||
|
Image.asset(
|
||||||
|
'assets/onBoarding/phrase_de_restauration_flou.png',
|
||||||
|
width: 60,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 15),
|
||||||
|
Text(
|
||||||
|
'Afficher ma phrase de restauration',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: orangeC,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10 * ratio),
|
||||||
InkWell(
|
InkWell(
|
||||||
key: const Key('changePin'),
|
key: const Key('changePin'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
|
|
@ -34,6 +34,7 @@ class _ChooseChestState extends State<ChooseChest> {
|
||||||
log.d(widget.action);
|
log.d(widget.action);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -26,6 +26,7 @@ class ChooseWalletScreen extends StatelessWidget {
|
||||||
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -34,6 +34,7 @@ class RestoreChest extends StatelessWidget {
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
|
|
|
@ -0,0 +1,311 @@
|
||||||
|
import 'dart:typed_data';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:gecko/providers/my_wallets.dart';
|
||||||
|
import 'package:gecko/providers/substrate_sdk.dart';
|
||||||
|
import 'package:gecko/screens/common_elements.dart';
|
||||||
|
import 'package:pdf/pdf.dart';
|
||||||
|
import 'package:printing/printing.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:pdf/widgets.dart' as pw;
|
||||||
|
|
||||||
|
class ShowSeed extends StatelessWidget {
|
||||||
|
const ShowSeed(
|
||||||
|
{Key? keyMyWallets,
|
||||||
|
required this.walletName,
|
||||||
|
required this.walletProvider})
|
||||||
|
: super(key: keyMyWallets);
|
||||||
|
final String? walletName;
|
||||||
|
final MyWalletsProvider walletProvider;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
|
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
||||||
|
CommonElements common = CommonElements();
|
||||||
|
|
||||||
|
SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
|
|
||||||
|
final _chest = chestBox.get(configBox.get('currentChest'));
|
||||||
|
// _sub.changePassword(
|
||||||
|
// _chest!.address!, walletProvider.pinCode, newPin.text);
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
appBar: AppBar(
|
||||||
|
toolbarHeight: 60 * ratio,
|
||||||
|
title: const SizedBox(
|
||||||
|
height: 22,
|
||||||
|
child: Text('Ma phrase de restauration'),
|
||||||
|
)),
|
||||||
|
body: SafeArea(
|
||||||
|
child: Column(children: <Widget>[
|
||||||
|
const Spacer(flex: 1),
|
||||||
|
FutureBuilder(
|
||||||
|
future: _sub.getSeed(_chest!.address!, walletProvider.pinCode),
|
||||||
|
builder: (BuildContext context, AsyncSnapshot<String?> _seed) {
|
||||||
|
if (_seed.connectionState != ConnectionState.done ||
|
||||||
|
_seed.hasError) {
|
||||||
|
return SizedBox(
|
||||||
|
height: 15,
|
||||||
|
width: 15,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: orangeC,
|
||||||
|
strokeWidth: 2,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (!_seed.hasData) {
|
||||||
|
return const Text('');
|
||||||
|
}
|
||||||
|
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Column(children: [
|
||||||
|
common.buildText(
|
||||||
|
<TextSpan>[
|
||||||
|
const TextSpan(
|
||||||
|
text:
|
||||||
|
'Tâchez de garder cette phrase bien secrète, car elle permet à quiconque la connaît d’accéder à tous vos portefeuilles.'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 35 * ratio),
|
||||||
|
sentanceArray(context, _seed.data!.split(' ')),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
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: _seed.data));
|
||||||
|
snackCopyKey(context);
|
||||||
|
},
|
||||||
|
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]),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return PrintWallet(_seed.data);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/printer.png',
|
||||||
|
height: 42 * ratio,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}),
|
||||||
|
const Spacer(flex: 3),
|
||||||
|
]),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
snackCopyKey(context) {
|
||||||
|
const snackBar = SnackBar(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
content: Text(
|
||||||
|
"Votre phrase de restauration a été copié dans votre presse-papier.",
|
||||||
|
style: TextStyle(fontSize: 16)),
|
||||||
|
duration: Duration(seconds: 2));
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget sentanceArray(BuildContext context, List _mnemonic) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 3),
|
||||||
|
child: Container(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 450),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.black),
|
||||||
|
color: const Color(0xffeeeedd),
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(10),
|
||||||
|
)),
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Row(children: <Widget>[
|
||||||
|
arrayCell(_mnemonic[0], 1),
|
||||||
|
arrayCell(_mnemonic[1], 2),
|
||||||
|
arrayCell(_mnemonic[2], 3),
|
||||||
|
arrayCell(_mnemonic[3], 4),
|
||||||
|
]),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
Row(children: <Widget>[
|
||||||
|
arrayCell(_mnemonic[4], 5),
|
||||||
|
arrayCell(_mnemonic[5], 6),
|
||||||
|
arrayCell(_mnemonic[6], 7),
|
||||||
|
arrayCell(_mnemonic[7], 8),
|
||||||
|
]),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
Row(children: <Widget>[
|
||||||
|
arrayCell(_mnemonic[8], 9),
|
||||||
|
arrayCell(_mnemonic[9], 10),
|
||||||
|
arrayCell(_mnemonic[10], 11),
|
||||||
|
arrayCell(_mnemonic[11], 12),
|
||||||
|
]),
|
||||||
|
])),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget arrayCell(dataWord, int nbr) {
|
||||||
|
log.d(nbr);
|
||||||
|
|
||||||
|
return SizedBox(
|
||||||
|
width: 100,
|
||||||
|
child: Column(children: <Widget>[
|
||||||
|
Text(
|
||||||
|
nbr.toString(),
|
||||||
|
style:
|
||||||
|
TextStyle(fontSize: 13 * ratio, color: const Color(0xff6b6b52)),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
dataWord,
|
||||||
|
key: Key('word$dataWord'),
|
||||||
|
style: TextStyle(fontSize: 17 * ratio, color: Colors.black),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PrintWallet extends StatelessWidget {
|
||||||
|
const PrintWallet(this.sentence, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
final String? sentence;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return MaterialApp(
|
||||||
|
home: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
leading: IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}),
|
||||||
|
backgroundColor: yellowC,
|
||||||
|
foregroundColor: Colors.black,
|
||||||
|
toolbarHeight: 60 * ratio,
|
||||||
|
title: const SizedBox(
|
||||||
|
height: 22,
|
||||||
|
child: Text(
|
||||||
|
'Imprimer ma phrase de restauration',
|
||||||
|
style: TextStyle(fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: PdfPreview(
|
||||||
|
canDebug: false,
|
||||||
|
canChangeOrientation: false,
|
||||||
|
build: (format) => printWallet(sentence!),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Uint8List> printWallet(String _seed) async {
|
||||||
|
final ByteData fontData =
|
||||||
|
await rootBundle.load("assets/OpenSans-Regular.ttf");
|
||||||
|
final pw.Font ttf = pw.Font.ttf(fontData.buffer.asByteData());
|
||||||
|
final pdf = pw.Document();
|
||||||
|
int nbr = 1;
|
||||||
|
|
||||||
|
final _seedList = _seed.split(' ');
|
||||||
|
|
||||||
|
// const imageProvider = AssetImage('assets/icon/gecko_final.png');
|
||||||
|
// final geckoLogo = await flutterImageProvider(imageProvider);
|
||||||
|
|
||||||
|
pw.Widget arrayCell(String dataWord, int _nbr) {
|
||||||
|
nbr++;
|
||||||
|
|
||||||
|
return pw.SizedBox(
|
||||||
|
width: 120,
|
||||||
|
child: pw.Column(children: <pw.Widget>[
|
||||||
|
pw.Text(
|
||||||
|
_nbr.toString(),
|
||||||
|
style: pw.TextStyle(
|
||||||
|
fontSize: 15, color: const PdfColor(0.5, 0, 0), font: ttf),
|
||||||
|
),
|
||||||
|
pw.Text(
|
||||||
|
dataWord,
|
||||||
|
style: pw.TextStyle(
|
||||||
|
fontSize: 20, color: const PdfColor(0, 0, 0), font: ttf),
|
||||||
|
),
|
||||||
|
pw.SizedBox(height: 10)
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
pdf.addPage(
|
||||||
|
pw.Page(
|
||||||
|
pageFormat: PdfPageFormat.a4,
|
||||||
|
build: (context) {
|
||||||
|
return pw.Column(
|
||||||
|
// mainAxisAlignment: pw.MainAxisAlignment.center,
|
||||||
|
// mainAxisSize: pw.MainAxisSize.max,
|
||||||
|
// crossAxisAlignment: pw.CrossAxisAlignment.center,
|
||||||
|
children: <pw.Widget>[
|
||||||
|
pw.Row(children: <pw.Widget>[
|
||||||
|
arrayCell(_seedList[0], nbr),
|
||||||
|
arrayCell(_seedList[1], nbr),
|
||||||
|
arrayCell(_seedList[2], nbr),
|
||||||
|
arrayCell(_seedList[3], nbr),
|
||||||
|
]),
|
||||||
|
pw.Row(children: <pw.Widget>[
|
||||||
|
arrayCell(_seedList[4], nbr),
|
||||||
|
arrayCell(_seedList[5], nbr),
|
||||||
|
arrayCell(_seedList[6], nbr),
|
||||||
|
arrayCell(_seedList[7], nbr),
|
||||||
|
]),
|
||||||
|
pw.Row(children: <pw.Widget>[
|
||||||
|
arrayCell(_seedList[8], nbr),
|
||||||
|
arrayCell(_seedList[9], nbr),
|
||||||
|
arrayCell(_seedList[10], nbr),
|
||||||
|
arrayCell(_seedList[11], nbr)
|
||||||
|
]),
|
||||||
|
pw.Expanded(
|
||||||
|
child: pw.Align(
|
||||||
|
alignment: pw.Alignment.bottomCenter,
|
||||||
|
child: pw.Text(
|
||||||
|
"Gardez cette feuille préciseusement, à l’abri des lézards indiscrets.",
|
||||||
|
style: pw.TextStyle(fontSize: 15, font: ttf),
|
||||||
|
)))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return pdf.save();
|
||||||
|
}
|
||||||
|
}
|
|
@ -46,93 +46,93 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
errorController = StreamController<ErrorAnimationType>();
|
errorController = StreamController<ErrorAnimationType>();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
// backgroundColor: Colors.brown[600],
|
backgroundColor: backgroundColor,
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Stack(children: <Widget>[
|
Stack(children: <Widget>[
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 10, //statusBarHeight + 10,
|
top: 10, //statusBarHeight + 10,
|
||||||
left: 15,
|
left: 15,
|
||||||
child: Builder(
|
child: Builder(
|
||||||
builder: (context) => IconButton(
|
builder: (context) => IconButton(
|
||||||
key: const Key('popButton'),
|
key: const Key('popButton'),
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.arrow_back,
|
Icons.arrow_back,
|
||||||
color: Colors.black,
|
|
||||||
size: 30,
|
|
||||||
),
|
|
||||||
onPressed: () => Navigator.pop(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Column(children: <Widget>[
|
|
||||||
SizedBox(height: isTall ? 100 : 20),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
currentChest.imageFile == null
|
|
||||||
? Image.asset(
|
|
||||||
'assets/chests/${currentChest.imageName}',
|
|
||||||
width: isTall ? 130 : 100,
|
|
||||||
)
|
|
||||||
: Image.file(
|
|
||||||
currentChest.imageFile!,
|
|
||||||
width: isTall ? 130 : 100,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 5),
|
|
||||||
SizedBox(
|
|
||||||
width: 250,
|
|
||||||
child: Text(
|
|
||||||
currentChest.name!,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w700),
|
|
||||||
)),
|
|
||||||
]),
|
|
||||||
SizedBox(height: 30 * ratio),
|
|
||||||
const SizedBox(
|
|
||||||
width: 400,
|
|
||||||
child: Text(
|
|
||||||
'Pour déverrouiller votre coffre, composez votre code secret à l’abri des lézards indiscrets :',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 19,
|
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontWeight.w400),
|
size: 30,
|
||||||
)),
|
|
||||||
SizedBox(height: 40 * ratio),
|
|
||||||
pinForm(context, _pinLenght),
|
|
||||||
SizedBox(height: 3 * ratio),
|
|
||||||
InkWell(
|
|
||||||
key: const Key('chooseChest'),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) {
|
|
||||||
return ChooseChest(action: action);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: SizedBox(
|
|
||||||
width: 400,
|
|
||||||
height: 70,
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
'Changer de coffre',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
color: orangeC,
|
|
||||||
fontWeight: FontWeight.w600),
|
|
||||||
),
|
),
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
|
Column(children: <Widget>[
|
||||||
|
SizedBox(height: isTall ? 100 : 20),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
currentChest.imageFile == null
|
||||||
|
? Image.asset(
|
||||||
|
'assets/chests/${currentChest.imageName}',
|
||||||
|
width: isTall ? 130 : 100,
|
||||||
|
)
|
||||||
|
: Image.file(
|
||||||
|
currentChest.imageFile!,
|
||||||
|
width: isTall ? 130 : 100,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 5),
|
||||||
|
SizedBox(
|
||||||
|
width: 250,
|
||||||
|
child: Text(
|
||||||
|
currentChest.name!,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w700),
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
SizedBox(height: 30 * ratio),
|
||||||
|
const SizedBox(
|
||||||
|
width: 400,
|
||||||
|
child: Text(
|
||||||
|
'Pour déverrouiller votre coffre, composez votre code secret à l’abri des lézards indiscrets :',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 19,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.w400),
|
||||||
|
)),
|
||||||
|
SizedBox(height: 40 * ratio),
|
||||||
|
pinForm(context, _pinLenght),
|
||||||
|
SizedBox(height: 3 * ratio),
|
||||||
|
InkWell(
|
||||||
|
key: const Key('chooseChest'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return ChooseChest(action: action);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
width: 400,
|
||||||
|
height: 70,
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'Changer de coffre',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
color: orangeC,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
]),
|
]),
|
||||||
]),
|
));
|
||||||
]),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget pinForm(context, _pinLenght) {
|
Widget pinForm(context, _pinLenght) {
|
||||||
|
|
|
@ -47,6 +47,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
|
@ -84,7 +85,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
colors: [
|
colors: [
|
||||||
yellowC,
|
yellowC,
|
||||||
const Color(0xfffafafa),
|
backgroundColor,
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
@ -364,7 +365,7 @@ class WalletOptions extends StatelessWidget {
|
||||||
onTap: !walletProvider.isDefaultWallet
|
onTap: !walletProvider.isDefaultWallet
|
||||||
? () async {
|
? () async {
|
||||||
defaultWallet = wallet;
|
defaultWallet = wallet;
|
||||||
await _sub.setCurrentWallet(wallet);
|
await _sub.setCurrentWallet(wallet);
|
||||||
_myWalletProvider.readAllWallets(_currentChest);
|
_myWalletProvider.readAllWallets(_currentChest);
|
||||||
_myWalletProvider.rebuildWidget();
|
_myWalletProvider.rebuildWidget();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
elevation: 1,
|
elevation: 1,
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
|
@ -244,14 +245,14 @@ class WalletsHome extends StatelessWidget {
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
balanceBuilder(context, _repository.address!,
|
balanceBuilder(context, _repository.address!,
|
||||||
_repository.id()[1] == defaultWallet!.id()[1]),
|
_repository.address == defaultWallet!.address),
|
||||||
ListTile(
|
ListTile(
|
||||||
shape: const RoundedRectangleBorder(
|
shape: const RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.vertical(
|
borderRadius: BorderRadius.vertical(
|
||||||
bottom: Radius.circular(12))),
|
bottom: Radius.circular(12))),
|
||||||
// contentPadding: const EdgeInsets.only(left: 7.0),
|
// contentPadding: const EdgeInsets.only(left: 7.0),
|
||||||
tileColor:
|
tileColor:
|
||||||
_repository.id()[1] == defaultWallet.id()[1]
|
_repository.address == defaultWallet.address
|
||||||
? orangeC
|
? orangeC
|
||||||
: const Color(0xffFFD58D),
|
: const Color(0xffFFD58D),
|
||||||
// leading: Text('IMAGE'),
|
// leading: Text('IMAGE'),
|
||||||
|
|
|
@ -13,6 +13,7 @@ class OnboardingStepOne extends StatelessWidget {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -34,6 +34,7 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
final int _pinLenght = _generateWalletProvider.pin.text.length;
|
final int _pinLenght = _generateWalletProvider.pin.text.length;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -16,6 +16,7 @@ class OnboardingStepEleven extends StatelessWidget {
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -15,6 +15,7 @@ class OnboardingStepTwo extends StatelessWidget {
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -15,6 +15,7 @@ class OnboardingStepThree extends StatelessWidget {
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -15,6 +15,7 @@ class OnboardingStepFor extends StatelessWidget {
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -26,6 +26,7 @@ class OnboardingStepFive extends StatelessWidget {
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -36,6 +36,7 @@ class OnboardingStepSix extends StatelessWidget {
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
|
|
@ -13,6 +13,7 @@ class OnboardingStepSeven extends StatelessWidget {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -13,6 +13,7 @@ class OnboardingStepEight extends StatelessWidget {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -25,6 +25,7 @@ class OnboardingStepNine extends StatelessWidget {
|
||||||
: _generateWalletProvider.changePinCode(reload: false).toUpperCase();
|
: _generateWalletProvider.changePinCode(reload: false).toUpperCase();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
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';
|
||||||
|
// import 'package:gecko/providers/home.dart';
|
||||||
import 'package:gecko/providers/search.dart';
|
import 'package:gecko/providers/search.dart';
|
||||||
import 'package:gecko/screens/search_result.dart';
|
import 'package:gecko/screens/search_result.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
@ -15,6 +16,8 @@ class SearchScreen extends StatelessWidget {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
SearchProvider _searchProvider = Provider.of<SearchProvider>(context);
|
SearchProvider _searchProvider = Provider.of<SearchProvider>(context);
|
||||||
final double screenHeight = MediaQuery.of(context).size.height;
|
final double screenHeight = MediaQuery.of(context).size.height;
|
||||||
|
// HomeProvider _homeProvider =
|
||||||
|
// Provider.of<HomeProvider>(context, listen: false);
|
||||||
|
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
|
@ -22,6 +25,8 @@ class SearchScreen extends StatelessWidget {
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
elevation: 1,
|
elevation: 1,
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
|
@ -36,6 +41,7 @@ class SearchScreen extends StatelessWidget {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
// bottomNavigationBar: _homeProvider.bottomAppBar(context),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
SizedBox(height: isTall ? 200 : 100),
|
SizedBox(height: isTall ? 200 : 100),
|
||||||
|
|
|
@ -30,6 +30,7 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
double _avatarSize = 55;
|
double _avatarSize = 55;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
elevation: 1,
|
elevation: 1,
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
|
|
|
@ -39,6 +39,7 @@ class SettingsScreen extends StatelessWidget {
|
||||||
|
|
||||||
// getAppDirectory();
|
// getAppDirectory();
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
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';
|
||||||
// import 'package:gecko/models/home.dart';
|
|
||||||
// import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
|
||||||
class TemplateScreen extends StatelessWidget {
|
class TemplateScreen extends StatelessWidget {
|
||||||
TextEditingController tplController = TextEditingController();
|
const TemplateScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
TemplateScreen({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
title: const SizedBox(
|
title: const SizedBox(
|
||||||
|
@ -22,21 +20,10 @@ class TemplateScreen extends StatelessWidget {
|
||||||
child: Text('Template screen'),
|
child: Text('Template screen'),
|
||||||
)),
|
)),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: const <Widget>[
|
||||||
const SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
TextField(
|
Text('data'),
|
||||||
enabled: true,
|
SizedBox(height: 20),
|
||||||
controller: tplController,
|
|
||||||
maxLines: 1,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
contentPadding: EdgeInsets.all(15.0),
|
|
||||||
),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 22.0,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w400)),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
]),
|
]),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,7 @@ class TransactionInProgress extends StatelessWidget {
|
||||||
return Future<bool>.value(true);
|
return Future<bool>.value(true);
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 60 * ratio,
|
toolbarHeight: 60 * ratio,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
|
|
|
@ -40,6 +40,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
_sub.setCurrentWallet(defaultWallet!);
|
_sub.setCurrentWallet(defaultWallet!);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
resizeToAvoidBottomInset: true,
|
resizeToAvoidBottomInset: true,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
|
|
Loading…
Reference in New Issue