Skip to content

Commit

Permalink
Add screens
Browse files Browse the repository at this point in the history
  • Loading branch information
PlugFox committed Nov 21, 2023
1 parent fe9fd97 commit c690f24
Show file tree
Hide file tree
Showing 15 changed files with 211 additions and 4 deletions.
7 changes: 5 additions & 2 deletions example/lib/src/common/router/routes.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'package:example/src/feature/category/widget/category_screen.dart';
import 'package:example/src/feature/product/widget/product_screen.dart';
import 'package:example/src/feature/home/widget/home_screen.dart';
import 'package:example/src/feature/shop/widget/category_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 {
home('home'),
shop('shop'),
category('category'),
product('product');
Expand All @@ -16,6 +18,7 @@ enum Routes with OctopusRoute {

@override
Widget builder(BuildContext context, OctopusNode node) => switch (this) {
Routes.home => const HomeScreen(),
Routes.shop => const ShopScreen(),
Routes.category => CategoryScreen(id: node.arguments['id']),
Routes.product => ProductScreen(id: node.arguments['id']),
Expand Down
21 changes: 21 additions & 0 deletions example/lib/src/feature/account/widget/profile_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Profile'),
),
body: const SafeArea(
child: Center(
child: Text('Profile'),
),
),
);
}
21 changes: 21 additions & 0 deletions example/lib/src/feature/account/widget/settings_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Settings'),
),
body: const SafeArea(
child: Center(
child: Text('Settings'),
),
),
);
}
Empty file.
21 changes: 21 additions & 0 deletions example/lib/src/feature/authentication/widget/signin_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Sign-In'),
),
body: const SafeArea(
child: Center(
child: Text('Sign-In'),
),
),
);
}
21 changes: 21 additions & 0 deletions example/lib/src/feature/authentication/widget/signup_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Sign-Up'),
),
body: const SafeArea(
child: Center(
child: Text('Sign-Up'),
),
),
);
}
21 changes: 21 additions & 0 deletions example/lib/src/feature/gallery/widget/gallery_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Gallery'),
),
body: const SafeArea(
child: Center(
child: Text('Gallery'),
),
),
);
}
38 changes: 38 additions & 0 deletions example/lib/src/feature/home/widget/home_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Home'),
),
body: SafeArea(
child: ListView(
padding: const EdgeInsets.all(16),
children: <Widget>[
ListTile(
title: const Text('Shop'),
subtitle: const Text('Shop description'),
onTap: () {},
),
ListTile(
title: const Text('Gallery'),
subtitle: const Text('Gallery description'),
onTap: () {},
),
ListTile(
title: const Text('Account'),
subtitle: const Text('Account description'),
onTap: () {},
),
],
),
),
);
}
21 changes: 21 additions & 0 deletions example/lib/src/feature/shop/widget/basket_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Basket'),
),
body: const SafeArea(
child: Center(
child: Text('Basket'),
),
),
);
}
21 changes: 21 additions & 0 deletions example/lib/src/feature/shop/widget/catalog_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Catalog'),
),
body: const SafeArea(
child: Center(
child: Text('Catalog'),
),
),
);
}
21 changes: 21 additions & 0 deletions example/lib/src/feature/shop/widget/favorites_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text('Favorites'),
),
body: const SafeArea(
child: Center(
child: Text('Favorites'),
),
),
);
}
1 change: 0 additions & 1 deletion example/lib/src/feature/shop/widget/shop_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class ShopScreen extends StatelessWidget {
(state) => state
..push(Routes.category.node(arguments: {'id': 'electronic'})),
),

/* Octopus.instance.setState((state) => state.copyWith(
newChildren: <OctopusNode>[
...state.children,
Expand Down
1 change: 0 additions & 1 deletion lib/src/state/state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class OctopusState extends _OctopusTree with _OctopusStateMethods {
/// │ ├── Basket
/// │ └── Favorites
/// ├── Gallery
/// ├── Camera
/// └── Account
/// ├── Profile
/// └── Settings
Expand Down

0 comments on commit c690f24

Please sign in to comment.