Skip to content

Commit

Permalink
modified implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
weng-deriv committed Jul 8, 2024
1 parent b1f85af commit 65bf7c2
Showing 1 changed file with 28 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ class EffortlessPasskeysPage extends StatelessWidget
required this.onPageClosed,
required this.addMorePasskeysNavigationCallback,
required this.continueTradingNavigationCallback,
this.createPassKeyButtonKey,
this.hyperLinkInkWellKey,
this.maybeLaterTextButtonKey,
this.effortlessPasskeysPageKeys,
super.key,
}) {
trackOpenEffortlessLoginPage();
Expand All @@ -41,14 +39,8 @@ class EffortlessPasskeysPage extends StatelessWidget
/// Callback to be called when the flow is complete.
final void Function(BuildContext context) onPageClosed;

/// Key for create passkey button widget.
final Key? createPassKeyButtonKey;

/// Key for hyper link ink well widget.
final Key? hyperLinkInkWellKey;

/// Key for maybe later text button widget..
final Key? maybeLaterTextButtonKey;
/// Pass an object of keys to assign to specific widget in this page.
final EffortlessPasskeysPageKeys? effortlessPasskeysPageKeys;

@override
Widget build(BuildContext context) => WillPopScope(
Expand Down Expand Up @@ -103,7 +95,8 @@ class EffortlessPasskeysPage extends StatelessWidget
child: Padding(
padding: const EdgeInsets.all(16),
child: TextButton(
key: maybeLaterTextButtonKey,
key: effortlessPasskeysPageKeys
?.maybeLaterTextButtonKey,
onPressed: () {
trackMaybeLater();
onPageClosed(context);
Expand Down Expand Up @@ -183,7 +176,8 @@ class EffortlessPasskeysPage extends StatelessWidget
PlaceholderAlignment
.middle,
child: InkWell(
key: hyperLinkInkWellKey,
key: effortlessPasskeysPageKeys
?.hyperLinkInkWellKey,
onTap: () {
Navigator.push(
context,
Expand Down Expand Up @@ -232,7 +226,8 @@ class EffortlessPasskeysPage extends StatelessWidget
child: Padding(
padding: const EdgeInsets.all(16),
child: PrimaryButton(
key: createPassKeyButtonKey,
key: effortlessPasskeysPageKeys
?.createPassKeyButtonKey,
onPressed: () {
trackCreatePasskey();
context.read<DerivPasskeysBloc>().add(
Expand All @@ -258,3 +253,22 @@ class EffortlessPasskeysPage extends StatelessWidget
),
);
}

/// A class that allows users to pass keys to [EffortlessPasskeysPage].
class EffortlessPasskeysPageKeys {
/// Constructs [EffortlessPasskeysPageKeys].
EffortlessPasskeysPageKeys({
this.createPassKeyButtonKey,
this.hyperLinkInkWellKey,
this.maybeLaterTextButtonKey,
});

/// Key for create passkey button widget.
final Key? createPassKeyButtonKey;

/// Key for hyper link ink well widget.
final Key? hyperLinkInkWellKey;

/// Key for maybe later text button widget.
final Key? maybeLaterTextButtonKey;
}

0 comments on commit 65bf7c2

Please sign in to comment.