From 6b5ee081cc7d3d50c6f6d8977684db6fc2a1dee6 Mon Sep 17 00:00:00 2001 From: Isaac Obella Date: Mon, 10 Oct 2022 13:24:27 +0300 Subject: [PATCH] fix: License page issue & rebase --- lib/presentation/auth/auth_screen.dart | 6 +++--- lib/presentation/auth/widgets/profile_photo.dart | 4 ++-- lib/presentation/auth/widgets/verified.dart | 8 ++++---- lib/presentation/core/routes/router.dart | 11 ++++++++++- .../widgets/participation_count_text.dart | 11 +++++------ .../crowdaction_participants_screen.dart | 4 ++-- 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/lib/presentation/auth/auth_screen.dart b/lib/presentation/auth/auth_screen.dart index 73e4bf14..1504d5cb 100644 --- a/lib/presentation/auth/auth_screen.dart +++ b/lib/presentation/auth/auth_screen.dart @@ -1,12 +1,12 @@ -import 'package:auto_route/auto_route.dart'; import 'package:collaction_app/application/user/profile/profile_bloc.dart'; import 'package:dots_indicator/dots_indicator.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:go_router/go_router.dart'; import '../../application/auth/auth_bloc.dart'; import '../../infrastructure/core/injection.dart'; -import '../routes/app_routes.gr.dart'; +import '../core/routes/app_page.dart'; import '../shared_widgets/custom_app_bars/custom_appbar.dart'; import '../themes/constants.dart'; import '../utils/context.ext.dart'; @@ -125,7 +125,7 @@ class _AuthPageState extends State { } void _authDone(BuildContext context) => - context.router.replaceAll([const VerifiedRoute()]); + context.replace(AppPage.verified.toPath); void _toPage(int page) => _pageController.animateToPage( page, diff --git a/lib/presentation/auth/widgets/profile_photo.dart b/lib/presentation/auth/widgets/profile_photo.dart index c333b81b..a9ba59f8 100644 --- a/lib/presentation/auth/widgets/profile_photo.dart +++ b/lib/presentation/auth/widgets/profile_photo.dart @@ -1,8 +1,8 @@ import 'dart:io'; -import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:go_router/go_router.dart'; import '../../../application/auth/auth_bloc.dart'; import '../../../application/user/avatar/avatar_bloc.dart'; @@ -43,7 +43,7 @@ class _SelectProfilePhotoState extends State { /// TODO: Loading indication }, uploadSuccess: () { - context.router.pop(); + context.pop(); }, uploadFailed: () { /// TODO: Show error snackbar | Implement failures diff --git a/lib/presentation/auth/widgets/verified.dart b/lib/presentation/auth/widgets/verified.dart index c9f0ca5e..aba6250c 100644 --- a/lib/presentation/auth/widgets/verified.dart +++ b/lib/presentation/auth/widgets/verified.dart @@ -1,13 +1,13 @@ -import 'package:auto_route/auto_route.dart'; import 'package:collaction_app/application/user/profile/profile_bloc.dart'; import 'package:collaction_app/infrastructure/core/injection.dart'; import 'package:collaction_app/presentation/shared_widgets/shimmers/title_shimmer_line.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:go_router/go_router.dart'; import 'package:rive/rive.dart'; import 'package:shimmer/shimmer.dart'; -import '../../routes/app_routes.gr.dart'; +import '../../core/routes/app_page.dart'; import '../../shared_widgets/pill_button.dart'; import '../../themes/constants.dart'; @@ -81,12 +81,12 @@ class VerifiedPage extends StatelessWidget { const SizedBox(height: 40), PillButton( onTap: () => - context.router.replaceAll([const HomeRoute()]), + context.replace(AppPage.home.toPath), text: 'Go to CrowdActions', ), TextButton( onPressed: () => - context.router.replaceAll([const HomeRoute()]), + context.replace(AppPage.home.toPath), child: const Text( 'Show me all CrowdActions', style: TextStyle( diff --git a/lib/presentation/core/routes/router.dart b/lib/presentation/core/routes/router.dart index 38cbbda5..ca98ce44 100644 --- a/lib/presentation/core/routes/router.dart +++ b/lib/presentation/core/routes/router.dart @@ -1,4 +1,5 @@ import 'package:collaction_app/domain/core/i_settings_repository.dart'; +import 'package:collaction_app/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; @@ -13,6 +14,7 @@ import '../../demo/components_demo/components_demo_screen.dart'; import '../../demo/demo_screen.dart'; import '../../home/captive_screen.dart'; import '../../home/home_screen.dart'; +import '../../licenses/licenses_page.dart'; import '../../onboarding/onboarding_screen.dart'; import '../../profile/profile_screen.dart'; import '../../settings/settings_layout.dart'; @@ -71,6 +73,13 @@ class AppRouter { ); }, ), + GoRoute( + path: AppPage.crowdActionParticipants.toPath, + parentNavigatorKey: _rootNavigatorKey, + builder: (_, state) => CrowdActionParticipantsPage( + crowdActionId: state.extra! as String, + ), + ), GoRoute( path: AppPage.onBoarding.toPath, parentNavigatorKey: _rootNavigatorKey, @@ -104,7 +113,7 @@ class AppRouter { GoRoute( path: AppPage.licenses.toPath, parentNavigatorKey: _rootNavigatorKey, - builder: (_, __) => const LicensePage(), + builder: (_, __) => const LicensesPage(), ), GoRoute( path: AppPage.settingsLayout.toPath, diff --git a/lib/presentation/crowdaction/crowdaction_details/widgets/participation_count_text.dart b/lib/presentation/crowdaction/crowdaction_details/widgets/participation_count_text.dart index f5a4a693..c7088e84 100644 --- a/lib/presentation/crowdaction/crowdaction_details/widgets/participation_count_text.dart +++ b/lib/presentation/crowdaction/crowdaction_details/widgets/participation_count_text.dart @@ -1,13 +1,13 @@ -import 'package:auto_route/auto_route.dart'; import 'package:collaction_app/application/crowdaction/crowdaction_details/crowdaction_details_bloc.dart'; -import 'package:collaction_app/presentation/routes/app_routes.gr.dart'; import 'package:collaction_app/presentation/shared_widgets/shimmers/title_shimmer_line.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:go_router/go_router.dart'; import 'package:shimmer/shimmer.dart'; import '../../../../domain/crowdaction/crowdaction.dart'; import '../../../../presentation/themes/constants.dart'; +import '../../../core/routes/app_page.dart'; class ParticipationCountText extends StatelessWidget { const ParticipationCountText({ @@ -20,10 +20,9 @@ class ParticipationCountText extends StatelessWidget { @override Widget build(BuildContext context) { return GestureDetector( - onTap: () => context.router.push( - CrowdActionParticipantsRoute( - crowdActionId: crowdAction!.id, - ), + onTap: () => context.push( + AppPage.crowdActionParticipants.toPath, + extra: crowdAction!.id, ), child: BlocProvider.value( value: BlocProvider.of(context), diff --git a/lib/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart b/lib/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart index dfaf0afa..8300e4cc 100644 --- a/lib/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart +++ b/lib/presentation/crowdaction/crowdaction_participants/crowdaction_participants_screen.dart @@ -1,10 +1,10 @@ -import 'package:auto_route/auto_route.dart'; import 'package:collaction_app/application/crowdaction/crowdaction_participants/crowdaction_participants_bloc.dart'; import 'package:collaction_app/domain/participation/participation.dart'; import 'package:collaction_app/infrastructure/core/injection.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:go_router/go_router.dart'; import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; import '../../themes/constants.dart'; @@ -68,7 +68,7 @@ class CrowdActionParticipantsPage extends StatelessWidget { Icons.chevron_left, color: kPrimaryColor200, ), - onPressed: () => context.router.pop(), + onPressed: () => context.pop(), ), title: const Text( "Participants",