Skip to content

Commit b03b127

Browse files
committed
v1.0.4
1 parent e6d98a6 commit b03b127

File tree

5 files changed

+64
-58
lines changed

5 files changed

+64
-58
lines changed

ShopMax/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [1.0.4] - 2024-02-15
2+
3+
* Fix Wishlist page
4+
* pubspec.yaml updates
5+
16
## [1.0.3] - 2024-02-15
27

38
* Tweaks to the Mello Template

ShopMax/lib/resources/pages/shopify/wishlist_page_widget.dart

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,17 @@ import 'package:flutter/material.dart';
1212
import 'package:flutter_app/bootstrap/extensions.dart';
1313
import 'package:flutter_app/resources/pages/shopify/product_detail_page.dart';
1414
import 'package:flutter_app/resources/widgets/safearea_widget.dart';
15+
import 'package:woosignal_shopify_api/models/product.dart';
1516
import '/bootstrap/helpers.dart';
1617
import '/resources/widgets/cached_image_widget.dart';
1718
import 'package:nylo_framework/nylo_framework.dart';
18-
import 'package:woosignal_shopify_api/models/response/shopify_product_response.dart';
1919

2020
class WishListPageWidget extends NyStatefulWidget {
2121
static String path = "/wishlist";
2222
WishListPageWidget() : super(path, child: _WishListPageWidgetState());
2323
}
2424

