Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Fix:Overflow Error on PostWideget

* Remove:Unused Hive Boxes

* Fix:Responsiveness on Icons

* Removed:dynamic Linking

* Fix:Not Changing unauthorized files

* Added:Documentation

* Removed: Empty test

* Modified:Test File name

* Add:Tests for misses

* Revert: removal of qr code

* Fix:Splash bug

* Fix:Format

* Fix:Failing test
  • Loading branch information
AyushRaghuvanshi authored and palisadian committed Jan 10, 2024
1 parent 7527838 commit 759dd83
Show file tree
Hide file tree
Showing 11 changed files with 550 additions and 434 deletions.
65 changes: 40 additions & 25 deletions lib/services/navigation_service.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// ignore_for_file: talawa_api_doc
// ignore_for_file: talawa_good_doc_comments

import 'package:flutter/material.dart';
import 'package:talawa/enums/enums.dart';
import 'package:talawa/widgets/talawa_error_dialog.dart';
Expand All @@ -21,50 +18,62 @@ import 'package:talawa/widgets/talawa_error_snackbar.dart';
class NavigationService {
GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

/// This function push the route to the navigator.
/// Pushes a Screen.
///
/// **params**:
/// * `routeName`: Name of the Route
/// * `arguments`: Set of arguments
///
/// params:
/// * [routeName]
/// * [arguments] : necessary data for the route
/// **returns**:
/// * `Future<dynamic>`: resolves if the Screen was succesfully pushed.
Future<dynamic> pushScreen(String routeName, {dynamic arguments}) {
return navigatorKey.currentState!
.pushNamed(routeName, arguments: arguments);
}

/// This function pop the initial route and push the new route to the navigator.
///
/// params:
/// * [routeName]
/// * [arguments] : necessary data for the route
/// **params**:
/// * `routeName`: Name of the Route
/// * `arguments`: Set of arguments
///
/// **returns**:
/// * `Future<dynamic>`: resolves if the Screen was succesfully popAndPushed.
Future<dynamic> popAndPushScreen(String routeName, {dynamic arguments}) {
navigatorKey.currentState!.pop();
return pushScreen(routeName, arguments: arguments);
}

/// This function push the route and replace the screen.
///
/// params:
/// * [routeName]
/// * [arguments] : necessary data for the route
/// **params**:
/// * `routeName`: Name of the Route
/// * `arguments`: Set of arguments
///
/// **returns**:
/// * `Future<dynamic>`: resolves if the Screen was succesfully pushedReplacementScreen.
Future<dynamic> pushReplacementScreen(String routeName, {dynamic arguments}) {
return navigatorKey.currentState!
.pushReplacementNamed(routeName, arguments: arguments);
}

void fromInviteLink(List<String> routeNames, List<dynamic> arguments) {
int i = 0;
removeAllAndPush('/${routeNames[i]}', '/', arguments: arguments[i]);
for (i = 1; i < routeNames.length; i++) {
pushScreen('/${routeNames[i]}', arguments: arguments[i]);
}
}
// void fromInviteLink(List<String> routeNames, List<dynamic> arguments) {
// int i = 0;
// removeAllAndPush('/${routeNames[i]}', '/', arguments: arguments[i]);
// for (i = 1; i < routeNames.length; i++) {
// pushScreen('/${routeNames[i]}', arguments: arguments[i]);
// }
// }

/// This function remove all the routes till the particular route and add new route.
///
/// params:
/// * [routeName] : route that need to add
/// * [tillRoute] : remove all route until this route.
/// * [arguments] : necessary data for the route
/// **params**:
/// * `routeName`: Name of the Route
/// * `tillRoute`: Route till we want to remove
/// * `arguments`: Set of arguments
///
/// **returns**:
/// * `Future<dynamic>`: resolves if the Screen was succesfully removeAllAndPushed.
Future<dynamic> removeAllAndPush(
String routeName,
String tillRoute, {
Expand All @@ -77,7 +86,13 @@ class NavigationService {
);
}

/// This function is used to show the custom Dialog.
/// This function remove all the routes till the particular route and add new route.
///
/// **params**:
/// * `dialog`: Widget to show
///
/// **returns**:
/// None
void pushDialog(Widget dialog) {
showDialog(
context: navigatorKey.currentContext!,
Expand Down
Loading

0 comments on commit 759dd83

Please sign in to comment.