Skip to content

Commit

Permalink
add paymob payment
Browse files Browse the repository at this point in the history
  • Loading branch information
john-safwat committed Aug 4, 2023
1 parent ed88cad commit 5b558c9
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 33 deletions.
4 changes: 4 additions & 0 deletions android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFE9FFFD</color>
</resources>
5 changes: 5 additions & 0 deletions lib/Presentation/UI/OrderHistory/OrderHistoryNavigator.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'package:ecommerce/Core/Base/Base_Navigator.dart';

abstract class OrderHistoryNavigator extends BaseNavigator{

}
9 changes: 7 additions & 2 deletions lib/Presentation/UI/OrderHistory/OrderHistoryView.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:ecommerce/Core/Base/Base_State.dart';
import 'package:ecommerce/Core/DI/di.dart';
import 'package:ecommerce/Core/Provider/AppConfigProvider.dart';
import 'package:ecommerce/Core/Theme/MyTheme.dart';
Expand All @@ -16,8 +17,7 @@ class OrderHistoryScreen extends StatefulWidget {
State<OrderHistoryScreen> createState() => _OrderHistoryScreenState();
}

class _OrderHistoryScreenState extends State<OrderHistoryScreen>{
OrderHistoryViewModel viewModel = OrderHistoryViewModel(GetOrdersHistoryUseCase(injectOrdersRepository()));
class _OrderHistoryScreenState extends BaseState<OrderHistoryScreen , OrderHistoryViewModel>{

@override
void initState() {
Expand Down Expand Up @@ -61,4 +61,9 @@ class _OrderHistoryScreenState extends State<OrderHistoryScreen>{
),
);
}

@override
OrderHistoryViewModel initViewModel() {
return OrderHistoryViewModel(GetOrdersHistoryUseCase(injectOrdersRepository()));
}
}
4 changes: 3 additions & 1 deletion lib/Presentation/UI/OrderHistory/OrderHistoryViewModel.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'package:ecommerce/Core/Base/Base_View_Model.dart';
import 'package:ecommerce/Core/Provider/AppConfigProvider.dart';
import 'package:ecommerce/Domain/Models/Order/OrdersHistory.dart';
import 'package:ecommerce/Domain/UseCase/GetOrdersHistoryUseCase.dart';
import 'package:ecommerce/Presentation/UI/OrderHistory/OrderHistoryNavigator.dart';
import 'package:flutter/material.dart';

class OrderHistoryViewModel extends ChangeNotifier {
class OrderHistoryViewModel extends BaseViewModel<OrderHistoryNavigator> {
GetOrdersHistoryUseCase useCase ;
OrderHistoryViewModel(this.useCase);

Expand Down
4 changes: 2 additions & 2 deletions lib/Presentation/UI/ProductDetails/ProductDetailsView.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ class _ProductDetailsScreenState extends BaseState<ProductDetailsScreen ,Product
// feedBacks
FeedBacksWidget(double.parse(value.product!.rating!.toString()), value.product!.feedBack),
// user rating
Row(
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const[
children: [
Text("Your Rating", style: TextStyle(
fontSize: 26,
fontWeight: FontWeight.bold,
Expand Down
33 changes: 7 additions & 26 deletions lib/Presentation/UI/ProductsList/ProductsListView.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:ecommerce/Core/Base/Base_State.dart';
import 'package:ecommerce/Core/DI/di.dart';
import 'package:ecommerce/Core/Theme/MyTheme.dart';
import 'package:ecommerce/Core/Utils/Dialog_Utils.dart';
Expand All @@ -22,13 +23,9 @@ class ProductsListScreen extends StatefulWidget {
State<ProductsListScreen> createState() => _ProductsListScreenState();
}

class _ProductsListScreenState extends State<ProductsListScreen>
class _ProductsListScreenState extends BaseState<ProductsListScreen , ProductsListViewModel>
implements ProductsListNavigator {
ProductsListViewModel viewModel = ProductsListViewModel(
GetProductsByCategoryIdUseCase(injectProductRepository()),
AddToWishListUseCase(injectProductRepository()),
DeleteFromWishListUseCase(injectProductRepository())
);

@override
void initState() {
super.initState();
Expand Down Expand Up @@ -100,25 +97,9 @@ class _ProductsListScreenState extends State<ProductsListScreen>
}

@override
void hideDialog() {
MyDialogUtils.hideDialog(context: context);
}

@override
void showLoading(String message) {
MyDialogUtils.showLoading(context: context, message: message);
}

@override
void showSuccessMessage(String message , Function function) {
MyDialogUtils.showSuccessDialog(context: context, message: message , action: null);
}

@override
showErrorMessage(String message) {
}

@override
updateToken(String token) {
ProductsListViewModel initViewModel() {
return ProductsListViewModel(GetProductsByCategoryIdUseCase(injectProductRepository()),
AddToWishListUseCase(injectProductRepository()),
DeleteFromWishListUseCase(injectProductRepository()));
}
}
4 changes: 2 additions & 2 deletions lib/Presentation/UI/ProductsList/ProductsListViewModel.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import 'dart:io';
import 'package:ecommerce/Core/Base/Base_View_Model.dart';
import 'package:ecommerce/Domain/Models/Products/Prdouct.dart';
import 'package:ecommerce/Domain/UseCase/AddToWishListUseCase.dart';
import 'package:ecommerce/Domain/UseCase/DeleteFromWishListUseCase.dart';
import 'package:ecommerce/Domain/UseCase/GetProductsByCategoryIdUseCase.dart';
import 'package:ecommerce/Presentation/UI/ProductsList/ProductsListNavigator.dart';
import 'package:flutter/material.dart';

class ProductsListViewModel extends ChangeNotifier {
class ProductsListViewModel extends BaseViewModel<ProductsListNavigator> {
GetProductsByCategoryIdUseCase getProductsByCategoryIdUseCase;
AddToWishListUseCase addToWishListUseCase;
DeleteFromWishListUseCase deleteFromWishListUseCase;
ProductsListViewModel(this.getProductsByCategoryIdUseCase,
this.addToWishListUseCase, this.deleteFromWishListUseCase);
ProductsListNavigator? navigator;

String? errorMessage;
List<Product>? products;
Expand Down

0 comments on commit 5b558c9

Please sign in to comment.