2525
class _WishListPageWidgetState extends NyState<WishListPageWidget> {
26-
bool? hasNextPage = true;
27-
String? endCursor;
2826

2927
@override
3028
Widget build(BuildContext context) {
@@ -34,74 +32,77 @@ class _WishListPageWidgetState extends NyState<WishListPageWidget> {
3432
title: Text(trans("Wishlist")),
3533
),
3634
body: SafeAreaWidget(
37-
child: NyPullToRefresh.grid(
38-
crossAxisCount: 1,
39-
mainAxisSpacing: 20,
40-
data: (page) async {
41-
if (hasNextPage == false) return [];
35+
child: NyListView.separated(
36+
separatorBuilder: (context, index) => Divider(
37+
height: 1,
38+
color: Colors.grey.shade100,
39+
),
40+
data: () async {
4241
List<String> favouriteProducts = await getWishlistProducts();
43-
ShopifyProductResponse? shopifyProductResponse =
44-
await (appWooSignalShopify(
45-
(api) => api.getProductsJson(ids: favouriteProducts.map((e) => int.parse(e)).toList())));
46-
if (shopifyProductResponse?.pageInfo?.hasNextPage != true) {
47-
hasNextPage = false;
42+
if (favouriteProducts.isEmpty) {
43+
return [];
4844
}
49-
endCursor = shopifyProductResponse?.pageInfo?.endCursor;
50-
return shopifyProductResponse?.products ?? [];
45+
List<Product>? products =
46+
await (appWooSignalShopify(
47+
(api) => api.getProductsRestApi(ids: favouriteProducts.map((e) => int.parse(e)).toList())));
48+
return products;
5149
},
5250
child: (context, product) {
53-
product as ShopifyProduct;
51+
product as Product;
5452
return Container(
53+
height: 160,
54+
margin: EdgeInsets.symmetric(vertical: 16),
5555
child: Row(
5656
children: [
5757
Container(
5858
child: ClipRRect(
5959
borderRadius: BorderRadius.circular(16),
6060
child: CachedImageWidget(
61-
image: (product.featuredImage?.url != null
62-
? product.featuredImage!.url
63-
: getEnv("PRODUCT_PLACEHOLDER_IMAGE")),
64-
fit: BoxFit.cover,
65-
width: double.infinity,
66-
),
61+
image: product.image?.src ?? getEnv("PRODUCT_PLACEHOLDER_IMAGE"),
62+
fit: BoxFit.cover,
63+
width: double.infinity,
64+
),
6765
),
68-
width: MediaQuery.of(context).size.width / 4,
66+
width: MediaQuery.of(context).size.width / 3.5,
67+
height: 160,
6968
).paddingOnly(right: 8),
7069
Expanded(
7170
child: Container(
7271
child: Column(
7372
crossAxisAlignment: CrossAxisAlignment.start,
74-
mainAxisAlignment: MainAxisAlignment.center,
73+
mainAxisAlignment: MainAxisAlignment.spaceAround,
7574
children: [
75+
Row(
76+
crossAxisAlignment: CrossAxisAlignment.center,
77+
mainAxisAlignment: MainAxisAlignment.end,
78+
children: [
79+
IconButton(
80+
alignment: Alignment.topRight,
81+
icon: Icon(
82+
Icons.favorite,
83+
color: Colors.red,
84+
),
85+
onPressed: () => _removeFromWishlist(product.id.toString()),
86+
),
87+
],
88+
),
7689
Text(
7790
product.title ?? "",
78-
style: TextStyle(fontWeight: FontWeight.bold),
91+
style: textTheme.headlineSmall,
7992
maxLines: 2,
8093
overflow: TextOverflow.ellipsis,
8194
),
8295
Text(
83-
product.priceRange?.minVariantPrice?.amount
84-
.toMoney() ??
85-
"",
86-
),
96+
product.price.toMoney(),
97+
style: textTheme.bodyLarge,
98+
).fontWeightBold().paddingOnly(top: 14),
8799
],
88100
),
89101
),
90102
),
91-
Container(
92-
width: MediaQuery.of(context).size.width / 5,
93-
alignment: Alignment.center,
94-
child: IconButton(
95-
icon: Icon(
96-
Icons.favorite,
97-
color: Colors.red,
98-
),
99-
onPressed: () => _removeFromWishlist(product),
100-
),
101-
)
102103
],
103104
),
104-
).onTapRoute(ProductDetailPage.path, data: product.uId);
105+
).onTapRoute(ProductDetailPage.path, data: product.id);
105106
},
106107
empty: Center(
107108
child: Column(
@@ -128,8 +129,8 @@ class _WishListPageWidgetState extends NyState<WishListPageWidget> {
128129
);
129130
}
130131

131-
_removeFromWishlist(ShopifyProduct product) async {
132-
await removeWishlistProduct(productId: product.id ?? "");
132+
_removeFromWishlist(String productId) async {
133+
await removeWishlistProduct(productId: productId);
133134
showToastNotification(
134135
context,
135136
title: trans('Success'),

ShopMax/lib/resources/widgets/shopify/home_drawer_widget.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,17 @@ class _HomeDrawerWidgetState extends State<HomeDrawerWidget> {
8282
onTap: _actionProfile,
8383
),
8484
if (widget.wooSignalApp!.wishlistEnabled == true)
85-
// ListTile(
86-
// title: Text(
87-
// trans("Wishlist"),
88-
// style: Theme.of(context)
89-
// .textTheme
90-
// .bodyMedium!
91-
// .copyWith(fontSize: 16),
92-
// ),
93-
// leading: Icon(Icons.favorite_border),
94-
// onTap: _actionWishlist,
95-
// ),
85+
ListTile(
86+
title: Text(
87+
trans("Wishlist"),
88+
style: Theme.of(context)
89+
.textTheme
90+
.bodyMedium!
91+
.copyWith(fontSize: 16),
92+
),
93+
leading: Icon(Icons.favorite_border),
94+
onTap: _actionWishlist,
95+
),
9696
ListTile(
9797
title: Text(
9898
trans("Cart"),

ShopMax/pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,10 +1190,10 @@ packages:
11901190
dependency: "direct main"
11911191
description:
11921192
name: woosignal_shopify_api
1193-
sha256: "39407f4ec1c16375fe8a80a519a7f3c7e07d10886f370a75a6d8444056660370"
1193+
sha256: ce25cee72901b5e94a98c125ea61e4d1ad7b3c6252929a74166351a7a661ee29
11941194
url: "https://pub.dev"
11951195
source: hosted
1196-
version: "1.0.5"
1196+
version: "1.0.6"
11971197
xdg_directories:
11981198
dependency: transitive
11991199
description:

ShopMax/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Official WooSignal App Template for Shopify
22

33
# ShopMax
4-
# Version: 1.0.3
4+
# Version: 1.0.4
55
# Author: Anthony Gordon
66
# Homepage: https://woosignal.com
77
# Documentation: https://woosignal.com/docs/app/shopmax
@@ -44,7 +44,7 @@ dependencies:
4444
flutter_spinkit: ^5.1.0
4545
auto_size_text: ^3.0.0
4646
html: ^0.15.4
47-
woosignal_shopify_api: ^1.0.5
47+
woosignal_shopify_api: ^1.0.6
4848
flutter_widget_from_html_core: ^0.14.11
4949
flutter_rating_bar: ^4.0.1
5050
flutter_staggered_grid_view: ^0.7.0

0 commit comments

Comments
 (0)