6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 27ead9a1
Changed files
.../payment_processing_route.g.dart | 61 +++++ .../profile/bloc/profile_state.freezed.dart | 274 --------------------- .../payment_processing_route.dart | 51 ++-- .../profile/components/profile_page_widget.dart | 1 - comwell_key_app/lib/routing/app_router.dart | 8 +- 5 files changed, 97 insertions(+), 298 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
new file mode 100644
index 00000000..b60516a2
--- /dev/null
+++ b/comwell_key_app/lib/.generated/presentation/screens/payment_processing/payment_processing_route.g.dart
@@ -0,0 +1,61 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of '../../../../presentation/screens/payment_processing/payment_processing_route.dart';
+
+// **************************************************************************
+// GoRouterGenerator
+// **************************************************************************
+
+List<RouteBase> get $appRoutes => [$paymentCardsRoute, $paymentProcessingRoute];
+
+RouteBase get $paymentCardsRoute => GoRouteData.$route(
+ path: '/payment-cards',
+ factory: $PaymentCardsRoute._fromState,
+);
+
+mixin $PaymentCardsRoute on GoRouteData {
+ static PaymentCardsRoute _fromState(GoRouterState state) =>
+ PaymentCardsRoute();
+
+ @override
+ String get location => GoRouteData.$location('/payment-cards');
+
+ @override
+ void go(BuildContext context) => context.go(location);
+
+ @override
+ Future<T?> push<T>(BuildContext context) => context.push<T>(location);
+
+ @override
+ void pushReplacement(BuildContext context) =>
+ context.pushReplacement(location);
+
+ @override
+ void replace(BuildContext context) => context.replace(location);
+}
+
+RouteBase get $paymentProcessingRoute => GoRouteData.$route(
+ path: '/payment-processing',
+ factory: $PaymentProcessingRoute._fromState,
+);
+
+mixin $PaymentProcessingRoute on GoRouteData {
+ static PaymentProcessingRoute _fromState(GoRouterState state) =>
+ PaymentProcessingRoute();
+
+ @override
+ String get location => GoRouteData.$location('/payment-processing');
+
+ @override
+ void go(BuildContext context) => context.go(location);
+
+ @override
+ Future<T?> push<T>(BuildContext context) => context.push<T>(location);
+
+ @override
+ void pushReplacement(BuildContext context) =>
+ context.pushReplacement(location);
+
+ @override
+ void replace(BuildContext context) => context.replace(location);
+}
diff --git a/comwell_key_app/lib/.generated/presentation/screens/profile/bloc/profile_state.freezed.dart b/comwell_key_app/lib/.generated/presentation/screens/profile/bloc/profile_state.freezed.dart
deleted file mode 100644
index bd6574db..00000000
--- a/comwell_key_app/lib/.generated/presentation/screens/profile/bloc/profile_state.freezed.dart
+++ /dev/null
@@ -1,274 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-// coverage:ignore-file
-// ignore_for_file: type=lint
-// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
-
-part of '../../../../../presentation/screens/profile/bloc/profile_state.dart';
-
-// **************************************************************************
-// FreezedGenerator
-// **************************************************************************
-
-// dart format off
-T _$identity<T>(T value) => value;
-/// @nodoc
-mixin _$ProfileState {
-
- bool get isLoading; AppError get error;
-/// Create a copy of ProfileState
-/// with the given fields replaced by the non-null parameter values.
-@JsonKey(includeFromJson: false, includeToJson: false)
-@pragma('vm:prefer-inline')
-$ProfileStateCopyWith<ProfileState> get copyWith => _$ProfileStateCopyWithImpl<ProfileState>(this as ProfileState, _$identity);
-
-
-
-@override
-bool operator ==(Object other) {
- return identical(this, other) || (other.runtimeType == runtimeType&&other is ProfileState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.error, error) || other.error == error));
-}
-
-
-@override
-int get hashCode => Object.hash(runtimeType,isLoading,error);
-
-@override
-String toString() {
- return 'ProfileState(isLoading: $isLoading, error: $error)';
-}
-
-
-}
-
-/// @nodoc
-abstract mixin class $ProfileStateCopyWith<$Res> {
- factory $ProfileStateCopyWith(ProfileState value, $Res Function(ProfileState) _then) = _$ProfileStateCopyWithImpl;
-@useResult
-$Res call({
- bool isLoading, AppError error
-});
-
-
-
-
-}
-/// @nodoc
-class _$ProfileStateCopyWithImpl<$Res>
- implements $ProfileStateCopyWith<$Res> {
- _$ProfileStateCopyWithImpl(this._self, this._then);
-
- final ProfileState _self;
- final $Res Function(ProfileState) _then;
-
-/// Create a copy of ProfileState
-/// with the given fields replaced by the non-null parameter values.
-@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? error = null,}) {
- return _then(_self.copyWith(
-isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
-as bool,error: null == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
-as AppError,
- ));
-}
-
-}
-
-
-/// Adds pattern-matching-related methods to [ProfileState].
-extension ProfileStatePatterns on ProfileState {
-/// A variant of `map` that fallback to returning `orElse`.
-///
-/// It is equivalent to doing:
-/// ```dart
-/// switch (sealedClass) {
-/// case final Subclass value:
-/// return ...;
-/// case _:
-/// return orElse();
-/// }
-/// ```
-
-@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ProfileState value)? $default,{required TResult orElse(),}){
-final _that = this;
-switch (_that) {
-case _ProfileState() when $default != null:
-return $default(_that);case _:
- return orElse();
-
-}
-}
-/// A `switch`-like method, using callbacks.
-///
-/// Callbacks receives the raw object, upcasted.
-/// It is equivalent to doing:
-/// ```dart
-/// switch (sealedClass) {
-/// case final Subclass value:
-/// return ...;
-/// case final Subclass2 value:
-/// return ...;
-/// }
-/// ```
-
-@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ProfileState value) $default,){
-final _that = this;
-switch (_that) {
-case _ProfileState():
-return $default(_that);case _:
- throw StateError('Unexpected subclass');
-
-}
-}
-/// A variant of `map` that fallback to returning `null`.
-///
-/// It is equivalent to doing:
-/// ```dart
-/// switch (sealedClass) {
-/// case final Subclass value:
-/// return ...;
-/// case _:
-/// return null;
-/// }
-/// ```
-
-@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ProfileState value)? $default,){
-final _that = this;
-switch (_that) {
-case _ProfileState() when $default != null:
-return $default(_that);case _:
- return null;
-
-}
-}
-/// A variant of `when` that fallback to an `orElse` callback.
-///
-/// It is equivalent to doing:
-/// ```dart
-/// switch (sealedClass) {
-/// case Subclass(:final field):
-/// return ...;
-/// case _:
-/// return orElse();
-/// }
-/// ```
-
-@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, AppError error)? $default,{required TResult orElse(),}) {final _that = this;
-switch (_that) {
-case _ProfileState() when $default != null:
-return $default(_that.isLoading,_that.error);case _:
- return orElse();
-
-}
-}
-/// A `switch`-like method, using callbacks.
-///
-/// As opposed to `map`, this offers destructuring.
-/// It is equivalent to doing:
-/// ```dart
-/// switch (sealedClass) {
-/// case Subclass(:final field):
-/// return ...;
-/// case Subclass2(:final field2):
-/// return ...;
-/// }
-/// ```
-
-@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, AppError error) $default,) {final _that = this;
-switch (_that) {
-case _ProfileState():
-return $default(_that.isLoading,_that.error);case _:
- throw StateError('Unexpected subclass');
-
-}
-}
-/// A variant of `when` that fallback to returning `null`
-///
-/// It is equivalent to doing:
-/// ```dart
-/// switch (sealedClass) {
-/// case Subclass(:final field):
-/// return ...;
-/// case _:
-/// return null;
-/// }
-/// ```
-
-@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, AppError error)? $default,) {final _that = this;
-switch (_that) {
-case _ProfileState() when $default != null:
-return $default(_that.isLoading,_that.error);case _:
- return null;
-
-}
-}
-
-}
-
-/// @nodoc
-
-
-class _ProfileState implements ProfileState {
- const _ProfileState({this.isLoading = false, this.error = AppError.none});
-
-
-@override@JsonKey() final bool isLoading;
-@override@JsonKey() final AppError error;
-
-/// Create a copy of ProfileState
-/// with the given fields replaced by the non-null parameter values.
-@override @JsonKey(includeFromJson: false, includeToJson: false)
-@pragma('vm:prefer-inline')
-_$ProfileStateCopyWith<_ProfileState> get copyWith => __$ProfileStateCopyWithImpl<_ProfileState>(this, _$identity);
-
-
-
-@override
-bool operator ==(Object other) {
- return identical(this, other) || (other.runtimeType == runtimeType&&other is _ProfileState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.error, error) || other.error == error));
-}
-
-
-@override
-int get hashCode => Object.hash(runtimeType,isLoading,error);
-
-@override
-String toString() {
- return 'ProfileState(isLoading: $isLoading, error: $error)';
-}
-
-
-}
-
-/// @nodoc
-abstract mixin class _$ProfileStateCopyWith<$Res> implements $ProfileStateCopyWith<$Res> {
- factory _$ProfileStateCopyWith(_ProfileState value, $Res Function(_ProfileState) _then) = __$ProfileStateCopyWithImpl;
-@override @useResult
-$Res call({
- bool isLoading, AppError error
-});
-
-
-
-
-}
-/// @nodoc
-class __$ProfileStateCopyWithImpl<$Res>
- implements _$ProfileStateCopyWith<$Res> {
- __$ProfileStateCopyWithImpl(this._self, this._then);
-
- final _ProfileState _self;
- final $Res Function(_ProfileState) _then;
-
-/// Create a copy of ProfileState
-/// with the given fields replaced by the non-null parameter values.
-@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? error = null,}) {
- return _then(_ProfileState(
-isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
-as bool,error: null == error ? _self.error : error // ignore: cast_nullable_to_non_nullable
-as AppError,
- ));
-}
-
-
-}
-
-// dart format on
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 50f4f24d..01661033 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
@@ -1,5 +1,6 @@
import 'package:comwell_key_app/common/components/comwell_app_bar.dart';
import 'package:comwell_key_app/common/const.dart';
+import 'package:comwell_key_app/presentation/navigation/transitions/slide_in_transition.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -8,25 +9,37 @@ import 'package:payment_plugin/payment_plugin.dart';
import '../../../utils/locator.dart';
-final paymentProcessingRoute = GoRoute(
- path: AppRoutes.paymentProcessing,
- builder: (context, state) => const PaymentProcessingPage(),
-);
+part '../../../.generated/presentation/screens/payment_processing/payment_processing_route.g.dart';
-final paymentCardRoute = GoRoute(
- path: AppRoutes.paymentCards,
- builder: (context, state) {
- return BlocProvider(
- create: (context) => PaymentCardsCubit(adyenRepository: locator()),
- child: Builder(
- builder: (context) {
- final scaffold = state.uri.queryParameters[needsScaffold] == 'true';
- return PaymentCardsPage(
- needScaffold: scaffold,
- appBar: const ComwellAppBar(shouldShowProfileButton: false),
- );
- },
+@TypedGoRoute<PaymentCardsRoute>(path: AppRoutes.paymentCards)
+class PaymentCardsRoute extends GoRouteData with $PaymentCardsRoute {
+ @override
+ Page<void> buildPage(BuildContext context, GoRouterState state) {
+ return SlideInTransition(
+ state: state,
+ child: BlocProvider(
+ create: (context) => PaymentCardsCubit(adyenRepository: locator()),
+ child: Builder(
+ builder: (context) {
+ final scaffold = state.uri.queryParameters[needsScaffold] == 'true';
+ return PaymentCardsPage(
+ needScaffold: scaffold,
+ appBar: const ComwellAppBar(shouldShowProfileButton: false),
+ );
+ },
+ ),
),
);
- },
-);
+ }
+}
+
+@TypedGoRoute<PaymentProcessingRoute>(path: AppRoutes.paymentProcessing)
+class PaymentProcessingRoute extends GoRouteData with $PaymentProcessingRoute {
+ @override
+ Page<void> buildPage(BuildContext context, GoRouterState state) {
+ return SlideInTransition(
+ state: state,
+ child: const 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 082fff0b..72ef5af9 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
@@ -76,7 +76,6 @@ class ProfilePageWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right,
onTap: () async {
await context.push(AppRoutes.profileSettings);
- cubit.init();
},
),
const Padding(
diff --git a/comwell_key_app/lib/routing/app_router.dart b/comwell_key_app/lib/routing/app_router.dart
index f9d0800f..74edccf0 100644
--- a/comwell_key_app/lib/routing/app_router.dart
+++ b/comwell_key_app/lib/routing/app_router.dart
@@ -82,6 +82,10 @@ final router = GoRouter(
$permissionOverviewRoute,
$profileSettingsRoute,
$profileRoute,
+ $conciergeRoute,
+ $paymentCardsRoute,
+ $paymentProcessingRoute,
+ $receivedSharedBookingRoute,
overviewRoute,
changePasswordRoute,
webviewRoute,
@@ -97,16 +101,12 @@ final router = GoRouter(
forceUpdateRoute,
bookingDetailsWithIdRoute,
findBookingLoadingRoute,
- $conciergeRoute,
myBookingRoute,
- paymentCardRoute,
preregistrationRoute,
houseKeepingRoute,
- paymentProcessingRoute,
$notificationsRoute,
...checkOutRoutes,
upSalesRoute,
roomInfoRoute,
- $receivedSharedBookingRoute,
],
);