Skip to content

Commit

Permalink
Add aditional routes
Browse files Browse the repository at this point in the history
  • Loading branch information
PlugFox committed Nov 21, 2023
1 parent c690f24 commit 7cf5380
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
29 changes: 28 additions & 1 deletion example/lib/src/common/router/routes.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
import 'package:example/src/feature/account/widget/account_screen.dart';
import 'package:example/src/feature/account/widget/profile_screen.dart';
import 'package:example/src/feature/account/widget/settings_screen.dart';
import 'package:example/src/feature/authentication/widget/signin_screen.dart';
import 'package:example/src/feature/authentication/widget/signup_screen.dart';
import 'package:example/src/feature/gallery/widget/gallery_screen.dart';
import 'package:example/src/feature/home/widget/home_screen.dart';
import 'package:example/src/feature/shop/widget/basket_screen.dart';
import 'package:example/src/feature/shop/widget/catalog_screen.dart';
import 'package:example/src/feature/shop/widget/category_screen.dart';
import 'package:example/src/feature/shop/widget/favorites_screen.dart';
import 'package:example/src/feature/shop/widget/product_screen.dart';
import 'package:example/src/feature/shop/widget/shop_screen.dart';
import 'package:flutter/widgets.dart';
import 'package:octopus/octopus.dart';

enum Routes with OctopusRoute {
signin('signin'),
signup('signup'),
home('home'),
shop('shop'),
catalog('catalog'),
category('category'),
product('product');
product('product'),
basket('basket'),
favorites('favorites'),
gallery('gallery'),
account('account'),
profile('profile'),
settings('settings');

const Routes(this.name);

Expand All @@ -18,9 +36,18 @@ enum Routes with OctopusRoute {

@override
Widget builder(BuildContext context, OctopusNode node) => switch (this) {
Routes.signin => const SignInScreen(),
Routes.signup => const SignUpScreen(),
Routes.home => const HomeScreen(),
Routes.shop => const ShopScreen(),
Routes.catalog => const CatalogScreen(),
Routes.category => CategoryScreen(id: node.arguments['id']),
Routes.product => ProductScreen(id: node.arguments['id']),
Routes.basket => const BasketScreen(),
Routes.favorites => const FavoritesScreen(),
Routes.gallery => const GalleryScreen(),
Routes.account => const AccountScreen(),
Routes.profile => const ProfileScreen(),
Routes.settings => const SettingsScreen(),
};
}
21 changes: 21 additions & 0 deletions example/lib/src/feature/account/widget/account_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';

/// {@template account_screen}
/// AccountScreen widget.
/// {@endtemplate}
class AccountScreen extends StatelessWidget {
/// {@macro account_screen}
const AccountScreen({super.key});

@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Account'),
),
body: const SafeArea(
child: Center(
child: Text('Account'),
),
),
);
}

0 comments on commit 7cf5380

Please sign in to comment.