UX: big improvements on unlocking screen
This commit is contained in:
parent
9a2b99977e
commit
e5e71667df
|
@ -47,9 +47,6 @@ android/key.properties
|
||||||
# Rust things
|
# Rust things
|
||||||
/target
|
/target
|
||||||
|
|
||||||
# Linux builds
|
|
||||||
linux/
|
|
||||||
|
|
||||||
# Custom
|
# Custom
|
||||||
scripts/private/
|
scripts/private/
|
||||||
AppDir/
|
AppDir/
|
||||||
|
@ -59,6 +56,4 @@ android/app/build.gradle
|
||||||
integration_test/duniter/data/chains/
|
integration_test/duniter/data/chains/
|
||||||
|
|
||||||
# Ignore PC deps
|
# Ignore PC deps
|
||||||
macos/
|
|
||||||
windows/
|
|
||||||
scripts/pushGecko
|
scripts/pushGecko
|
|
@ -15,6 +15,8 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
bool isNewDerivationLoading = false;
|
bool isNewDerivationLoading = false;
|
||||||
String lastFlyBy = '';
|
String lastFlyBy = '';
|
||||||
String dragAddress = '';
|
String dragAddress = '';
|
||||||
|
bool isPinValid = false;
|
||||||
|
bool isPinLoading = true;
|
||||||
|
|
||||||
int getCurrentChest() {
|
int getCurrentChest() {
|
||||||
if (configBox.get('currentChest') == null) {
|
if (configBox.get('currentChest') == null) {
|
||||||
|
@ -26,7 +28,7 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
|
|
||||||
bool checkIfWalletExist() {
|
bool checkIfWalletExist() {
|
||||||
if (chestBox.isEmpty) {
|
if (chestBox.isEmpty) {
|
||||||
log.i('No wallets detected');
|
// log.i('No wallets detected');
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -22,6 +22,8 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
late int currentChestNumber;
|
late int currentChestNumber;
|
||||||
late ChestData currentChest;
|
late ChestData currentChest;
|
||||||
bool canUnlock = true;
|
bool canUnlock = true;
|
||||||
|
TextEditingController enterPin = TextEditingController();
|
||||||
|
FocusNode pinFocus = FocusNode(debugLabel: 'pinFocusNode');
|
||||||
|
|
||||||
// ignore: close_sinks
|
// ignore: close_sinks
|
||||||
StreamController<ErrorAnimationType>? errorController;
|
StreamController<ErrorAnimationType>? errorController;
|
||||||
|
@ -30,8 +32,10 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final walletOptions = Provider.of<WalletOptionsProvider>(context);
|
final walletOptions =
|
||||||
// final double statusBarHeight = MediaQuery.of(context).padding.top;
|
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
|
final myWalletProvider =
|
||||||
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
currentChestNumber = configBox.get('currentChest');
|
currentChestNumber = configBox.get('currentChest');
|
||||||
currentChest = chestBox.get(currentChestNumber)!;
|
currentChest = chestBox.get(currentChestNumber)!;
|
||||||
|
@ -39,136 +43,149 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
int pinLenght = walletOptions.getPinLenght(wallet.number);
|
int pinLenght = walletOptions.getPinLenght(wallet.number);
|
||||||
errorController = StreamController<ErrorAnimationType>();
|
errorController = StreamController<ErrorAnimationType>();
|
||||||
|
|
||||||
return Scaffold(
|
// if (enterPin.text == '') myWalletProvider.isPinLoading = true;
|
||||||
backgroundColor: backgroundColor,
|
|
||||||
body: SafeArea(
|
return WillPopScope(
|
||||||
child: Column(
|
onWillPop: () {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
myWalletProvider.isPinValid = false;
|
||||||
children: <Widget>[
|
myWalletProvider.isPinLoading = true;
|
||||||
Stack(children: <Widget>[
|
return Future<bool>.value(true);
|
||||||
Positioned(
|
},
|
||||||
top: 10, //statusBarHeight + 10,
|
child: Scaffold(
|
||||||
left: 15,
|
backgroundColor: backgroundColor,
|
||||||
child: Builder(
|
body: SafeArea(
|
||||||
builder: (context) => IconButton(
|
child: Column(
|
||||||
key: keyPopButton,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
icon: const Icon(
|
children: <Widget>[
|
||||||
Icons.arrow_back,
|
Stack(children: <Widget>[
|
||||||
color: Colors.black,
|
Positioned(
|
||||||
size: 30,
|
top: 10, //statusBarHeight + 10,
|
||||||
|
left: 15,
|
||||||
|
child: Builder(
|
||||||
|
builder: (context) => IconButton(
|
||||||
|
key: keyPopButton,
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.arrow_back,
|
||||||
|
color: Colors.black,
|
||||||
|
size: 30,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
myWalletProvider.isPinValid = false;
|
||||||
|
myWalletProvider.isPinLoading = true;
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
onPressed: () => Navigator.pop(context),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Column(children: <Widget>[
|
||||||
Column(children: <Widget>[
|
SizedBox(height: isTall ? 100 : 20),
|
||||||
SizedBox(height: isTall ? 100 : 20),
|
Row(
|
||||||
Row(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
currentChest.imageFile == null
|
||||||
currentChest.imageFile == null
|
? Image.asset(
|
||||||
? Image.asset(
|
'assets/chests/${currentChest.imageName}',
|
||||||
'assets/chests/${currentChest.imageName}',
|
width: isTall ? 130 : 100,
|
||||||
width: isTall ? 130 : 100,
|
)
|
||||||
)
|
: Image.file(
|
||||||
: Image.file(
|
currentChest.imageFile!,
|
||||||
currentChest.imageFile!,
|
width: isTall ? 130 : 100,
|
||||||
width: isTall ? 130 : 100,
|
),
|
||||||
),
|
const SizedBox(width: 5),
|
||||||
const SizedBox(width: 5),
|
SizedBox(
|
||||||
SizedBox(
|
width: 250,
|
||||||
width: 250,
|
child: Text(
|
||||||
child: Text(
|
currentChest.name!,
|
||||||
currentChest.name!,
|
textAlign: TextAlign.center,
|
||||||
textAlign: TextAlign.center,
|
style: const TextStyle(
|
||||||
style: const TextStyle(
|
fontSize: 25,
|
||||||
fontSize: 25,
|
color: Colors.black,
|
||||||
color: Colors.black,
|
fontWeight: FontWeight.w700),
|
||||||
fontWeight: FontWeight.w700),
|
)),
|
||||||
)),
|
]),
|
||||||
]),
|
SizedBox(height: 30 * ratio),
|
||||||
SizedBox(height: 30 * ratio),
|
SizedBox(
|
||||||
SizedBox(
|
|
||||||
width: 400,
|
|
||||||
child: Text(
|
|
||||||
'toUnlockEnterPassword'.tr(),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 19,
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w400),
|
|
||||||
)),
|
|
||||||
SizedBox(height: 40 * ratio),
|
|
||||||
pinForm(context, pinLenght),
|
|
||||||
SizedBox(height: 3 * ratio),
|
|
||||||
if (canUnlock)
|
|
||||||
InkWell(
|
|
||||||
key: keyCachePassword,
|
|
||||||
onTap: () {
|
|
||||||
walletOptions.changePinCacheChoice();
|
|
||||||
},
|
|
||||||
child: Row(children: [
|
|
||||||
const SizedBox(height: 30),
|
|
||||||
const Spacer(),
|
|
||||||
Icon(
|
|
||||||
configBox.get('isCacheChecked')
|
|
||||||
? Icons.check_box
|
|
||||||
: Icons.check_box_outline_blank,
|
|
||||||
color: orangeC,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Text(
|
|
||||||
'rememberPassword'.tr(),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16, color: Colors.grey[700]),
|
|
||||||
),
|
|
||||||
const Spacer()
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
// if (canUnlock)
|
|
||||||
InkWell(
|
|
||||||
key: keyChangeChest,
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) {
|
|
||||||
return const ChooseChest();
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: SizedBox(
|
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 50,
|
child: Text(
|
||||||
child: Center(
|
'toUnlockEnterPassword'.tr(),
|
||||||
child: Text(
|
style: const TextStyle(
|
||||||
'changeChest'.tr(),
|
fontSize: 19,
|
||||||
style: const TextStyle(
|
color: Colors.black,
|
||||||
fontSize: 22,
|
fontWeight: FontWeight.w400),
|
||||||
color: orangeC,
|
)),
|
||||||
fontWeight: FontWeight.w600),
|
SizedBox(height: 30 * ratio),
|
||||||
|
if (!myWalletProvider.isPinValid &&
|
||||||
|
!myWalletProvider.isPinLoading)
|
||||||
|
Text(
|
||||||
|
"Ce n'est pas le bon code".tr(),
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.red, fontWeight: FontWeight.w500),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10 * ratio),
|
||||||
|
pinForm(context, pinLenght),
|
||||||
|
SizedBox(height: 3 * ratio),
|
||||||
|
if (canUnlock)
|
||||||
|
InkWell(
|
||||||
|
key: keyCachePassword,
|
||||||
|
onTap: () {
|
||||||
|
walletOptions.changePinCacheChoice();
|
||||||
|
},
|
||||||
|
child: Row(children: [
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
const Spacer(),
|
||||||
|
Icon(
|
||||||
|
configBox.get('isCacheChecked')
|
||||||
|
? Icons.check_box
|
||||||
|
: Icons.check_box_outline_blank,
|
||||||
|
color: orangeC,
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 8),
|
||||||
)),
|
Text(
|
||||||
|
'rememberPassword'.tr(),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16, color: Colors.grey[700]),
|
||||||
|
),
|
||||||
|
const Spacer()
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
// if (canUnlock)
|
||||||
|
InkWell(
|
||||||
|
key: keyChangeChest,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return const ChooseChest();
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: SizedBox(
|
||||||
|
width: 400,
|
||||||
|
height: 50,
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
'changeChest'.tr(),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
color: orangeC,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
]),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
]),
|
)),
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget pinForm(context, pinLenght) {
|
Widget pinForm(context, pinLenght) {
|
||||||
// var _walletPin = '';
|
|
||||||
// ignore: close_sinks
|
|
||||||
StreamController<ErrorAnimationType> errorController =
|
|
||||||
StreamController<ErrorAnimationType>();
|
|
||||||
TextEditingController enterPin = TextEditingController();
|
|
||||||
final walletOptions = Provider.of<WalletOptionsProvider>(context);
|
|
||||||
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||||
FocusNode pinFocus = FocusNode();
|
|
||||||
|
|
||||||
WalletData defaultWallet = myWalletProvider.getDefaultWallet();
|
WalletData defaultWallet = myWalletProvider.getDefaultWallet();
|
||||||
|
|
||||||
// defaultWallet.address = null;
|
|
||||||
if (defaultWallet.address == null) {
|
if (defaultWallet.address == null) {
|
||||||
canUnlock = false;
|
canUnlock = false;
|
||||||
return Text(
|
return Text(
|
||||||
|
@ -180,11 +197,11 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
return Form(
|
return Form(
|
||||||
// key: keyPinForm,
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 5 * ratio, horizontal: 30),
|
padding: EdgeInsets.symmetric(vertical: 5 * ratio, horizontal: 30),
|
||||||
child: PinCodeTextField(
|
child: PinCodeTextField(
|
||||||
key: keyPinForm,
|
key: keyPinForm,
|
||||||
|
textCapitalization: TextCapitalization.characters,
|
||||||
focusNode: pinFocus,
|
focusNode: pinFocus,
|
||||||
autoFocus: true,
|
autoFocus: true,
|
||||||
appContext: context,
|
appContext: context,
|
||||||
|
@ -195,7 +212,8 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
length: pinLenght,
|
length: pinLenght,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
obscuringCharacter: '*',
|
obscuringCharacter: '*',
|
||||||
animationType: AnimationType.fade,
|
animationType: AnimationType.slide,
|
||||||
|
animationDuration: const Duration(milliseconds: 80),
|
||||||
validator: (v) {
|
validator: (v) {
|
||||||
if (v!.length < pinLenght) {
|
if (v!.length < pinLenght) {
|
||||||
return "yourPasswordLengthIsX".tr(args: [pinLenght.toString()]);
|
return "yourPasswordLengthIsX".tr(args: [pinLenght.toString()]);
|
||||||
|
@ -214,11 +232,9 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
),
|
),
|
||||||
showCursor: kDebugMode ? false : true,
|
showCursor: kDebugMode ? false : true,
|
||||||
cursorColor: Colors.black,
|
cursorColor: Colors.black,
|
||||||
animationDuration: const Duration(milliseconds: 300),
|
textStyle: const TextStyle(fontSize: 27, height: 1.6),
|
||||||
textStyle: const TextStyle(fontSize: 20, height: 1.6),
|
|
||||||
backgroundColor: const Color(0xffF9F9F1),
|
backgroundColor: const Color(0xffF9F9F1),
|
||||||
enableActiveFill: false,
|
enableActiveFill: false,
|
||||||
errorAnimationController: errorController,
|
|
||||||
controller: enterPin,
|
controller: enterPin,
|
||||||
keyboardType: TextInputType.visiblePassword,
|
keyboardType: TextInputType.visiblePassword,
|
||||||
boxShadows: const [
|
boxShadows: const [
|
||||||
|
@ -229,28 +245,32 @@ class UnlockingWallet extends StatelessWidget {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
onCompleted: (pin) async {
|
onCompleted: (pin) async {
|
||||||
|
myWalletProvider.isPinLoading = true;
|
||||||
myWalletProvider.pinCode = pin.toUpperCase();
|
myWalletProvider.pinCode = pin.toUpperCase();
|
||||||
final isValid = await sub.checkPassword(
|
final isValid = await sub.checkPassword(
|
||||||
defaultWallet.address!, pin.toUpperCase());
|
defaultWallet.address!, pin.toUpperCase());
|
||||||
|
|
||||||
if (!isValid) {
|
if (!isValid) {
|
||||||
await Future.delayed(const Duration(milliseconds: 50));
|
await Future.delayed(const Duration(milliseconds: 50));
|
||||||
errorController.add(ErrorAnimationType
|
|
||||||
.shake); // Triggering error shake animation
|
|
||||||
pinColor = Colors.red[600];
|
pinColor = Colors.red[600];
|
||||||
|
myWalletProvider.isPinLoading = false;
|
||||||
|
myWalletProvider.isPinValid = false;
|
||||||
myWalletProvider.pinCode = myWalletProvider.mnemonic = '';
|
myWalletProvider.pinCode = myWalletProvider.mnemonic = '';
|
||||||
walletOptions.reload();
|
enterPin.text = '';
|
||||||
pinFocus.requestFocus();
|
pinFocus.requestFocus();
|
||||||
} else {
|
} else {
|
||||||
|
myWalletProvider.isPinValid = true;
|
||||||
|
myWalletProvider.isPinLoading = false;
|
||||||
pinColor = Colors.green[400];
|
pinColor = Colors.green[400];
|
||||||
myWalletProvider.resetPinCode();
|
myWalletProvider.resetPinCode();
|
||||||
Navigator.pop(context, pin.toUpperCase());
|
Navigator.pop(context, pin.toUpperCase());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
|
if (enterPin.text != '') myWalletProvider.isPinLoading = true;
|
||||||
if (pinColor != const Color(0xFFA4B600)) {
|
if (pinColor != const Color(0xFFA4B600)) {
|
||||||
pinColor = const Color(0xFFA4B600);
|
pinColor = const Color(0xFFA4B600);
|
||||||
}
|
}
|
||||||
|
myWalletProvider.reload();
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|
|
@ -26,117 +26,142 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
final formKey = GlobalKey<FormState>();
|
final formKey = GlobalKey<FormState>();
|
||||||
Color? pinColor = const Color(0xFFA4B600);
|
Color? pinColor = const Color(0xFFA4B600);
|
||||||
bool hasError = false;
|
bool hasError = false;
|
||||||
|
TextEditingController enterPin = TextEditingController();
|
||||||
|
FocusNode pinFocus = FocusNode(debugLabel: 'pinFocusNode');
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final generateWalletProvider =
|
final generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
final walletOptions = Provider.of<WalletOptionsProvider>(context);
|
final walletOptions = Provider.of<WalletOptionsProvider>(context);
|
||||||
|
final myWalletProvider =
|
||||||
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
CommonElements common = CommonElements();
|
CommonElements common = CommonElements();
|
||||||
final pinLenght = generateWalletProvider.pin.text.length;
|
final pinLenght = generateWalletProvider.pin.text.length;
|
||||||
|
|
||||||
return Scaffold(
|
return WillPopScope(
|
||||||
backgroundColor: backgroundColor,
|
onWillPop: () {
|
||||||
appBar: AppBar(
|
myWalletProvider.isPinValid = false;
|
||||||
toolbarHeight: 60 * ratio,
|
myWalletProvider.isPinLoading = true;
|
||||||
title: SizedBox(
|
return Future<bool>.value(true);
|
||||||
height: 22,
|
},
|
||||||
child: Text(
|
child: Scaffold(
|
||||||
'myPassword'.tr(),
|
backgroundColor: backgroundColor,
|
||||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
appBar: AppBar(
|
||||||
|
toolbarHeight: 60 * ratio,
|
||||||
|
title: SizedBox(
|
||||||
|
height: 22,
|
||||||
|
child: Text(
|
||||||
|
'myPassword'.tr(),
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
leading: IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||||
|
onPressed: () {
|
||||||
|
myWalletProvider.isPinValid = false;
|
||||||
|
myWalletProvider.isPinLoading = true;
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
),
|
extendBodyBehindAppBar: true,
|
||||||
extendBodyBehindAppBar: true,
|
body: SafeArea(
|
||||||
body: SafeArea(
|
child: Stack(children: [
|
||||||
child: Stack(children: [
|
Column(children: <Widget>[
|
||||||
Column(children: <Widget>[
|
SizedBox(height: isTall ? 40 : 20),
|
||||||
SizedBox(height: isTall ? 40 : 20),
|
common.buildProgressBar(9),
|
||||||
common.buildProgressBar(9),
|
SizedBox(height: isTall ? 40 : 20),
|
||||||
SizedBox(height: isTall ? 40 : 20),
|
common.buildText("geckoWillCheckPassword".tr()),
|
||||||
common.buildText("geckoWillCheckPassword".tr()),
|
SizedBox(height: isTall ? 60 : 10),
|
||||||
SizedBox(height: isTall ? 80 : 20),
|
Visibility(
|
||||||
Visibility(
|
visible: generateWalletProvider.scanedValidWalletNumber != -1,
|
||||||
visible: generateWalletProvider.scanedValidWalletNumber != -1,
|
child: Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.only(bottom: 15),
|
||||||
padding: const EdgeInsets.only(bottom: 15),
|
child: Row(
|
||||||
child: Row(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: [
|
||||||
children: [
|
Text("derivationsScanProgress".tr(args: [
|
||||||
Text("derivationsScanProgress".tr(args: [
|
'${generateWalletProvider.scanedWalletNumber}',
|
||||||
'${generateWalletProvider.scanedWalletNumber}',
|
'${generateWalletProvider.numberScan + 1}'
|
||||||
'${generateWalletProvider.numberScan + 1}'
|
])),
|
||||||
])),
|
const SizedBox(width: 10),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(
|
||||||
const SizedBox(
|
height: 22,
|
||||||
height: 22,
|
width: 22,
|
||||||
width: 22,
|
child: CircularProgressIndicator(
|
||||||
child: CircularProgressIndicator(
|
color: orangeC,
|
||||||
color: orangeC,
|
strokeWidth: 3,
|
||||||
strokeWidth: 3,
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Consumer<MyWalletsProvider>(builder: (context, mw, _) {
|
||||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
return Visibility(
|
||||||
return sub.nodeConnected
|
visible: !myWalletProvider.isPinValid &&
|
||||||
? pinForm(context, walletOptions, pinLenght, 1, 2)
|
!myWalletProvider.isPinLoading,
|
||||||
: Row(
|
child: Text(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
"Ce n'est pas le bon code".tr(),
|
||||||
children: const [
|
style: const TextStyle(
|
||||||
Text(
|
color: Colors.red, fontWeight: FontWeight.w500),
|
||||||
'Vous devez vous connecter à internet\npour valider votre coffre',
|
),
|
||||||
style: TextStyle(
|
);
|
||||||
fontSize: 20,
|
}),
|
||||||
color: Colors.redAccent,
|
SizedBox(height: isTall ? 20 : 10),
|
||||||
fontWeight: FontWeight.w500,
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
|
return sub.nodeConnected
|
||||||
|
? pinForm(context, walletOptions, pinLenght, 1, 2)
|
||||||
|
: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: const [
|
||||||
|
Text(
|
||||||
|
'Vous devez vous connecter à internet\npour valider votre coffre',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: Colors.redAccent,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
textAlign: TextAlign.center,
|
]);
|
||||||
|
}),
|
||||||
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
|
return sub.nodeConnected
|
||||||
|
? InkWell(
|
||||||
|
key: keyCachePassword,
|
||||||
|
onTap: () {
|
||||||
|
walletOptions.changePinCacheChoice();
|
||||||
|
},
|
||||||
|
child: Row(children: [
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
const Spacer(),
|
||||||
|
Icon(
|
||||||
|
configBox.get('isCacheChecked') ?? false
|
||||||
|
? Icons.check_box
|
||||||
|
: Icons.check_box_outline_blank,
|
||||||
|
color: orangeC,
|
||||||
),
|
),
|
||||||
]);
|
const SizedBox(width: 8),
|
||||||
}),
|
Text(
|
||||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
'rememberPassword'.tr(),
|
||||||
return sub.nodeConnected
|
style: TextStyle(
|
||||||
? InkWell(
|
fontSize: 16, color: Colors.grey[700]),
|
||||||
key: keyCachePassword,
|
),
|
||||||
onTap: () {
|
const Spacer()
|
||||||
walletOptions.changePinCacheChoice();
|
]))
|
||||||
},
|
: const Text('');
|
||||||
child: Row(children: [
|
}),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 10),
|
||||||
const Spacer(),
|
]),
|
||||||
Icon(
|
CommonElements().offlineInfo(context),
|
||||||
configBox.get('isCacheChecked') ?? false
|
|
||||||
? Icons.check_box
|
|
||||||
: Icons.check_box_outline_blank,
|
|
||||||
color: orangeC,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Text(
|
|
||||||
'rememberPassword'.tr(),
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16, color: Colors.grey[700]),
|
|
||||||
),
|
|
||||||
const Spacer()
|
|
||||||
]))
|
|
||||||
: const Text('');
|
|
||||||
}),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
]),
|
]),
|
||||||
CommonElements().offlineInfo(context),
|
)),
|
||||||
]),
|
);
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget pinForm(
|
Widget pinForm(
|
||||||
context, final walletOptions, pinLenght, int walletNbr, int derivation) {
|
context, final walletOptions, pinLenght, int walletNbr, int derivation) {
|
||||||
// var _walletPin = '';
|
|
||||||
// ignore: close_sinks
|
|
||||||
StreamController<ErrorAnimationType> errorController =
|
|
||||||
StreamController<ErrorAnimationType>();
|
|
||||||
TextEditingController enterPin = TextEditingController();
|
|
||||||
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
final myWalletProvider = Provider.of<MyWalletsProvider>(context);
|
||||||
final generateWalletProvider =
|
final generateWalletProvider =
|
||||||
Provider.of<GenerateWalletsProvider>(context);
|
Provider.of<GenerateWalletsProvider>(context);
|
||||||
|
@ -150,6 +175,9 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 30),
|
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 30),
|
||||||
child: PinCodeTextField(
|
child: PinCodeTextField(
|
||||||
key: keyPinForm,
|
key: keyPinForm,
|
||||||
|
textCapitalization: TextCapitalization.characters,
|
||||||
|
// autoDisposeControllers: false,
|
||||||
|
focusNode: pinFocus,
|
||||||
autoFocus: true,
|
autoFocus: true,
|
||||||
appContext: context,
|
appContext: context,
|
||||||
pastedTextStyle: TextStyle(
|
pastedTextStyle: TextStyle(
|
||||||
|
@ -159,7 +187,8 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
length: pinLenght,
|
length: pinLenght,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
obscuringCharacter: '*',
|
obscuringCharacter: '*',
|
||||||
animationType: AnimationType.fade,
|
animationType: AnimationType.slide,
|
||||||
|
animationDuration: const Duration(milliseconds: 80),
|
||||||
validator: (v) {
|
validator: (v) {
|
||||||
if (v!.length < pinLenght) {
|
if (v!.length < pinLenght) {
|
||||||
return "yourPasswordLengthIsX".tr(args: [pinLenght.toString()]);
|
return "yourPasswordLengthIsX".tr(args: [pinLenght.toString()]);
|
||||||
|
@ -172,17 +201,15 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
borderWidth: 4,
|
borderWidth: 4,
|
||||||
shape: PinCodeFieldShape.box,
|
shape: PinCodeFieldShape.box,
|
||||||
borderRadius: BorderRadius.circular(5),
|
borderRadius: BorderRadius.circular(5),
|
||||||
fieldHeight: 60,
|
fieldHeight: 50 * ratio,
|
||||||
fieldWidth: 50,
|
fieldWidth: 50,
|
||||||
activeFillColor: hasError ? Colors.blueAccent : Colors.black,
|
activeFillColor: Colors.black,
|
||||||
),
|
),
|
||||||
showCursor: kDebugMode ? false : true,
|
showCursor: kDebugMode ? false : true,
|
||||||
cursorColor: Colors.black,
|
cursorColor: Colors.black,
|
||||||
animationDuration: const Duration(milliseconds: 300),
|
textStyle: const TextStyle(fontSize: 27, height: 1.6),
|
||||||
textStyle: const TextStyle(fontSize: 20, height: 1.6),
|
|
||||||
backgroundColor: const Color(0xffF9F9F1),
|
backgroundColor: const Color(0xffF9F9F1),
|
||||||
enableActiveFill: false,
|
enableActiveFill: false,
|
||||||
errorAnimationController: errorController,
|
|
||||||
controller: enterPin,
|
controller: enterPin,
|
||||||
keyboardType: TextInputType.visiblePassword,
|
keyboardType: TextInputType.visiblePassword,
|
||||||
boxShadows: const [
|
boxShadows: const [
|
||||||
|
@ -198,6 +225,8 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
log.d('$pin || ${generateWalletProvider.pin.text}');
|
log.d('$pin || ${generateWalletProvider.pin.text}');
|
||||||
if (pin.toUpperCase() == generateWalletProvider.pin.text) {
|
if (pin.toUpperCase() == generateWalletProvider.pin.text) {
|
||||||
pinColor = Colors.green[500];
|
pinColor = Colors.green[500];
|
||||||
|
myWalletProvider.isPinLoading = false;
|
||||||
|
myWalletProvider.isPinValid = true;
|
||||||
|
|
||||||
await generateWalletProvider.storeHDWChest(context);
|
await generateWalletProvider.storeHDWChest(context);
|
||||||
bool isAlive = false;
|
bool isAlive = false;
|
||||||
|
@ -232,17 +261,21 @@ class OnboardingStepTen extends StatelessWidget {
|
||||||
page: const OnboardingStepEleven(), isFast: false),
|
page: const OnboardingStepEleven(), isFast: false),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
errorController.add(ErrorAnimationType
|
|
||||||
.shake); // Triggering error shake animation
|
|
||||||
hasError = true;
|
hasError = true;
|
||||||
|
myWalletProvider.isPinLoading = false;
|
||||||
|
myWalletProvider.isPinValid = false;
|
||||||
pinColor = Colors.red[600];
|
pinColor = Colors.red[600];
|
||||||
walletOptions.reload();
|
enterPin.text = '';
|
||||||
|
// myWalletProvider.reload();
|
||||||
|
pinFocus.requestFocus();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
|
if (enterPin.text != '') myWalletProvider.isPinLoading = true;
|
||||||
if (pinColor != const Color(0xFFA4B600)) {
|
if (pinColor != const Color(0xFFA4B600)) {
|
||||||
pinColor = const Color(0xFFA4B600);
|
pinColor = const Color(0xFFA4B600);
|
||||||
}
|
}
|
||||||
|
myWalletProvider.reload();
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|
|
@ -52,6 +52,7 @@ class OnboardingStepNine extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
TextField(
|
TextField(
|
||||||
key: keyGeneratedPin,
|
key: keyGeneratedPin,
|
||||||
|
textCapitalization: TextCapitalization.characters,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
controller: generateWalletProvider.pin,
|
controller: generateWalletProvider.pin,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
|
|
32
pubspec.lock
32
pubspec.lock
|
@ -224,21 +224,7 @@ packages:
|
||||||
name: connectivity_plus
|
name: connectivity_plus
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.9"
|
version: "3.0.2"
|
||||||
connectivity_plus_linux:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: connectivity_plus_linux
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.3.1"
|
|
||||||
connectivity_plus_macos:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: connectivity_plus_macos
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.2.6"
|
|
||||||
connectivity_plus_platform_interface:
|
connectivity_plus_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -246,20 +232,6 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.3"
|
version: "1.2.3"
|
||||||
connectivity_plus_web:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: connectivity_plus_web
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.2.5"
|
|
||||||
connectivity_plus_windows:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: connectivity_plus_windows
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.2.2"
|
|
||||||
convert:
|
convert:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -576,7 +548,7 @@ packages:
|
||||||
name: graphql_flutter
|
name: graphql_flutter
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.1.1-beta.4"
|
version: "5.1.1-beta.5"
|
||||||
graphs:
|
graphs:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -26,7 +26,7 @@ dependencies:
|
||||||
path_provider: ^2.0.9
|
path_provider: ^2.0.9
|
||||||
pdf: ^3.7.1
|
pdf: ^3.7.1
|
||||||
permission_handler: ^10.0.0
|
permission_handler: ^10.0.0
|
||||||
pin_code_fields: ^7.3.0
|
pin_code_fields: ^7.4.0
|
||||||
printing: ^5.9.1
|
printing: ^5.9.1
|
||||||
provider: ^6.0.1
|
provider: ^6.0.1
|
||||||
barcode_scan2: ^4.2.1
|
barcode_scan2: ^4.2.1
|
||||||
|
@ -51,7 +51,7 @@ dependencies:
|
||||||
# ref: ec61ebab45287315fa1d7e84830a01d6e23891ae
|
# ref: ec61ebab45287315fa1d7e84830a01d6e23891ae
|
||||||
ref: d45eb8d787d625331e6425df5cec9c5d33b30d35
|
ref: d45eb8d787d625331e6425df5cec9c5d33b30d35
|
||||||
dots_indicator: ^2.1.0
|
dots_indicator: ^2.1.0
|
||||||
connectivity_plus: ^2.3.3
|
connectivity_plus: ^3.0.2
|
||||||
image_cropper: ^3.0.0
|
image_cropper: ^3.0.0
|
||||||
easy_localization: ^3.0.1
|
easy_localization: ^3.0.1
|
||||||
flutter_markdown: ^0.6.10+2
|
flutter_markdown: ^0.6.10+2
|
||||||
|
|
Loading…
Reference in New Issue