Skip to content

Commit

Permalink
OIDC4VCI Test 9 : improve the design and flow #1822
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Aug 21, 2023
1 parent 08fed3b commit e9ed3a3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
35 changes: 18 additions & 17 deletions lib/dashboard/user_pin/view/user_pin_page.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import 'dart:io';

import 'package:altme/app/app.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/l10n/l10n.dart';
import 'package:altme/theme/theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class UserPinPage extends StatelessWidget {
const UserPinPage({
Expand Down Expand Up @@ -63,17 +61,22 @@ class _UserPinViewState extends State<UserPinView> {

Future<void> _onPaste(TextSelectionDelegate value) async {
final ClipboardData? data = await Clipboard.getData(Clipboard.kTextPlain);
final text = data?.text ?? '';
var text = data?.text ?? '';
if (text.isEmpty) {
return;
} else {
if (text.length > 6) {
text = text.substring(0, 6);
}
_setPinControllerText(text);
}
}

void _insertKey(String key) {
final text = pinController.text;
_setPinControllerText(text + key);
final addedText = text + key;
if (text.length >= 6) return;
_setPinControllerText(addedText);
}

void _setPinControllerText(String text) {
Expand Down Expand Up @@ -109,13 +112,13 @@ class _UserPinViewState extends State<UserPinView> {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
const SizedBox(height: Sizes.space2XLarge),
const SizedBox(height: Sizes.spaceXLarge),
Text(
l10n.pleaseInsertThePinCode,
l10n.pleaseInsertTheSecredCodeReceived,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: Sizes.space2XLarge),
const SizedBox(height: Sizes.spaceXLarge),
Form(
autovalidateMode: AutovalidateMode.onUserInteraction,
child: TextFormField(
Expand All @@ -133,23 +136,18 @@ class _UserPinViewState extends State<UserPinView> {
FilteringTextInputFormatter.digitsOnly,
],
cursorRadius: const Radius.circular(4),
textAlign: TextAlign.start,
decoration: InputDecoration(
border: const OutlineInputBorder(
textAlign: TextAlign.center,
decoration: const InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.all(
Radius.circular(Sizes.smallRadius),
),
),
hintText: '000000',
contentPadding: const EdgeInsets.symmetric(
contentPadding: EdgeInsets.symmetric(
vertical: 5,
horizontal: 10,
),
suffixStyle:
Theme.of(context).textTheme.titleLarge?.copyWith(
color: Colors.white,
fontWeight: FontWeight.w900,
),
),
),
),
Expand Down Expand Up @@ -219,7 +217,10 @@ class _UserPinViewState extends State<UserPinView> {
child: MyElevatedButton(
borderRadius: Sizes.normalRadius,
text: l10n.next,
onPressed: () => widget.onProceed.call(pinController.text),
onPressed: () {
Navigator.pop(context);
widget.onProceed.call(pinController.text);
},
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/l10n/arb/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@
"pleaseSwitchToCorrectOIDC4VCProfile": "Please switch to correct OIDC4VC profile.",
"authenticationSuccess": "Authentication Success",
"format": "Format",
"pleaseInsertThePinCode": "Please insert the pincode.",
"pleaseInsertTheSecredCodeReceived": "Please insert the secret code received.",
"userConsentForIssuerAccess": "User consent for issuer access",
"userConsentForVerifierAccess": "User consent for verifier access",
"userPINCodeForAuthentication": "User PIN code for authentication"
Expand Down
8 changes: 4 additions & 4 deletions lib/l10n/untranslated.json
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@
"pleaseSwitchToCorrectOIDC4VCProfile",
"authenticationSuccess",
"format",
"pleaseInsertThePinCode",
"pleaseInsertTheSecredCodeReceived",
"userConsentForIssuerAccess",
"userConsentForVerifierAccess",
"userPINCodeForAuthentication"
Expand Down Expand Up @@ -1693,7 +1693,7 @@
"pleaseSwitchToCorrectOIDC4VCProfile",
"authenticationSuccess",
"format",
"pleaseInsertThePinCode",
"pleaseInsertTheSecredCodeReceived",
"userConsentForIssuerAccess",
"userConsentForVerifierAccess",
"userPINCodeForAuthentication"
Expand Down Expand Up @@ -1846,7 +1846,7 @@
"pleaseSwitchToCorrectOIDC4VCProfile",
"authenticationSuccess",
"format",
"pleaseInsertThePinCode",
"pleaseInsertTheSecredCodeReceived",
"userConsentForIssuerAccess",
"userConsentForVerifierAccess",
"userPINCodeForAuthentication"
Expand Down Expand Up @@ -2696,7 +2696,7 @@
"pleaseSwitchToCorrectOIDC4VCProfile",
"authenticationSuccess",
"format",
"pleaseInsertThePinCode",
"pleaseInsertTheSecredCodeReceived",
"userConsentForIssuerAccess",
"userConsentForVerifierAccess",
"userPINCodeForAuthentication"
Expand Down

0 comments on commit e9ed3a3

Please sign in to comment.