Skip to content

Commit

Permalink
project architecture changed a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
zxcBrawler committed May 3, 2024
1 parent bf9827c commit 6982952
Show file tree
Hide file tree
Showing 33 changed files with 1,838 additions and 100 deletions.
1,056 changes: 1,044 additions & 12 deletions .firebase/hosting.YnVpbGRcd2Vi.cache

Large diffs are not rendered by default.

72 changes: 57 additions & 15 deletions lib/core/routes/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import 'package:xc_web_admin/feature/shared/domain/entities/user_entity.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/admin/admin_all_active_users.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/admin/admin_all_clothes.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/admin/admin_all_colors.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/admin/admin_all_female_clothes.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/admin/admin_all_male_clothes.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/admin/admin_all_orders.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/admin/admin_all_sizes.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/admin/admin_all_users.dart';
Expand All @@ -20,9 +22,13 @@ import 'package:xc_web_admin/feature/shared/presentation/ui/admin/admin_dashboar
import 'package:xc_web_admin/feature/shared/presentation/ui/admin/admin_main_screen.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/admin/admin_weekly_items_sold_details.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/admin/admin_weekly_orders_details.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/director/director_all_female_clothes.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/director/director_all_male_clothes.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/director/director_weekly_items_sold_details.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/director/director_weekly_orders_details.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/employee/employee_all_clothes.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/employee/employee_all_female_clothes.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/employee/employee_all_male_clothes.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/employee/employee_all_orders.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/employee/employee_clothes.dart';
import 'package:xc_web_admin/feature/shared/presentation/ui/employee/employee_clothes_details.dart';
Expand Down Expand Up @@ -179,11 +185,23 @@ final router =
path: Pages.directorAllClothes.screenPath,
name: Pages.directorAllClothes.screenName,
pageBuilder: (context, state) {
HashSet<String> title = state.extra as HashSet<String>;
return NoTransitionPage(
child: DirectorAllClothes(
title: title.first,
));
return const NoTransitionPage(child: DirectorAllClothes());
},
),
GoRoute(
parentNavigatorKey: _shellNavigatorKey,
path: Pages.directorAllFemaleClothes.screenPath,
name: Pages.directorAllFemaleClothes.screenName,
pageBuilder: (context, state) {
return const NoTransitionPage(child: DirectorAllFemaleClothes());
},
),
GoRoute(
parentNavigatorKey: _shellNavigatorKey,
path: Pages.directorAllMaleClothes.screenPath,
name: Pages.directorAllMaleClothes.screenName,
pageBuilder: (context, state) {
return const NoTransitionPage(child: DirectorAllMaleClothes());
},
),
GoRoute(
Expand Down Expand Up @@ -259,11 +277,23 @@ final router =
name: Pages.employeeAllClothes.screenName,
parentNavigatorKey: _shellNavigatorKey,
pageBuilder: (context, state) {
HashSet<String> title = state.extra as HashSet<String>;
return NoTransitionPage(
child: EmployeeAllClothes(
title: title.first,
));
return const NoTransitionPage(child: EmployeeAllClothes());
},
),
GoRoute(
path: Pages.employeeAllFemaleClothes.screenPath,
name: Pages.employeeAllFemaleClothes.screenName,
parentNavigatorKey: _shellNavigatorKey,
pageBuilder: (context, state) {
return const NoTransitionPage(child: EmployeeAllFemaleClothes());
},
),
GoRoute(
path: Pages.employeeAllMaleClothes.screenPath,
name: Pages.employeeAllMaleClothes.screenName,
parentNavigatorKey: _shellNavigatorKey,
pageBuilder: (context, state) {
return const NoTransitionPage(child: EmployeeAllMaleClothes());
},
),
GoRoute(
Expand Down Expand Up @@ -370,11 +400,23 @@ final router =
path: Pages.adminAllClothes.screenPath,
name: Pages.adminAllClothes.screenName,
pageBuilder: (context, state) {
HashSet<String> title = state.extra as HashSet<String>;
return NoTransitionPage(
child: AdminAllClothes(
title: title.first,
));
return const NoTransitionPage(child: AdminAllClothes());
},
),
GoRoute(
parentNavigatorKey: _shellNavigatorKey,
path: Pages.adminAllFemaleClothes.screenPath,
name: Pages.adminAllFemaleClothes.screenName,
pageBuilder: (context, state) {
return const NoTransitionPage(child: AdminAllFemaleClothes());
},
),
GoRoute(
parentNavigatorKey: _shellNavigatorKey,
path: Pages.adminAllMaleClothes.screenPath,
name: Pages.adminAllMaleClothes.screenName,
pageBuilder: (context, state) {
return const NoTransitionPage(child: AdminAllMaleClothes());
},
),
GoRoute(
Expand Down
18 changes: 18 additions & 0 deletions lib/core/routes/router_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ enum Pages {
adminShopAddressInfo,
adminAllOrders,
adminAllClothes,
adminAllFemaleClothes,
adminAllMaleClothes,
adminOrderDetails, // separate window
adminClothesDetails, // separate window
adminAllColors,
Expand All @@ -25,6 +27,8 @@ enum Pages {
directorEmployees,
directorClothes,
directorAllClothes,
directorAllFemaleClothes,
directorAllMaleClothes,
directorClothesDetails,
directorWeeklyItemsSoldDetails, // separate window
directorOrders,
Expand All @@ -34,6 +38,8 @@ enum Pages {
employeeClothes,
employeeOrders,
employeeAllClothes,
employeeAllFemaleClothes,
employeeAllMaleClothes,
employeeClothesDetails,
employeeAllOrders,
adminWeeklyOrdersDetails,
Expand All @@ -60,6 +66,8 @@ extension AppPageExtension on Pages {
Pages.adminShopAddressInfo => '/adminShopAddressInfo',
Pages.adminAllOrders => '/adminAllOrders',
Pages.adminAllClothes => '/adminAllClothes',
Pages.adminAllFemaleClothes => '/adminAllFemaleClothes',
Pages.adminAllMaleClothes => '/adminAllMaleClothes',
Pages.adminOrderDetails => '/adminOrderDetails',
Pages.adminClothesDetails => '/adminClothesDetails',
Pages.directorDashboard => '/directorDashboard',
Expand All @@ -84,6 +92,10 @@ extension AppPageExtension on Pages {
Pages.adminWeeklyOrdersDetails => '/adminWeeklyOrdersDetails',
Pages.directorWeeklyOrdersDetails => '/directorWeeklyOrdersDetails',
Pages.employeeWeeklyOrdersDetails => '/employeeWeeklyOrdersDetails',
Pages.directorAllFemaleClothes => '/directorAllFemaleClothes',
Pages.directorAllMaleClothes => '/directorAllMaleClothes',
Pages.employeeAllFemaleClothes => '/employeeAllFemaleClothes',
Pages.employeeAllMaleClothes => '/employeeAllMaleClothes',
};
}

Expand All @@ -105,6 +117,8 @@ extension AppPageExtension on Pages {
Pages.adminShopAddressInfo => 'adminShopAddressInfo',
Pages.adminAllOrders => 'adminAllOrders',
Pages.adminAllClothes => 'adminAllClothes',
Pages.adminAllFemaleClothes => 'adminAllFemaleClothes',
Pages.adminAllMaleClothes => 'adminAllMaleClothes',
Pages.adminOrderDetails => 'adminOrderDetails',
Pages.adminClothesDetails => 'adminClothesDetails',
Pages.directorDashboard => 'directorDashboard',
Expand All @@ -129,6 +143,10 @@ extension AppPageExtension on Pages {
Pages.adminWeeklyOrdersDetails => 'adminWeeklyOrdersDetails',
Pages.directorWeeklyOrdersDetails => 'directorWeeklyOrdersDetails',
Pages.employeeWeeklyOrdersDetails => 'employeeWeeklyOrdersDetails',
Pages.directorAllFemaleClothes => 'directorAllFemaleClothes',
Pages.directorAllMaleClothes => 'directorAllMaleClothes',
Pages.employeeAllFemaleClothes => 'employeeAllFemaleClothes',
Pages.employeeAllMaleClothes => 'employeeAllMaleClothes',
};
}
}
2 changes: 1 addition & 1 deletion lib/core/widget/searchbar/basic_search_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class _BasicSearchBarState extends State<BasicSearchBar> {
return Padding(
padding: const EdgeInsets.all(8.0),
child: SearchBar(
hintText: S.current.search, // Hint text for the search bar
hintText: S.of(context).search, // Hint text for the search bar
textStyle: MaterialStatePropertyAll(
basicTextFieldStyle(), // Text style for the search bar
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:xc_web_admin/feature/shared/presentation/bloc/clothes/clothes_bl
import 'package:xc_web_admin/feature/shared/presentation/bloc/clothes/clothes_event.dart';
import 'package:xc_web_admin/feature/shared/presentation/widget/admin/admin_add_clothes_dialog.dart';
import 'package:xc_web_admin/feature/shared/presentation/widget/admin/admin_clothes_table.dart';
import 'package:xc_web_admin/generated/l10n.dart';

class AdminAllClothes extends StatefulWidget {
final String? title;
Expand Down Expand Up @@ -54,7 +55,7 @@ class _AdminAllClothesState extends State<AdminAllClothes> {
// Expands to fill available horizontal space
child: Header(
// A widget for displaying a title
title: '${widget.title}',
title: S.of(context).allClothes,
),
),
],
Expand Down Expand Up @@ -110,7 +111,7 @@ class _AdminAllClothesState extends State<AdminAllClothes> {
create: (context) =>
service()..add(const GetClothes()),
child: ClothesTable(
title: widget.title,
title: S.of(context).allClothes,
),
),
),
Expand Down
110 changes: 110 additions & 0 deletions lib/feature/shared/presentation/ui/admin/admin_all_female_clothes.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:xc_web_admin/core/widget/header/basic_pages_header.dart';
import 'package:xc_web_admin/core/widget/widget/basic_container.dart';
import 'package:xc_web_admin/di/service.dart';
import 'package:xc_web_admin/feature/shared/presentation/bloc/clothes/clothes_bloc.dart';
import 'package:xc_web_admin/feature/shared/presentation/bloc/clothes/clothes_event.dart';
import 'package:xc_web_admin/feature/shared/presentation/widget/admin/admin_add_clothes_dialog.dart';
import 'package:xc_web_admin/feature/shared/presentation/widget/admin/admin_clothes_table.dart';
import 'package:xc_web_admin/generated/l10n.dart';

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

@override
State<AdminAllFemaleClothes> createState() => _AdminAllFemaleClothesState();
}

class _AdminAllFemaleClothesState extends State<AdminAllFemaleClothes> {
@override
Widget build(BuildContext context) {
return SafeArea(
// Wraps the screen in a safe area
child: SingleChildScrollView(
// A scrollable widget that contains the rest of the widgets
padding: const EdgeInsets.all(16.0),
// Padding around the widgets
child: Column(
// A vertically expanding widget that contains the rest of the widgets
children: [
Row(
// A horizontally expanding widget that contains a header widget
children: [
Expanded(
// Expands to fill available horizontal space
child: Header(
// A widget for displaying a title
title: S.of(context).allFemaleClothes,
),
),
],
),
Row(
// A horizontally expanding widget that contains search bar and filter buttons
mainAxisAlignment: MainAxisAlignment.spaceAround,
// Spaces out the children horizontally
children: [
Expanded(
// Expands to fill available horizontal space
child: Row(
// A horizontally expanding widget that contains two filter buttons
mainAxisAlignment: MainAxisAlignment.end,
// Aligns the children to the right
children: [
SizedBox(
height: 70,
width: 70,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: BasicContainer(
child: IconButton(
onPressed: () {
// Open add user dialog
showDialog(
context: context,
builder: (BuildContext context) {
return const AddClothesDialog();
});
},
icon: const Icon(Icons.add),
),
))),
],
),
)
],
),
Row(
// A horizontally expanding widget that contains a table widget
children: [
Expanded(
// Expands to fill available horizontal space
child: Padding(
padding: const EdgeInsets.all(8.0),
child: BasicContainer(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: BlocProvider<RemoteClothesBloc>(
create: (context) =>
service()..add(const GetClothes()),
child: ClothesTable(
title: S.of(context).allFemaleClothes,
),
),
),
],
),
),
),
),
],
),
],
),
),
);
}
}
Loading

0 comments on commit 6982952

Please sign in to comment.