Skip to content

Commit

Permalink
feat: Add continue button while showing data #3054
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Nov 8, 2024
1 parent d94783e commit 10c7853
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 32 deletions.
31 changes: 11 additions & 20 deletions lib/dashboard/json_viewer/view/json_viewer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,19 @@ class JsonViewerPage extends StatelessWidget {
super.key,
required this.title,
required this.data,
required this.showContinueButton,
});

final String title;
final String data;
final bool showContinueButton;

static Route<dynamic> route({
required String title,
required String data,
bool showContinueButton = false,
}) =>
MaterialPageRoute<void>(
builder: (_) => JsonViewerPage(
title: title,
data: data,
showContinueButton: showContinueButton,
),
settings: const RouteSettings(name: '/JsonViewerPage'),
);
Expand All @@ -34,7 +30,6 @@ class JsonViewerPage extends StatelessWidget {
return JsonViewerView(
title: title,
data: data,
showContinueButton: showContinueButton,
);
}
}
Expand All @@ -44,12 +39,10 @@ class JsonViewerView extends StatelessWidget {
super.key,
required this.title,
required this.data,
required this.showContinueButton,
});

final String title;
final String data;
final bool showContinueButton;

@override
Widget build(BuildContext context) {
Expand All @@ -64,19 +57,17 @@ class JsonViewerView extends StatelessWidget {
),
padding: const EdgeInsets.symmetric(horizontal: 10),
body: JsonViewWidget(data: data),
navigation: !showContinueButton
? null
: Padding(
padding: const EdgeInsets.all(
Sizes.spaceSmall,
),
child: MyElevatedButton(
text: context.l10n.continueString,
onPressed: () {
Navigator.of(context).pop(true);
},
),
),
navigation: Padding(
padding: const EdgeInsets.all(
Sizes.spaceSmall,
),
child: MyElevatedButton(
text: context.l10n.continueString,
onPressed: () {
Navigator.of(context).pop(true);
},
),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {

if (profileCubit.state.model.isDeveloperMode) {
final value = await showDataBeforeSending(
title: 'Response Data',
title: 'RESPONSE REQUEST',
data: responseData,
);
if (value) {
Expand Down Expand Up @@ -1437,7 +1437,7 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {

if (profileCubit.state.model.isDeveloperMode) {
final value = await showDataBeforeSending(
title: 'TOKEN DATA',
title: 'TOKEN REQUEST',
data: tokenData,
);
if (value) {
Expand Down
2 changes: 1 addition & 1 deletion lib/oidc4vc/get_and_add_deffered_credential.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Future<void> getAndAddDefferedCredential({

if (profileCubit.state.model.isDeveloperMode) {
final value = await qrCodeScanCubit.showDataBeforeSending(
title: 'DEFERRED CREDENTIAL DATA',
title: 'DEFERRED CREDENTIAL REQUEST',
data: body,
);

Expand Down
2 changes: 1 addition & 1 deletion lib/oidc4vc/get_authorization_uri_for_issuer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Future<Uri?> getAuthorizationUriForIssuer({

if (profileCubit.state.model.isDeveloperMode) {
final value = await qrCodeScanCubit.showDataBeforeSending(
title: 'Pushed Authorization Request Data',
title: 'PUSHED AUTHORIZATION REQUEST',
data: authorizationRequestParemeters,
);

Expand Down
4 changes: 2 additions & 2 deletions lib/oidc4vc/get_credential.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Future<

if (profileCubit.state.model.isDeveloperMode) {
final value = await qrCodeScanCubit.showDataBeforeSending(
title: 'CREDENTIAL DATA',
title: 'CREDENTIAL REQUEST',
data: credentialData,
);

Expand Down Expand Up @@ -167,7 +167,7 @@ Future<

if (profileCubit.state.model.isDeveloperMode) {
await qrCodeScanCubit.showDataBeforeSending(
title: 'CREDENTIAL DATA',
title: 'CREDENTIAL REQUEST',
data: credentialData,
);

Expand Down
2 changes: 1 addition & 1 deletion lib/scan/cubit/scan_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ class ScanCubit extends Cubit<ScanState> {

if (profileCubit.state.model.isDeveloperMode) {
final value = await qrCodeScanCubit.showDataBeforeSending(
title: 'Response Data',
title: 'RESPONSE REQUEST',
data: body,
);
if (value) {
Expand Down
24 changes: 19 additions & 5 deletions lib/splash/bloclisteners/blocklisteners.dart
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,20 @@ final qrCodeBlocListener = BlocListener<QRCodeScanCubit, QRCodeScanState>(
context: context,
builder: (_) {
return DeveloperModeDialog(
onDisplay: () {
Navigator.of(context).push<void>(
onDisplay: () async {
final returnedValue =
await Navigator.of(context).push<dynamic>(
JsonViewerPage.route(
title: l10n.display,
data: formattedData,
),
);

if (returnedValue != null &&
returnedValue is bool &&
returnedValue) {
Navigator.of(context).pop(true);
}
return;
},
onDownload: () {
Expand Down Expand Up @@ -555,13 +562,21 @@ final qrCodeBlocListener = BlocListener<QRCodeScanCubit, QRCodeScanState>(
context: context,
builder: (_) {
return DeveloperModeDialog(
onDisplay: () {
Navigator.of(context).push<void>(
onDisplay: () async {
final returnedValue =
await Navigator.of(context).push<dynamic>(
JsonViewerPage.route(
title: l10n.display,
data: data,
),
);

if (returnedValue != null &&
returnedValue is bool &&
returnedValue) {
Navigator.of(context).pop(true);
}

return;
},
onDownload: () {
Expand Down Expand Up @@ -597,7 +612,6 @@ final qrCodeBlocListener = BlocListener<QRCodeScanCubit, QRCodeScanState>(
JsonViewerPage.route(
title: l10n.display,
data: data,
showContinueButton: true,
),
);

Expand Down

0 comments on commit 10c7853

Please sign in to comment.