Skip to content

Commit

Permalink
re-organize the app level and feature level folders
Browse files Browse the repository at this point in the history
  • Loading branch information
ulusoyca committed Aug 17, 2024
1 parent 4350881 commit 65a11a2
Show file tree
Hide file tree
Showing 52 changed files with 140 additions and 151 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:wolt_di/wolt_di.dart';
import 'package:coffee_maker_navigator_2/di/coffee_maker_app_level_dependency_container.dart';
import 'package:coffee_maker_navigator_2/app/di/coffee_maker_app_level_dependency_container.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:async';

import 'package:coffee_maker_navigator_2/data/auth/local/auth_local_data_source.dart';
import 'package:coffee_maker_navigator_2/app/auth/data/local/auth_local_data_source.dart';

class AuthRepository {
final AuthLocalDataSource localAuthDataSource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:async';

import 'package:coffee_maker_navigator_2/data/auth/repository/auth_repository.dart';
import 'package:coffee_maker_navigator_2/app/auth/data/repository/auth_repository.dart';
import 'package:flutter/foundation.dart';

abstract interface class AuthService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:coffee_maker_navigator_2/data/auth/local/auth_local_data_source.dart';
import 'package:coffee_maker_navigator_2/data/auth/repository/auth_repository.dart';
import 'package:coffee_maker_navigator_2/data/onboarding/local/onboarding_local_data_source.dart';
import 'package:coffee_maker_navigator_2/data/onboarding/repository/onboarding_repository.dart';
import 'package:coffee_maker_navigator_2/domain/auth/auth_service.dart';
import 'package:coffee_maker_navigator_2/domain/onboarding/onboarding_service.dart';
import 'package:coffee_maker_navigator_2/ui/router/view/app_router_delegate.dart';
import 'package:coffee_maker_navigator_2/ui/router/view_model/router_view_model.dart';
import 'package:coffee_maker_navigator_2/app/auth/data/local/auth_local_data_source.dart';
import 'package:coffee_maker_navigator_2/app/auth/data/repository/auth_repository.dart';
import 'package:coffee_maker_navigator_2/app/auth/domain/auth_service.dart';
import 'package:coffee_maker_navigator_2/features/onboarding/data/local/onboarding_local_data_source.dart';
import 'package:coffee_maker_navigator_2/features/onboarding/data/repository/onboarding_repository.dart';
import 'package:coffee_maker_navigator_2/features/onboarding/domain/onboarding_service.dart';
import 'package:coffee_maker_navigator_2/app/router/view/app_router_delegate.dart';
import 'package:coffee_maker_navigator_2/app/router/view_model/router_view_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import 'package:coffee_maker_navigator_2/domain/orders/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/ui/add_water/view/add_water_screen.dart';
import 'package:coffee_maker_navigator_2/ui/auth/view/auth_screen.dart';
import 'package:coffee_maker_navigator_2/ui/extensions/context_extensions.dart';
import 'package:coffee_maker_navigator_2/ui/onboarding/view/onboarding_modal_sheet_page.dart';
import 'package:coffee_maker_navigator_2/ui/orders/view/modal_pages/grind/grind_or_reject_modal_page.dart';
import 'package:coffee_maker_navigator_2/ui/orders/view/modal_pages/grind/reject_order_modal_page.dart';
import 'package:coffee_maker_navigator_2/ui/orders/view/orders_screen.dart';
import 'package:coffee_maker_navigator_2/ui/router/entities/app_route_settings_name.dart';
import 'package:coffee_maker_navigator_2/ui/tutorials/view/single_tutorial_screen.dart';
import 'package:coffee_maker_navigator_2/ui/tutorials/view/tutorials_screen.dart';
import 'package:coffee_maker_navigator_2/features/add_water/ui/view/add_water_screen.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/features/tutorial/view/single_tutorial_screen.dart';
import 'package:coffee_maker_navigator_2/features/tutorial/view/tutorials_screen.dart';
import 'package:coffee_maker_navigator_2/features/login/ui/view/login_screen.dart';
import 'package:coffee_maker_navigator_2/features/onboarding/ui/view/onboarding_modal_sheet_page.dart';
import 'package:coffee_maker_navigator_2/features/orders/ui/view/modal_pages/grind/grind_or_reject_modal_page.dart';
import 'package:coffee_maker_navigator_2/features/orders/ui/view/modal_pages/grind/reject_order_modal_page.dart';
import 'package:coffee_maker_navigator_2/features/orders/ui/view/orders_screen.dart';
import 'package:coffee_maker_navigator_2/app/router/entities/app_route_settings_name.dart';
import 'package:coffee_maker_navigator_2/utils/extensions/context_extensions.dart';
import 'package:flutter/material.dart';
import 'package:wolt_modal_sheet/wolt_modal_sheet.dart';

Expand All @@ -25,7 +25,7 @@ class AuthRoutePage extends AppRoutePage<void> {
@override
Route<void> createRoute(BuildContext context) {
return MaterialPageRoute<void>(
builder: (context) => const AuthScreen(),
builder: (context) => const LoginScreen(),
settings: this,
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:async';

import 'package:coffee_maker_navigator_2/ui/extensions/context_extensions.dart';
import 'package:coffee_maker_navigator_2/ui/orders/view/widgets/coffee_order_list_view_for_step.dart';
import 'package:coffee_maker_navigator_2/ui/router/entities/app_route_page.dart';
import 'package:coffee_maker_navigator_2/features/orders/ui/view/widgets/coffee_order_list_view_for_step.dart';
import 'package:coffee_maker_navigator_2/app/router/entities/app_route_page.dart';
import 'package:coffee_maker_navigator_2/utils/extensions/context_extensions.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'dart:async';

import 'package:coffee_maker_navigator_2/domain/auth/auth_service.dart';
import 'package:coffee_maker_navigator_2/domain/onboarding/onboarding_service.dart';
import 'package:coffee_maker_navigator_2/domain/orders/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/ui/orders/view/orders_screen.dart';
import 'package:coffee_maker_navigator_2/ui/router/entities/app_route_page.dart';
import 'package:coffee_maker_navigator_2/ui/router/entities/app_route_settings_name.dart';
import 'package:coffee_maker_navigator_2/ui/widgets/app_navigation_drawer.dart';
import 'package:coffee_maker_navigator_2/app/auth/domain/auth_service.dart';
import 'package:coffee_maker_navigator_2/app/ui/widgets/app_navigation_drawer.dart';
import 'package:coffee_maker_navigator_2/features/onboarding/domain/onboarding_service.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/features/orders/ui/view/orders_screen.dart';
import 'package:coffee_maker_navigator_2/app/router/entities/app_route_page.dart';
import 'package:coffee_maker_navigator_2/app/router/entities/app_route_settings_name.dart';
import 'package:flutter/material.dart';

class RouterViewModel {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:coffee_maker_navigator_2/ui/extensions/context_extensions.dart';
import 'package:coffee_maker_navigator_2/utils/extensions/context_extensions.dart';
import 'package:flutter/material.dart';

enum AppNavigationDrawerDestination {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:wolt_di/wolt_di.dart';
import 'package:coffee_maker_navigator_2/ui/orders/di/orders_dependency_container.dart';
import 'package:coffee_maker_navigator_2/domain/add_water/add_water_service.dart';
import 'package:coffee_maker_navigator_2/domain/orders/orders_service.dart';
import 'package:coffee_maker_navigator_2/ui/add_water/view_model/add_water_view_model.dart';
import 'package:coffee_maker_navigator_2/features/orders/di/orders_dependency_container.dart';
import 'package:coffee_maker_navigator_2/features/add_water/domain/add_water_service.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/orders_service.dart';
import 'package:coffee_maker_navigator_2/features/add_water/ui/view_model/add_water_view_model.dart';

class AddWaterDependencyContainer
extends FeatureWithViewModelDependencyContainer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:coffee_maker_navigator_2/domain/add_water/entities/coffee_season.dart';
import 'package:coffee_maker_navigator_2/domain/add_water/entities/water_acceptance_result.dart';
import 'package:coffee_maker_navigator_2/domain/add_water/entities/water_source.dart';
import 'package:coffee_maker_navigator_2/features/add_water/domain/entities/coffee_season.dart';
import 'package:coffee_maker_navigator_2/features/add_water/domain/entities/water_acceptance_result.dart';
import 'package:coffee_maker_navigator_2/features/add_water/domain/entities/water_source.dart';

class AddWaterService {
// We keep the business logic in client without any data source layer operations.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:coffee_maker_navigator_2/ui/add_water/di/add_water_dependency_container.dart';
import 'package:coffee_maker_navigator_2/domain/add_water/entities/water_source.dart';
import 'package:coffee_maker_navigator_2/ui/add_water/view_model/add_water_view_model.dart';
import 'package:coffee_maker_navigator_2/ui/extensions/context_extensions.dart';
import 'package:coffee_maker_navigator_2/features/add_water/di/add_water_dependency_container.dart';
import 'package:coffee_maker_navigator_2/features/add_water/domain/entities/water_source.dart';
import 'package:coffee_maker_navigator_2/features/add_water/ui/view_model/add_water_view_model.dart';
import 'package:coffee_maker_navigator_2/utils/extensions/context_extensions.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:coffee_maker_navigator_2/domain/add_water/add_water_service.dart';
import 'package:coffee_maker_navigator_2/domain/add_water/entities/water_acceptance_result.dart';
import 'package:coffee_maker_navigator_2/domain/add_water/entities/water_source.dart';
import 'package:coffee_maker_navigator_2/domain/orders/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/domain/orders/orders_service.dart';
import 'package:coffee_maker_navigator_2/features/add_water/domain/add_water_service.dart';
import 'package:coffee_maker_navigator_2/features/add_water/domain/entities/water_acceptance_result.dart';
import 'package:coffee_maker_navigator_2/features/add_water/domain/entities/water_source.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/orders_service.dart';
import 'package:flutter/foundation.dart';
import 'package:wolt_di/wolt_di.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import 'package:coffee_maker_navigator_2/di/coffee_maker_app_level_dependency_container.dart';
import 'package:coffee_maker_navigator_2/domain/auth/auth_service.dart';
import 'package:coffee_maker_navigator_2/ui/auth/view_model/auth_screen_view_model.dart';
import 'package:coffee_maker_navigator_2/app/di/coffee_maker_app_level_dependency_container.dart';
import 'package:coffee_maker_navigator_2/app/auth/domain/auth_service.dart';
import 'package:coffee_maker_navigator_2/features/login/ui/view_model/login_screen_view_model.dart';
import 'package:wolt_di/wolt_di.dart';

class AuthScreenDependencyContainer
class LoginScreenDependencyContainer
extends FeatureWithViewModelDependencyContainer {
late final AuthService _authService;

AuthScreenDependencyContainer() {
LoginScreenDependencyContainer() {
final appLevelDependencies =
bindWith<CoffeeMakerAppLevelDependencyContainer>();
_authService = appLevelDependencies.authService;
}

// ViewModel should always be created lazily.
@override
AuthScreenViewModel createViewModel() {
return AuthScreenViewModel(authService: _authService);
LoginScreenViewModel createViewModel() {
return LoginScreenViewModel(authService: _authService);
}

@override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
import 'package:coffee_maker_navigator_2/ui/auth/di/auth_screen_dependency_container.dart';
import 'package:coffee_maker_navigator_2/ui/auth/view_model/auth_screen_view_model.dart';
import 'package:coffee_maker_navigator_2/features/login/di/login_screen_dependency_container.dart';
import 'package:coffee_maker_navigator_2/features/login/ui/view_model/login_screen_view_model.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';
import 'package:wolt_di/wolt_di.dart';

class AuthScreen extends StatefulWidget {
const AuthScreen({super.key});
class LoginScreen extends StatefulWidget {
const LoginScreen({super.key});

@override
State<AuthScreen> createState() => _AuthScreenState();
State<LoginScreen> createState() => _LoginScreenState();
}

class _AuthScreenState extends State<AuthScreen>
class _LoginScreenState extends State<LoginScreen>
with
DependencyContainerSubscriptionMixin<AuthScreenDependencyContainer,
AuthScreen> {
late AuthScreenViewModel _viewModel;

@override
void initState() {
super.initState();
final dependencyContainer =
DependencyInjector.container<AuthScreenDependencyContainer>(context);
_viewModel = dependencyContainer.createViewModel();
}

FeatureWithViewModelDependencyContainerSubscriptionMixin<
LoginScreenDependencyContainer, LoginScreenViewModel, LoginScreen> {
@override
Widget build(BuildContext context) {
final textTheme = Theme.of(context).textTheme;
Expand Down Expand Up @@ -64,7 +54,7 @@ class _AuthScreenState extends State<AuthScreen>
const SizedBox(height: 30),
WoltElevatedButton(
onPressed: () {
_viewModel.onLoginPressed('email', 'password');
viewModel.onLoginPressed('email', 'password');
},
child: const Text('Sign in'),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:coffee_maker_navigator_2/domain/auth/auth_service.dart';
import 'package:coffee_maker_navigator_2/app/auth/domain/auth_service.dart';
import 'package:wolt_di/wolt_di.dart';

class AuthScreenViewModel extends WoltViewModel {
class LoginScreenViewModel extends WoltViewModel {
final AuthService authService;

AuthScreenViewModel({required this.authService});
LoginScreenViewModel({required this.authService});

Future<void> onLoginPressed(String email, String password) async {
await authService.logIn(email, password);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:async';

import 'package:coffee_maker_navigator_2/data/onboarding/local/onboarding_local_data_source.dart';
import 'package:coffee_maker_navigator_2/features/onboarding/data/local/onboarding_local_data_source.dart';

class OnboardingRepository {
final OnboardingLocalDataSource localDataSource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:coffee_maker_navigator_2/data/onboarding/repository/onboarding_repository.dart';
import 'package:coffee_maker_navigator_2/features/onboarding/data/repository/onboarding_repository.dart';

class OnboardingService {
final OnboardingRepository _tutorialRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:coffee_maker_navigator_2/ui/extensions/context_extensions.dart';
import 'package:coffee_maker_navigator_2/utils/extensions/context_extensions.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';
import 'package:wolt_modal_sheet/wolt_modal_sheet.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:async';

import 'package:coffee_maker_navigator_2/domain/orders/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/domain/orders/entities/coffee_order.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_order.dart';
import 'package:flutter/foundation.dart';

abstract interface class OrdersRemoteDataSource {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:coffee_maker_navigator_2/data/orders/remote/orders_remote_data_source.dart';
import 'package:coffee_maker_navigator_2/domain/orders/entities/coffee_order.dart';
import 'package:coffee_maker_navigator_2/features/orders/data/remote/orders_remote_data_source.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_order.dart';

import 'package:flutter/foundation.dart';

class OrdersRepository {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:coffee_maker_navigator_2/data/orders/remote/orders_remote_data_source.dart';
import 'package:coffee_maker_navigator_2/data/orders/repository/orders_repository.dart';
import 'package:coffee_maker_navigator_2/domain/orders/orders_service.dart';
import 'package:coffee_maker_navigator_2/ui/orders/view_model/orders_screen_view_model.dart';
import 'package:coffee_maker_navigator_2/features/orders/data/remote/orders_remote_data_source.dart';
import 'package:coffee_maker_navigator_2/features/orders/data/repository/orders_repository.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/orders_service.dart';
import 'package:coffee_maker_navigator_2/features/orders/ui/view_model/orders_screen_view_model.dart';
import 'package:wolt_di/wolt_di.dart';

class OrdersDependencyContainer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:coffee_maker_navigator_2/domain/orders/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_maker_step.dart';
import 'package:equatable/equatable.dart';

/// Represents a coffee order in the CoffeeMaker demo app.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:coffee_maker_navigator_2/domain/orders/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/domain/orders/entities/coffee_order.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_order.dart';
import 'package:equatable/equatable.dart';

/// Represents a group of coffee orders categorized by their current coffee maker step.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:coffee_maker_navigator_2/data/orders/repository/orders_repository.dart';
import 'package:coffee_maker_navigator_2/domain/orders/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/domain/orders/entities/coffee_order.dart';
import 'package:coffee_maker_navigator_2/features/orders/data/repository/orders_repository.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_order.dart';
import 'package:flutter/foundation.dart';

class OrdersService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:coffee_maker_navigator_2/domain/orders/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/ui/extensions/context_extensions.dart';
import 'package:coffee_maker_navigator_2/ui/orders/view/orders_screen.dart';
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_maker_step.dart';
import 'package:coffee_maker_navigator_2/features/orders/ui/view/orders_screen.dart';
import 'package:coffee_maker_navigator_2/utils/extensions/context_extensions.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';
import 'package:wolt_modal_sheet/wolt_modal_sheet.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:coffee_maker_navigator_2/ui/extensions/context_extensions.dart';
import 'package:coffee_maker_navigator_2/ui/orders/view/modal_pages/grind/reject_order_reason.dart';
import 'package:coffee_maker_navigator_2/ui/orders/view/orders_screen.dart';
import 'package:coffee_maker_navigator_2/features/orders/ui/view/modal_pages/grind/reject_order_reason.dart';
import 'package:coffee_maker_navigator_2/features/orders/ui/view/orders_screen.dart';
import 'package:coffee_maker_navigator_2/utils/extensions/context_extensions.dart';
import 'package:demo_ui_components/demo_ui_components.dart';
import 'package:flutter/material.dart';
import 'package:wolt_modal_sheet/wolt_modal_sheet.dart';
Expand Down
Loading

0 comments on commit 65a11a2

Please sign in to comment.