mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-23 10:47:55 +00:00
Implemented Navigation
This commit is contained in:
@@ -4,17 +4,17 @@ import 'routing_constants.dart';
|
||||
|
||||
class RouteManager {
|
||||
List<String> routesWithoutLogin = [
|
||||
RouteConstants.homeRoute,
|
||||
Routes.homeRoute,
|
||||
];
|
||||
|
||||
List<String> exclusionList = [];
|
||||
|
||||
//TODO (to mohammad) add the context extension
|
||||
routerManager({required String routeName, required BuildContext context}) {
|
||||
Navigator.of(context).pushNamed(routeName);
|
||||
}
|
||||
|
||||
routerManagerPushUntil(
|
||||
{required String routeName, required BuildContext? context}) {
|
||||
routerManagerPushUntil(BuildContext? context, {required String routeName}) {
|
||||
if (context != null) {
|
||||
Navigator.of(context)
|
||||
.pushNamedAndRemoveUntil(routeName, (route) => false);
|
||||
|
||||
@@ -1,16 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_app/features/home/view/home_view.dart';
|
||||
import 'package:syncrow_app/features/profile/view/profile_view.dart';
|
||||
import 'package:syncrow_app/features/scene/view/scene_view.dart';
|
||||
import 'package:syncrow_app/features/smart/view/smart_view.dart';
|
||||
import 'package:syncrow_app/features/splash/splash_view.dart';
|
||||
|
||||
import 'routing_constants.dart';
|
||||
|
||||
class Router {
|
||||
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||
switch (settings.name) {
|
||||
case RouteConstants.homeRoute:
|
||||
case Routes.splash:
|
||||
return MaterialPageRoute(
|
||||
builder: (_) => const SplashView(), settings: settings);
|
||||
|
||||
case Routes.homeRoute:
|
||||
return MaterialPageRoute(
|
||||
builder: (_) => const HomeView(), settings: settings);
|
||||
|
||||
// Default route, if no route this will show
|
||||
case Routes.profileRoute:
|
||||
return MaterialPageRoute(
|
||||
builder: (_) => const ProfileView(), settings: settings);
|
||||
|
||||
case Routes.sceneRoute:
|
||||
return MaterialPageRoute(
|
||||
builder: (_) => const SceneView(), settings: settings);
|
||||
|
||||
case Routes.smartRoute:
|
||||
return MaterialPageRoute(
|
||||
builder: (_) => const SmartView(), settings: settings);
|
||||
|
||||
default:
|
||||
return MaterialPageRoute(
|
||||
builder: (_) => Scaffold(
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
class RouteConstants {
|
||||
static const String homeRoute = "/";
|
||||
// static const String splash = '/';
|
||||
class Routes {
|
||||
static const String splash = '/';
|
||||
static const String homeRoute = '/home';
|
||||
static const String sceneRoute = '/scene';
|
||||
static const String smartRoute = '/smart';
|
||||
static const String profileRoute = '/profile';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user