Skip to content

Commit 7abd5a1

Browse files
Update: change backend api source and project update with latest flutter version
1 parent 5d0abcb commit 7abd5a1

File tree

14 files changed

+63
-60
lines changed

14 files changed

+63
-60
lines changed
414 KB
Loading

ios/Podfile.lock

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PODS:
88
- shared_preferences_foundation (0.0.1):
99
- Flutter
1010
- FlutterMacOS
11-
- sqflite (0.0.3):
11+
- sqflite_darwin (0.0.4):
1212
- Flutter
1313
- FlutterMacOS
1414

@@ -17,7 +17,7 @@ DEPENDENCIES:
1717
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
1818
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
1919
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
20-
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
20+
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
2121

2222
EXTERNAL SOURCES:
2323
Flutter:
@@ -28,16 +28,16 @@ EXTERNAL SOURCES:
2828
:path: ".symlinks/plugins/path_provider_foundation/darwin"
2929
shared_preferences_foundation:
3030
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
31-
sqflite:
32-
:path: ".symlinks/plugins/sqflite/darwin"
31+
sqflite_darwin:
32+
:path: ".symlinks/plugins/sqflite_darwin/darwin"
3333

3434
SPEC CHECKSUMS:
3535
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
3636
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
37-
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
38-
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
39-
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
37+
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
38+
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
39+
sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
4040

4141
PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
4242

43-
COCOAPODS: 1.14.3
43+
COCOAPODS: 1.16.2

