Skip to content

Commit

Permalink
verify passphrase,replaced with elevated button
Browse files Browse the repository at this point in the history
  • Loading branch information
yshwanth committed Jun 1, 2022
1 parent c7bec87 commit b633eeb
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 60 deletions.
135 changes: 84 additions & 51 deletions lib/ui/component/NewWallet/SeedGenerate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ class SeedGeneratePassphrase extends StatefulWidget {

class _SeedGeneratePassphraseState extends State<SeedGeneratePassphrase> {
late TextEditingController _textController;

late TextEditingController _textControllerP;
final GlobalKey<FormState> _form = GlobalKey<FormState>();
@override
void initState() {
_textController = TextEditingController();
_textControllerP = TextEditingController();
super.initState();
}

Expand All @@ -22,61 +24,88 @@ class _SeedGeneratePassphraseState extends State<SeedGeneratePassphrase> {
builder: (context, state) {
if (_textController.text != state.passPhrase)
_textController.text = state.passPhrase;

return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 24),
Text(
'optional\npassphrase'.toUpperCase(),
style: c.fonts.headline5!.copyWith(
color: c.colours.onPrimary,
// fontWeight: FontWeight.bold,
),
),
// const HeaderTextDark(text: 'Enter an\noptional\npassphrase'),
const SizedBox(height: 24),
Text(
'Add an (optional) security layer to your seed.\n\nThis passphrase should be added as the last word of your seed.\n\If set, you cannot recover funds without it.',
style: c.fonts.caption!.copyWith(color: c.colours.onPrimary),
),
const SizedBox(height: 32),

Padding(
padding: EdgeInsets.zero,
child: TextField(
autocorrect: false,
obscureText: true,
obscuringCharacter: '*',
controller: _textController,
onChanged: (text) {
c.read<SeedGenerateCubit>().passPhrasedChanged(text);
},
style: TextStyle(color: c.colours.onBackground),
decoration: const InputDecoration(
labelText: 'Passphrase',
return Form(
key: _form,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 24),
Text(
'optional\npassphrase (!)'.toUpperCase(),
style: c.fonts.headline5!.copyWith(
color: c.colours.onPrimary,
// fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 40),
if (state.errPassphrase != '')
// const HeaderTextDark(text: 'Enter an\noptional\npassphrase'),
const SizedBox(height: 24),
Text(
state.errPassphrase,
style: c.fonts.caption!.copyWith(
color: c.colours.error,
'Add an (optional) security layer to your seed.\n\nThis passphrase should be added as the last word of your seed.\n\If set, you cannot recover funds without it.',
style: c.fonts.caption!.copyWith(color: c.colours.onPrimary),
),
const SizedBox(height: 32),

Padding(
padding: EdgeInsets.zero,
child: TextFormField(
autocorrect: false,
obscureText: true,
obscuringCharacter: '*',
controller: _textController,
validator: (val) {},
onChanged: (text) {
c.read<SeedGenerateCubit>().passPhrasedChanged(text);
},
style: TextStyle(color: c.colours.onBackground),
decoration: const InputDecoration(
labelText: 'Passphrase',
),
),
),
const SizedBox(height: 24),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextButton(
onPressed: () {
c.read<SeedGenerateCubit>().generateSeed();
},
child: Text('Confirm'.toUpperCase()),
const SizedBox(height: 12),
Padding(
padding: EdgeInsets.zero,
child: TextFormField(
autocorrect: false,
obscureText: true,
obscuringCharacter: '*',
controller: _textControllerP,
validator: (val) {
if (val != _textController.text) return 'Not Matched';
return null;
},
style: TextStyle(color: c.colours.onBackground),
decoration: const InputDecoration(
labelText: 'Verify Passphrase',
),
),
),
)
],
const SizedBox(height: 18),
if (state.errPassphrase != '')
Text(
state.errPassphrase,
style: c.fonts.caption!.copyWith(
color: c.colours.error,
),
),
const SizedBox(height: 14),
Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: c.colours.primary,
onPrimary: c.colours.background,
),
onPressed: () {
if (_form.currentState!.validate()) {
c.read<SeedGenerateCubit>().generateSeed();
}
},
child: Text('Confirm'.toUpperCase()),
),
)
],
),
);
},
);
Expand Down Expand Up @@ -196,7 +225,11 @@ class SeedGenerate extends StatelessWidget {
const SizedBox(height: 24),
Padding(
padding: const EdgeInsets.all(4),
child: TextButton(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: c.colours.primary,
onPrimary: c.colours.background,
),
onPressed: () {
c.read<SeedGenerateCubit>().startQuiz();
},
Expand Down
6 changes: 5 additions & 1 deletion lib/ui/component/NewWallet/SeedGenerate/Label.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ class SeedGenerateLabel extends StatelessWidget {
const SizedBox(height: 24),
Padding(
padding: const EdgeInsets.all(16.0),
child: TextButton(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: c.colours.primary,
onPrimary: c.colours.background,
),
onPressed: () {
c.read<SeedGenerateWalletCubit>().nextClicked();
},
Expand Down
6 changes: 5 additions & 1 deletion lib/ui/component/NewWallet/SeedGenerate/Warning.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ doing on airplane mode during this process.
style: c.fonts.caption!.copyWith(color: c.colours.onPrimary),
),
const SizedBox(height: 24),
TextButton(
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: c.colours.primary,
onPrimary: c.colours.background,
),
onPressed: () {
c.read<SeedGenerateWalletCubit>().nextClicked();
},
Expand Down
12 changes: 10 additions & 2 deletions lib/ui/component/NewWallet/SeedImport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ class SeedImportPhrase extends StatelessWidget {
AnimatedOpacity(
opacity: state.showSeedCompleteButton() ? 1 : 0.3,
duration: const Duration(milliseconds: 300),
child: TextButton(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: c.colours.primary,
onPrimary: c.colours.background,
),
onPressed: () {
if (state.showSeedCompleteButton())
c.read<SeedImportCubit>().checkPassPhrase();
Expand Down Expand Up @@ -121,7 +125,11 @@ class SeedImportPassphrase extends StatelessWidget {
),
Padding(
padding: const EdgeInsets.all(16.0),
child: TextButton(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: c.colours.primary,
onPrimary: c.colours.background,
),
onPressed: () {
c.read<SeedImportCubit>().checkSeed();
},
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/component/NewWallet/SeedImport/Label.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class SeedImportLabel extends StatelessWidget {
),
),
const SizedBox(height: 40),
if (state.savingWalletError != '')
if (state.walletLabelError != '')
Text(
state.savingWalletError,
state.walletLabelError,
style: c.fonts.caption!.copyWith(color: c.colours.error),
textAlign: TextAlign.center,
),
Expand Down
6 changes: 5 additions & 1 deletion lib/ui/component/NewWallet/XpubImport.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ class _XpubImportFieldsState extends State<XpubFieldsImport> {
),
Padding(
padding: const EdgeInsets.all(16.0),
child: TextButton(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: c.colours.primary,
onPrimary: c.colours.background,
),
onPressed: () {
c.read<XpubImportCubit>().checkDetails();
},
Expand Down
6 changes: 5 additions & 1 deletion lib/ui/component/NewWallet/XpubImport/Label.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ class XpubLabel extends StatelessWidget {
),
Padding(
padding: const EdgeInsets.all(16.0),
child: TextButton(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: c.colours.primary,
onPrimary: c.colours.background,
),
onPressed: () {
c.read<XpubImportWalletCubit>().nextClicked();
},
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/screen/Wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class _Wallet extends StatelessWidget {
Expanded(
child: Column(
children: const [
WalletName(),
//WalletName(),
Balance(),
],
),
Expand Down

0 comments on commit b633eeb

Please sign in to comment.