6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit e713d94c
Changed files
.../payment_processing_route.g.dart | 41 ++++++++++++++++++++-- .../payment_processing_route.dart | 12 +++---- .../profile/components/profile_page_widget.dart | 13 +++---- 3 files changed, 51 insertions(+), 15 deletions(-)
Diff
diff --git a/comwell_key_app/lib/.generated/presentation/screens/payment_processing/payment_processing_route.g.dart b/comwell_key_app/lib/.generated/presentation/screens/payment_processing/payment_processing_route.g.dart
index b60516a2..f93d7982 100644
--- a/comwell_key_app/lib/.generated/presentation/screens/payment_processing/payment_processing_route.g.dart
+++ b/comwell_key_app/lib/.generated/presentation/screens/payment_processing/payment_processing_route.g.dart
@@ -14,11 +14,26 @@ RouteBase get $paymentCardsRoute => GoRouteData.$route(
);
mixin $PaymentCardsRoute on GoRouteData {
- static PaymentCardsRoute _fromState(GoRouterState state) =>
- PaymentCardsRoute();
+ static PaymentCardsRoute _fromState(GoRouterState state) => PaymentCardsRoute(
+ needsScaffold:
+ _$convertMapValue(
+ 'needs-scaffold',
+ state.uri.queryParameters,
+ _$boolConverter,
+ ) ??
+ false,
+ );
+
+ PaymentCardsRoute get _self => this as PaymentCardsRoute;
@override
- String get location => GoRouteData.$location('/payment-cards');
+ String get location => GoRouteData.$location(
+ '/payment-cards',
+ queryParams: {
+ if (_self.needsScaffold != false)
+ 'needs-scaffold': _self.needsScaffold.toString(),
+ },
+ );
@override
void go(BuildContext context) => context.go(location);
@@ -34,6 +49,26 @@ mixin $PaymentCardsRoute on GoRouteData {
void replace(BuildContext context) => context.replace(location);
}
+T? _$convertMapValue<T>(
+ String key,
+ Map<String, String> map,
+ T? Function(String) converter,
+) {
+ final value = map[key];
+ return value == null ? null : converter(value);
+}
+
+bool _$boolConverter(String value) {
+ switch (value) {
+ case 'true':
+ return true;
+ case 'false':
+ return false;
+ default:
+ throw UnsupportedError('Cannot convert "$value" into a bool.');
+ }
+}
+
RouteBase get $paymentProcessingRoute => GoRouteData.$route(
path: '/payment-processing',
factory: $PaymentProcessingRoute._fromState,
diff --git a/comwell_key_app/lib/presentation/screens/payment_processing/payment_processing_route.dart b/comwell_key_app/lib/presentation/screens/payment_processing/payment_processing_route.dart
index 01661033..4729b948 100644
--- a/comwell_key_app/lib/presentation/screens/payment_processing/payment_processing_route.dart
+++ b/comwell_key_app/lib/presentation/screens/payment_processing/payment_processing_route.dart
@@ -13,6 +13,10 @@ part '../../../.generated/presentation/screens/payment_processing/payment_proces
@TypedGoRoute<PaymentCardsRoute>(path: AppRoutes.paymentCards)
class PaymentCardsRoute extends GoRouteData with $PaymentCardsRoute {
+ final bool needsScaffold;
+
+ const PaymentCardsRoute({this.needsScaffold = false});
+
@override
Page<void> buildPage(BuildContext context, GoRouterState state) {
return SlideInTransition(
@@ -21,9 +25,8 @@ class PaymentCardsRoute extends GoRouteData with $PaymentCardsRoute {
create: (context) => PaymentCardsCubit(adyenRepository: locator()),
child: Builder(
builder: (context) {
- final scaffold = state.uri.queryParameters[needsScaffold] == 'true';
return PaymentCardsPage(
- needScaffold: scaffold,
+ needScaffold: needsScaffold,
appBar: const ComwellAppBar(shouldShowProfileButton: false),
);
},
@@ -37,9 +40,6 @@ class PaymentCardsRoute extends GoRouteData with $PaymentCardsRoute {
class PaymentProcessingRoute extends GoRouteData with $PaymentProcessingRoute {
@override
Page<void> buildPage(BuildContext context, GoRouterState state) {
- return SlideInTransition(
- state: state,
- child: const PaymentProcessingPage(),
- );
+ return const NoTransitionPage(child: PaymentProcessingPage());
}
}
diff --git a/comwell_key_app/lib/presentation/screens/profile/components/profile_page_widget.dart b/comwell_key_app/lib/presentation/screens/profile/components/profile_page_widget.dart
index 72ef5af9..e5fb86a0 100644
--- a/comwell_key_app/lib/presentation/screens/profile/components/profile_page_widget.dart
+++ b/comwell_key_app/lib/presentation/screens/profile/components/profile_page_widget.dart
@@ -1,7 +1,9 @@
import 'package:comwell_key_app/.generated/assets/assets.gen.dart';
import 'package:comwell_key_app/common/components/comwell_card_component.dart';
import 'package:comwell_key_app/common/components/round_icon_button.dart';
+import 'package:comwell_key_app/presentation/screens/payment_processing/payment_processing_route.dart';
import 'package:comwell_key_app/presentation/screens/permission_overview/permission_overview_route.dart';
+import 'package:comwell_key_app/presentation/screens/profile_settings/profile_settings_route.dart';
import 'card_content_widget.dart';
import 'comwell_club_container.dart';
import 'logout_dialog_widget.dart';
@@ -24,7 +26,7 @@ class ProfilePageWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final user = cubit.state.user;
- final isActive = cubit.state.user?.isClubMember == true;
+ final isActive = cubit.state.user.isClubMember == true;
return SingleChildScrollView(
child: Column(
@@ -34,7 +36,7 @@ class ProfilePageWidget extends StatelessWidget {
child: Container(
alignment: Alignment.centerRight,
child: RoundIconButton(
- icon: "assets/icons/close-icon.svg",
+ icon: Assets.icons.closeIcon.path,
color: Colors.white,
onPressed: () {
context.pop();
@@ -62,7 +64,7 @@ class ProfilePageWidget extends StatelessWidget {
const SizedBox(height: 10),
!isActive
? ComwellClubContainer(
- user: user!,
+ user: user,
onSignupClick: () {
cubit.init();
},
@@ -75,7 +77,7 @@ class ProfilePageWidget extends StatelessWidget {
text: context.strings.profile_settings_profile_menu,
trailingIcon: Icons.chevron_right,
onTap: () async {
- await context.push(AppRoutes.profileSettings);
+ ProfileSettingsRoute().push(context);
},
),
const Padding(
@@ -88,7 +90,7 @@ class ProfilePageWidget extends StatelessWidget {
text: context.strings.payment_card_profile_menu,
trailingIcon: Icons.chevron_right,
onTap: () {
- context.push("${AppRoutes.paymentCards}?needsScaffold=true");
+ const PaymentCardsRoute(needsScaffold: true).push(context);
},
),
const Padding(
@@ -171,7 +173,6 @@ class ProfilePageWidget extends StatelessWidget {
},
),
AppSpaces.gap40,
-
],
),
),