ios/Runner.xcodeproj/project.pbxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
97C146E61CF9000F007C117D /* Project object */ = {
216216
isa = PBXProject;
217217
attributes = {
218-
LastUpgradeCheck = 1430;
218+
LastUpgradeCheck = 1510;
219219
ORGANIZATIONNAME = "";
220220
TargetAttributes = {
221221
331C8080294A63A400263BE5 = {

ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1430"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

ios/Runner/AppDelegate.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import UIKit
22
import Flutter
33

4-
@UIApplicationMain
4+
@main
55
@objc class AppDelegate: FlutterAppDelegate {
66
override func application(
77
_ application: UIApplication,

lib/core/constant/strings.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const String appTitle = 'EShop';
33

44
// Networking and APIs
5-
const String baseUrl = 'https://rich-jade-mackerel-kit.cyclic.app';
5+
const String baseUrl = 'https://e-commerce-mock-api-webservice.onrender.com';
66
const String defaultApiKey = '';
77
const String defaultSources = '';
88

lib/core/theme/app_theme.dart

+1-10
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ class AppTheme {
1717
textButtonTheme: TextButtonThemeData(
1818
style: TextButton.styleFrom(foregroundColor: kLightSecondaryColor)),
1919
colorScheme: ColorScheme.light(secondary: kLightSecondaryColor)
20-
.copyWith(background: kLightBackgroundColor),
20+
.copyWith(surface: kLightBackgroundColor),
2121
);
22-
23-
// static final darkTheme = ThemeData(
24-
// brightness: Brightness.dark,
25-
// primaryColor: darkPrimaryColor,
26-
// visualDensity: VisualDensity.adaptivePlatformDensity,
27-
// textButtonTheme: TextButtonThemeData(
28-
// style: TextButton.styleFrom(foregroundColor: darkTextColor)),
29-
// colorScheme: ColorScheme.light(secondary: lightSecondaryColor)
30-
// .copyWith(background: darkBackgroundColor));
3122
}

lib/data/data_sources/remote/product_remote_data_source.dart

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'dart:convert';
2-
31
import 'package:http/http.dart' as http;
42

53
import '../../../../core/error/exceptions.dart';
@@ -17,7 +15,7 @@ class ProductRemoteDataSourceImpl implements ProductRemoteDataSource {
1715

1816
@override
1917
Future<ProductResponseModel> getProducts(params) => _getProductFromUrl(
20-
'$baseUrl/products?keyword=${params.keyword}&pageSize=${params.pageSize}&page=${params.limit}&categories=${jsonEncode(params.categories.map((e) => e.id).toList())}');
18+
'$baseUrl/products');//?keyword=${params.keyword}&pageSize=${params.pageSize}&page=${params.limit}&categories=${jsonEncode(params.categories.map((e) => e.id).toList())}');
2119

2220
Future<ProductResponseModel> _getProductFromUrl(String url) async {
2321
final response = await client.get(

lib/data/models/product/pagination_data_model.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class PaginationMetaDataModel extends PaginationMetaData {
1212
);
1313

1414
factory PaginationMetaDataModel.fromJson(Map<String, dynamic> json) => PaginationMetaDataModel(
15-
page: json["page"],
15+
page: json["page"]??0,
1616
pageSize: json["pageSize"],
1717
total: json["total"],
1818
);

lib/data/models/product/product_response_model.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ class ProductResponseModel extends ProductResponse {
1717
required List<Product> data,
1818
}) : super(products: data, paginationMetaData: meta);
1919

20-
factory ProductResponseModel.fromJson(Map<String, dynamic> json) =>
21-
ProductResponseModel(
20+
factory ProductResponseModel.fromJson(Map<String, dynamic> json) {
21+
return ProductResponseModel(
2222
meta: PaginationMetaDataModel.fromJson(json["meta"]),
2323
data: List<ProductModel>.from(
2424
json["data"].map((x) => ProductModel.fromJson(x))),
2525
);
26+
}
2627

2728
Map<String, dynamic> toJson() => {
2829
"meta": (paginationMetaData as PaginationMetaDataModel).toJson(),

lib/presentation/blocs/delivery_info/delivery_info_fetch/delivery_info_fetch_cubit.dart

-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class DeliveryInfoFetchCubit extends Cubit<DeliveryInfoFetchState> {
2727
emit(DeliveryInfoFetchLoading(
2828
deliveryInformation: const [],
2929
selectedDeliveryInformation: state.selectedDeliveryInformation));
30-
print("fetching");
3130
final cachedResult = await _getCachedDeliveryInfoUseCase(NoParams());
3231
cachedResult.fold(
3332
(failure) => (),
@@ -53,9 +52,7 @@ class DeliveryInfoFetchCubit extends Cubit<DeliveryInfoFetchState> {
5352
deliveryInformation: deliveryInfo,
5453
selectedDeliveryInformation: state.selectedDeliveryInformation)),
5554
);
56-
print("done");
5755
} catch (e) {
58-
print(e);
5956
emit(DeliveryInfoFetchFail(
6057
deliveryInformation: state.deliveryInformation,
6158
selectedDeliveryInformation: state.selectedDeliveryInformation));

lib/presentation/views/main/home/home_view.dart

+40-23
Original file line numberDiff line numberDiff line change
@@ -254,29 +254,46 @@ class _HomeViewState extends State<HomeView> {
254254
},
255255
);
256256
}
257-
return Column(
258-
mainAxisAlignment: MainAxisAlignment.center,
259-
children: [
260-
if (state.failure is ServerFailure)
261-
Image.asset(
262-
'assets/status_image/internal-server-error.png'),
263-
if (state.failure is CacheFailure)
264-
Image.asset('assets/status_image/no-connection.png'),
265-
const Text("Products not found!"),
266-
IconButton(
267-
onPressed: () {
268-
context.read<ProductBloc>().add(GetProducts(
269-
FilterProductParams(
270-
keyword: context
271-
.read<FilterCubit>()
272-
.searchController
273-
.text)));
274-
},
275-
icon: const Icon(Icons.refresh)),
276-
SizedBox(
277-
height: MediaQuery.of(context).size.height * 0.1,
278-
)
279-
],
257+
return Center(
258+
child: Column(
259+
mainAxisAlignment: MainAxisAlignment.center,
260+
crossAxisAlignment: CrossAxisAlignment.center,
261+
children: [
262+
if (state.failure is ServerFailure)
263+
Image.asset(
264+
'assets/status_image/internal-server-error.png',
265+
width: MediaQuery.of(context).size.width * 0.7,
266+
),
267+
if (state.failure is CacheFailure)
268+
Image.asset(
269+
'assets/status_image/no-connection.png',
270+
width: MediaQuery.of(context).size.width * 0.7,
271+
),
272+
// if (state.products.isEmpty)
273+
// Image.asset(
274+
// 'assets/status_image/cloths-choosing.png',
275+
// width: MediaQuery.of(context).size.width * 0.7,
276+
// ),
277+
Text(
278+
"Products not found!",
279+
style: TextStyle(color: Colors.grey.shade600),
280+
),
281+
IconButton(
282+
color: Colors.grey.shade600,
283+
onPressed: () {
284+
context.read<ProductBloc>().add(GetProducts(
285+
FilterProductParams(
286+
keyword: context
287+
.read<FilterCubit>()
288+
.searchController
289+
.text)));
290+
},
291+
icon: const Icon(Icons.refresh)),
292+
SizedBox(
293+
height: MediaQuery.of(context).size.height * 0.1,
294+
)
295+
],
296+
),
280297
);
281298
}
282299
return RefreshIndicator(

lib/presentation/widgets/input_form_button.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ class InputFormButton extends StatelessWidget {
2424
return ElevatedButton(
2525
onPressed: onClick,
2626
style: ButtonStyle(
27-
padding: MaterialStateProperty.all<EdgeInsets>(padding),
27+
padding: WidgetStateProperty.all<EdgeInsets>(padding),
2828
maximumSize:
29-
MaterialStateProperty.all<Size>(const Size(double.maxFinite, 50)),
29+
WidgetStateProperty.all<Size>(const Size(double.maxFinite, 50)),
3030
minimumSize:
31-
MaterialStateProperty.all<Size>(const Size(double.maxFinite, 50)),
32-
backgroundColor: MaterialStateProperty.all<Color>(
31+
WidgetStateProperty.all<Size>(const Size(double.maxFinite, 50)),
32+
backgroundColor: WidgetStateProperty.all<Color>(
3333
color ?? Theme.of(context).primaryColor),
34-
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
34+
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
3535
RoundedRectangleBorder(
3636
borderRadius: BorderRadius.circular(cornerRadius ?? 12.0)),
3737
),

test/data/repositories/order_repository_impl_test.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'package:dartz/dartz.dart';
21
import 'package:eshop/core/error/failures.dart';
32
import 'package:eshop/core/network/network_info.dart';
43
import 'package:eshop/core/usecases/usecase.dart';

0 commit comments

Comments
 (0)