Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(auth_single_entry): Update settings page navigation in auth flow with callback #567

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class DerivGetStartedLayout extends StatefulWidget {
final VoidCallback onSignupTapped;

/// Navigation to be called when screen is tapped seven times.
final VoidCallback onTapNavigation;
final Function(BuildContext context) onTapNavigation;

@override
State<DerivGetStartedLayout> createState() => _DerivGetStartedLayoutState();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:flutter/material.dart';

/// Setting page model
class SettingPageModel {
/// Constructor [SettingPageModel]
Expand All @@ -7,6 +9,7 @@ class SettingPageModel {
required this.endpoint,
required this.saveValues,
required this.updateFlavorConfigs,
required this.settingsPageNavigation,
Copy link
Contributor

@sahani-deriv sahani-deriv Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make it nullable? If null use the package setting page.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sahani-deriv I have made it nullable. Thanks

});

/// Setting page App label
Expand All @@ -24,4 +27,7 @@ class SettingPageModel {
/// Update flavor configurations
final Function({required String endpoint, required String appId})
updateFlavorConfigs;

/// Settings page navigation
final Function(BuildContext context) settingsPageNavigation;
sahani-deriv marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ class GetStartedPage extends StatelessWidget {
builder: (BuildContext context) => const SignupPage(),
),
),
onTapNavigation: () {
Navigator.push(
context,
MaterialPageRoute<Widget>(
builder: (BuildContext context) => const SettingsPage(),
),
);
},
onTapNavigation:
AuthData().data.settingPageModel.settingsPageNavigation,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void main() {
patrolWidgetTest('should render DerivGetStartedLayout',
(PatrolTester $) async {
await $.pumpApp(DerivGetStartedLayout(
onTapNavigation: () {},
onTapNavigation: (context) {},
slides: [mockSlideModel],
appLogoIconPath: appLogoIconPath,
backgroundImagePath: backgroundImagePath,
Expand All @@ -49,7 +49,7 @@ void main() {
bool loginTapped = false;

await $.pumpApp(DerivGetStartedLayout(
onTapNavigation: () {},
onTapNavigation: (context) {},
slides: [mockSlideModel],
appLogoIconPath: appLogoIconPath,
backgroundImagePath: backgroundImagePath,
Expand All @@ -69,7 +69,7 @@ void main() {
bool signupTapped = false;

await $.pumpApp(DerivGetStartedLayout(
onTapNavigation: () {},
onTapNavigation: (context) {},
slides: [mockSlideModel],
appLogoIconPath: appLogoIconPath,
backgroundImagePath: backgroundImagePath,
Expand Down
Loading