-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
513 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:auto_route/auto_route.dart'; | ||
import 'package:flutter_ducafecat_news/common/router/router.gr.dart'; | ||
import 'package:flutter_ducafecat_news/common/utils/utils.dart'; | ||
|
||
class AuthGuard extends RouteGuard { | ||
@override | ||
Future<bool> canNavigate(ExtendedNavigatorState navigator, String routeName, | ||
Object arguments) async { | ||
var isAuth = await isAuthenticated(); | ||
if (isAuth == false) { | ||
ExtendedNavigator.rootNavigator.pushNamed(Routes.signInPageRoute); | ||
} | ||
|
||
return isAuth; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'package:auto_route/auto_route_annotations.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_ducafecat_news/common/router/auth_grard.dart'; | ||
import 'package:flutter_ducafecat_news/pages/application/application.dart'; | ||
import 'package:flutter_ducafecat_news/pages/details/details.dart'; | ||
import 'package:flutter_ducafecat_news/pages/index/index.dart'; | ||
import 'package:flutter_ducafecat_news/pages/sign_in/sign_in.dart'; | ||
import 'package:flutter_ducafecat_news/pages/sign_up/sign_up.dart'; | ||
import 'package:flutter_ducafecat_news/pages/welcome/welcome.dart'; | ||
|
||
Widget zoomInTransition(BuildContext context, Animation<double> animation, | ||
Animation<double> secondaryAnimation, Widget child) { | ||
// you get an animation object and a widget | ||
// make your own transition | ||
return ScaleTransition(scale: animation, child: child); | ||
} | ||
|
||
@MaterialAutoRouter() | ||
class $AppRouter { | ||
@initial | ||
IndexPage indexPageRoute; | ||
|
||
WelcomePage welcomePageRoute; | ||
|
||
SignInPage signInPageRoute; | ||
|
||
SignUpPage signUpPageRoute; | ||
|
||
@GuardedBy([AuthGuard]) | ||
ApplicationPage applicationPageRoute; | ||
|
||
@GuardedBy([AuthGuard]) | ||
DetailsPage detailsPageRoute; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.