这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,13 @@ class MyHomePageState extends State<MyHomePage> {
unselectedItemColor: Colors.black,
items: const [
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
BottomNavigationBarItem(
icon: Icon(Icons.category), label: 'Collections'),
BottomNavigationBarItem(icon: Icon(Icons.category), label: 'Collections'),
BottomNavigationBarItem(icon: Icon(Icons.search), label: 'Search'),
BottomNavigationBarItem(icon: Icon(Icons.shopify), label: 'Shop'),
BottomNavigationBarItem(
icon: Icon(Icons.book_online_outlined), label: 'Blog'),
BottomNavigationBarItem(icon: Icon(Icons.book_online_outlined), label: 'Blog'),
// BottomNavigationBarItem(
// icon: Icon(Icons.checkroom_outlined), label: 'Checkout'),
BottomNavigationBarItem(
icon: Icon(Icons.shopping_cart), label: 'Cart'),
BottomNavigationBarItem(icon: Icon(Icons.shopping_cart), label: 'Cart'),
BottomNavigationBarItem(icon: Icon(Icons.history), label: 'Orders'),
BottomNavigationBarItem(icon: Icon(Icons.login), label: 'Login'),
],
Expand Down
7 changes: 2 additions & 5 deletions example/lib/screens/blog_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ class BlogTabState extends State<BlogTab> {
padding: const EdgeInsets.all(8),
itemCount: blogs.length,
itemBuilder: (_, int index) => ListTile(
title: blogs[index].title == null
? const Text('No Title')
: Text(blogs[index].title!),
title: blogs[index].title == null ? const Text('No Title') : Text(blogs[index].title!),
trailing: const Icon(Icons.arrow_forward_ios),
onTap: () {
if (blogs[index].articles != null) {
Expand Down Expand Up @@ -89,8 +87,7 @@ class BlogTabState extends State<BlogTab> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PagePage(handle: pages[index].title),
builder: (context) => PagePage(handle: pages[index].title),
),
);
},
Expand Down
9 changes: 3 additions & 6 deletions example/lib/screens/cart_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,7 @@ class _BuyerIndetityState extends State<BuyerIndetity> {

String randomString(int n) {
var text = "";
var possible =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < n; i++) {
text += possible[Random().nextInt(possible.length)];
}
Expand Down Expand Up @@ -519,15 +518,13 @@ class _BuyerIndetityState extends State<BuyerIndetity> {
initiallyExpanded: true,
title: const Text('Delivery Address Preferences'),
children: [
if (buyerIndetity?.deliveryAddressPreferences?.isEmpty ??
true)
if (buyerIndetity?.deliveryAddressPreferences?.isEmpty ?? true)
const ListTile(
title: Text('No delivery address preferences'),
),
...(buyerIndetity?.deliveryAddressPreferences ?? []).map(
(mailingAddress) => ListTile(
title: Text(
'${mailingAddress?.firstName} ${mailingAddress?.lastName}'),
title: Text('${mailingAddress?.firstName} ${mailingAddress?.lastName}'),
subtitle: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
9 changes: 3 additions & 6 deletions example/lib/screens/checkout_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class _CheckoutPageState extends State<CheckoutPage> {

try {
setState(() => _isLoading = true);
await shopifyAuth.signInWithEmailAndPassword(
email: kUserEmail, password: kUserPassword);
await shopifyAuth.signInWithEmailAndPassword(email: kUserEmail, password: kUserPassword);

final bestSellingProducts = await shopifyStore.getNProducts(
10,
Expand Down Expand Up @@ -97,8 +96,7 @@ class _CheckoutPageState extends State<CheckoutPage> {

try {
setState(() => _isLoading = true);
await shopifyAuth.signInWithEmailAndPassword(
email: kUserEmail, password: kUserPassword);
await shopifyAuth.signInWithEmailAndPassword(email: kUserEmail, password: kUserPassword);

final bestSellingProducts = await shopifyStore.getNProducts(
10,
Expand Down Expand Up @@ -174,8 +172,7 @@ class _CheckoutPageState extends State<CheckoutPage> {

final idempotencyKey = UniqueKey().toString();
await shopifyCheckout.shippingAddressUpdate(checkout.id, address);
final tokanizedCheckout =
await shopifyCheckout.checkoutCompleteWithTokenizedPaymentV3(
final tokanizedCheckout = await shopifyCheckout.checkoutCompleteWithTokenizedPaymentV3(
checkout.id,
checkout: checkout,
token: r'CQ32pyIRCmIEfekpX8x=',
Expand Down
18 changes: 6 additions & 12 deletions example/lib/screens/collection_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class CollectionTabState extends State<CollectionTab> {
: ListView.builder(
itemCount: collections.length,
itemBuilder: (_, int index) => ListTile(
onTap: () => _navigateToCollectionDetailScreen(
collections[index].id, collections[index].title),
onTap: () => _navigateToCollectionDetailScreen(collections[index].id, collections[index].title),
title: Text(collections[index].title),
),
),
Expand All @@ -52,21 +51,18 @@ class CollectionTabState extends State<CollectionTab> {
}
}

void _navigateToCollectionDetailScreen(
String collectionId, String collectionTitle) {
void _navigateToCollectionDetailScreen(String collectionId, String collectionTitle) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
CollectionDetailScreen(collectionId: collectionId),
builder: (context) => CollectionDetailScreen(collectionId: collectionId),
),
);
}
}

class CollectionDetailScreen extends StatefulWidget {
const CollectionDetailScreen({Key? key, required this.collectionId})
: super(key: key);
const CollectionDetailScreen({Key? key, required this.collectionId}) : super(key: key);
final String collectionId;

@override
Expand Down Expand Up @@ -108,8 +104,7 @@ class CollectionDetailScreenState extends State<CollectionDetailScreen> {
Future<void> _fetchProductsByCollectionId() async {
try {
final shopifyStore = ShopifyStore.instance;
final products =
await shopifyStore.getXProductsAfterCursorWithinCollection(
final products = await shopifyStore.getXProductsAfterCursorWithinCollection(
widget.collectionId,
4,
startCursor: null,
Expand All @@ -132,8 +127,7 @@ class CollectionDetailScreenState extends State<CollectionDetailScreen> {
Future<void> _fetchCollectionDetail() async {
try {
final shopifyStore = ShopifyStore.instance;
final collectionInfo =
await shopifyStore.getCollectionById(widget.collectionId);
final collectionInfo = await shopifyStore.getCollectionById(widget.collectionId);
setState(() {
collection = collectionInfo;
});
Expand Down
3 changes: 1 addition & 2 deletions example/lib/screens/home_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ class HomeTabState extends State<HomeTab> {
crossAxisSpacing: 8,
),
itemCount: products.length,
itemBuilder: (_, int index) =>
_buildProductThumbnail(products[index]),
itemBuilder: (_, int index) => _buildProductThumbnail(products[index]),
),
),
);
Expand Down
3 changes: 1 addition & 2 deletions example/lib/screens/product_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import 'package:flutter/material.dart';
import 'package:shopify_flutter/shopify_flutter.dart';

class ProductDetailScreen extends StatefulWidget {
const ProductDetailScreen({Key? key, required this.product})
: super(key: key);
const ProductDetailScreen({Key? key, required this.product}) : super(key: key);
final Product product;

@override
Expand Down
16 changes: 5 additions & 11 deletions example/lib/screens/shop_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ query{
Future<void> _fetchLocalizationInfo() async {
try {
setState(() => _isLoading = true);
final localizationInfo =
await ShopifyLocalization.instance.getLocalization();
final localizationInfo = await ShopifyLocalization.instance.getLocalization();
if (mounted) {
setState(() {
localization = localizationInfo;
Expand Down Expand Up @@ -139,25 +138,20 @@ query{
),
ListTile(
title: const Text('Supported Languages'),
subtitle: Text(localization?.availableLanguages
.map((lang) => lang.name)
.toList()
.join(', ') ??
'N/A'),
subtitle:
Text(localization?.availableLanguages.map((lang) => lang.name).toList().join(', ') ?? 'N/A'),
),
ListTile(
title: const Text('Supported Currencies'),
subtitle: Text(localization?.availableCountries
.map((country) =>
'${country.currency.name} (${country.currency.symbol})')
.map((country) => '${country.currency.name} (${country.currency.symbol})')
.toSet()
.join(', ') ??
'N/A'),
),
ListTile(
title: const Text('Primary Domain SSL Enabled'),
subtitle:
Text(shop?.primaryDomain?.sslEnabled.toString() ?? ''),
subtitle: Text(shop?.primaryDomain?.sslEnabled.toString() ?? ''),
),
ListTile(
title: const Text('Privacy Policy'),
Expand Down
46 changes: 23 additions & 23 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834
sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab"
url: "https://pub.dev"
source: hosted
version: "72.0.0"
version: "76.0.0"
_macros:
dependency: transitive
description: dart
source: sdk
version: "0.3.2"
version: "0.3.3"
alerter:
dependency: "direct main"
description:
Expand All @@ -26,10 +26,10 @@ packages:
dependency: transitive
description:
name: analyzer
sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139
sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e"
url: "https://pub.dev"
source: hosted
version: "6.7.0"
version: "6.11.0"
args:
dependency: transitive
description:
Expand Down Expand Up @@ -138,10 +138,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
version: "1.18.0"
version: "1.19.0"
connectivity_plus:
dependency: transitive
description:
Expand Down Expand Up @@ -585,18 +585,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
url: "https://pub.dev"
source: hosted
version: "10.0.5"
version: "10.0.7"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.0.8"
leak_tracker_testing:
dependency: transitive
description:
Expand Down Expand Up @@ -625,10 +625,10 @@ packages:
dependency: transitive
description:
name: macros
sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536"
sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656"
url: "https://pub.dev"
source: hosted
version: "0.1.2-main.4"
version: "0.1.3-main.0"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -891,12 +891,12 @@ packages:
path: ".."
relative: true
source: path
version: "2.3.1"
version: "2.3.3"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
version: "0.0.0"
source_gen:
dependency: transitive
description:
Expand Down Expand Up @@ -941,10 +941,10 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
url: "https://pub.dev"
source: hosted
version: "1.11.1"
version: "1.12.0"
stream_channel:
dependency: transitive
description:
Expand All @@ -957,10 +957,10 @@ packages:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.3.0"
synchronized:
dependency: transitive
description:
Expand All @@ -981,10 +981,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
url: "https://pub.dev"
source: hosted
version: "0.7.2"
version: "0.7.3"
typed_data:
dependency: transitive
description:
Expand Down Expand Up @@ -1141,10 +1141,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
url: "https://pub.dev"
source: hosted
version: "14.2.5"
version: "14.3.0"
wakelock_plus:
dependency: transitive
description:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Query to get all collections
const String getAllCollectionsOptimizedQuery = r'''
query($cursor: String, $sortKey: CollectionSortKeys, $reverse: Boolean){
query($metafields: [HasMetafieldsIdentifier!]!, $cursor: String, $sortKey: CollectionSortKeys, $reverse: Boolean){
collections(first: 250, after: $cursor, sortKey: $sortKey, reverse: $reverse) {
pageInfo{
hasNextPage
Expand All @@ -19,6 +19,23 @@ query($cursor: String, $sortKey: CollectionSortKeys, $reverse: Boolean){
id
originalSrc
}
metafields(identifiers: $metafields) {
id
type
key
namespace
value
description
reference {
... on MediaImage {
image {
originalSrc
url
id
}
}
}
}
}
}
}
Expand Down
Loading
Loading