From f5d22921b94bf1375f360e0f755e377345f50dd9 Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 19 May 2022 21:46:20 +0100 Subject: [PATCH] v6.0.0 - Flutter format --- .../lib/app/providers/razorpay_provider.dart | 1 + LabelStoreMax/lib/bootstrap/helpers.dart | 3 +- .../resources/pages/account_order_detail.dart | 1 - .../lib/resources/pages/browse_category.dart | 1 - .../lib/resources/pages/browse_search.dart | 1 - .../pages/checkout_payment_type.dart | 1 - .../lib/resources/pages/checkout_status.dart | 1 - .../pages/product_image_viewer_page.dart | 3 - .../resources/pages/wishlist_page_widget.dart | 8 +- .../resources/widgets/notic_home_widget.dart | 27 +- .../resources/widgets/notic_theme_widget.dart | 5 +- .../widgets/product_detail_body_widget.dart | 4 +- .../widgets/product_detail_upsell_widget.dart | 28 ++- .../resources/widgets/safearea_widget.dart | 1 - .../lib/resources/widgets/woosignal_ui.dart | 234 ++++++++---------- 15 files changed, 153 insertions(+), 166 deletions(-) diff --git a/LabelStoreMax/lib/app/providers/razorpay_provider.dart b/LabelStoreMax/lib/app/providers/razorpay_provider.dart index e69de29..8b13789 100644 --- a/LabelStoreMax/lib/app/providers/razorpay_provider.dart +++ b/LabelStoreMax/lib/app/providers/razorpay_provider.dart @@ -0,0 +1 @@ + diff --git a/LabelStoreMax/lib/bootstrap/helpers.dart b/LabelStoreMax/lib/bootstrap/helpers.dart index 866235c..e936b21 100644 --- a/LabelStoreMax/lib/bootstrap/helpers.dart +++ b/LabelStoreMax/lib/bootstrap/helpers.dart @@ -516,8 +516,7 @@ Future> getWishlistProducts() async { String? currentProductsJSON = await (NyStorage.read(SharedKey.wishlistProducts)); if (currentProductsJSON != null) { - favouriteProducts = - (jsonDecode(currentProductsJSON)).toList(); + favouriteProducts = (jsonDecode(currentProductsJSON)).toList(); } return favouriteProducts; } diff --git a/LabelStoreMax/lib/resources/pages/account_order_detail.dart b/LabelStoreMax/lib/resources/pages/account_order_detail.dart index 02086c8..30946f2 100644 --- a/LabelStoreMax/lib/resources/pages/account_order_detail.dart +++ b/LabelStoreMax/lib/resources/pages/account_order_detail.dart @@ -16,7 +16,6 @@ import 'package:flutter_app/resources/widgets/safearea_widget.dart'; import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; import 'package:nylo_framework/nylo_framework.dart'; - import 'package:woosignal/models/response/order.dart'; class AccountOrderDetailPage extends NyStatefulWidget { diff --git a/LabelStoreMax/lib/resources/pages/browse_category.dart b/LabelStoreMax/lib/resources/pages/browse_category.dart index e914d14..9fa3a1c 100644 --- a/LabelStoreMax/lib/resources/pages/browse_category.dart +++ b/LabelStoreMax/lib/resources/pages/browse_category.dart @@ -19,7 +19,6 @@ import 'package:flutter_app/resources/widgets/safearea_widget.dart'; import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; import 'package:nylo_framework/nylo_framework.dart'; - import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:woosignal/models/response/product_category.dart'; import 'package:woosignal/models/response/products.dart' as ws_product; diff --git a/LabelStoreMax/lib/resources/pages/browse_search.dart b/LabelStoreMax/lib/resources/pages/browse_search.dart index 5889ea5..99293a2 100644 --- a/LabelStoreMax/lib/resources/pages/browse_search.dart +++ b/LabelStoreMax/lib/resources/pages/browse_search.dart @@ -16,7 +16,6 @@ import 'package:flutter_app/resources/widgets/app_loader_widget.dart'; import 'package:flutter_app/resources/widgets/safearea_widget.dart'; import 'package:nylo_framework/nylo_framework.dart'; - import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:woosignal/models/response/products.dart' as ws_product; diff --git a/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart b/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart index 3292714..73b1c8c 100644 --- a/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart +++ b/LabelStoreMax/lib/resources/pages/checkout_payment_type.dart @@ -17,7 +17,6 @@ import 'package:flutter_app/resources/widgets/safearea_widget.dart'; import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; import 'package:nylo_framework/nylo_framework.dart'; - class CheckoutPaymentTypePage extends StatefulWidget { CheckoutPaymentTypePage(); diff --git a/LabelStoreMax/lib/resources/pages/checkout_status.dart b/LabelStoreMax/lib/resources/pages/checkout_status.dart index 0e376e0..cbd7ebc 100644 --- a/LabelStoreMax/lib/resources/pages/checkout_status.dart +++ b/LabelStoreMax/lib/resources/pages/checkout_status.dart @@ -18,7 +18,6 @@ import 'package:nylo_framework/nylo_framework.dart'; import 'package:woosignal/models/response/order.dart' as ws_order; - import '../widgets/woosignal_ui.dart'; class CheckoutStatusPage extends NyStatefulWidget { diff --git a/LabelStoreMax/lib/resources/pages/product_image_viewer_page.dart b/LabelStoreMax/lib/resources/pages/product_image_viewer_page.dart index 55c6e5f..205a4a0 100644 --- a/LabelStoreMax/lib/resources/pages/product_image_viewer_page.dart +++ b/LabelStoreMax/lib/resources/pages/product_image_viewer_page.dart @@ -15,9 +15,6 @@ import 'package:flutter_app/resources/widgets/safearea_widget.dart'; import 'package:flutter_swiper_tv/flutter_swiper.dart'; import 'package:nylo_framework/nylo_framework.dart'; - - - class ProductImageViewerPage extends NyStatefulWidget { @override final ProductImageViewerController controller = diff --git a/LabelStoreMax/lib/resources/pages/wishlist_page_widget.dart b/LabelStoreMax/lib/resources/pages/wishlist_page_widget.dart index e24550d..24ebc9d 100644 --- a/LabelStoreMax/lib/resources/pages/wishlist_page_widget.dart +++ b/LabelStoreMax/lib/resources/pages/wishlist_page_widget.dart @@ -104,7 +104,13 @@ class _WishListPageWidgetState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(product.name!, style: TextStyle(fontWeight: FontWeight.bold), maxLines: 2, overflow: TextOverflow.ellipsis,), + Text( + product.name!, + style: TextStyle( + fontWeight: FontWeight.bold), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), Text( formatStringCurrency( total: product.price), diff --git a/LabelStoreMax/lib/resources/widgets/notic_home_widget.dart b/LabelStoreMax/lib/resources/widgets/notic_home_widget.dart index c8bab24..6d2dce2 100644 --- a/LabelStoreMax/lib/resources/widgets/notic_home_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/notic_home_widget.dart @@ -176,18 +176,21 @@ class _NoticHomeWidgetState extends State { onLoading: _onLoading, child: (products.isNotEmpty ? ListView.builder( - scrollDirection: Axis.horizontal, - shrinkWrap: false, - itemBuilder: (cxt, i) { - return Container( - // height: 200, - width: MediaQuery.of(context).size.width / 2.5, - child: ProductItemContainer( - product: products[i], onTap: _showProduct), - ); - }, - itemCount: products.length, - ) + scrollDirection: Axis.horizontal, + shrinkWrap: false, + itemBuilder: (cxt, i) { + return Container( + // height: 200, + width: + MediaQuery.of(context).size.width / + 2.5, + child: ProductItemContainer( + product: products[i], + onTap: _showProduct), + ); + }, + itemCount: products.length, + ) : NoResultsForProductsWidget()), ), ) diff --git a/LabelStoreMax/lib/resources/widgets/notic_theme_widget.dart b/LabelStoreMax/lib/resources/widgets/notic_theme_widget.dart index d9c5ee8..3cf74ea 100644 --- a/LabelStoreMax/lib/resources/widgets/notic_theme_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/notic_theme_widget.dart @@ -73,9 +73,8 @@ class _NoticThemeWidgetState extends State { ), showSelectedLabels: false, showUnselectedLabels: false, - items: allNavWidgets! - .map((e) => e.bottomNavigationBarItem) - .toList(), + items: + allNavWidgets!.map((e) => e.bottomNavigationBarItem).toList(), ), ); } diff --git a/LabelStoreMax/lib/resources/widgets/product_detail_body_widget.dart b/LabelStoreMax/lib/resources/widgets/product_detail_body_widget.dart index 47ea957..4c750d9 100644 --- a/LabelStoreMax/lib/resources/widgets/product_detail_body_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/product_detail_body_widget.dart @@ -47,8 +47,8 @@ class ProductDetailBodyWidget extends StatelessWidget { // if (product != null) - ProductDetailUpsellWidget( - productIds: product!.upsellIds, wooSignalApp: wooSignalApp), + ProductDetailUpsellWidget( + productIds: product!.upsellIds, wooSignalApp: wooSignalApp), // ProductDetailRelatedProductsWidget( diff --git a/LabelStoreMax/lib/resources/widgets/product_detail_upsell_widget.dart b/LabelStoreMax/lib/resources/widgets/product_detail_upsell_widget.dart index f8fe768..9dea762 100644 --- a/LabelStoreMax/lib/resources/widgets/product_detail_upsell_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/product_detail_upsell_widget.dart @@ -28,7 +28,6 @@ class ProductDetailUpsellWidget extends StatefulWidget { } class _ProductDetailUpsellWidgetState extends State { - final ProductLoaderController _productLoaderController = ProductLoaderController(); @@ -73,18 +72,21 @@ class _ProductDetailUpsellWidgetState extends State { ], ), ), - Container( - height: 200, - child: ListView( - shrinkWrap: true, - scrollDirection: Axis.horizontal, - children: products - .map((e) => Container( - width: MediaQuery.of(context).size.width / 2.2, - child: ProductItemContainer(product: e),),) - .toList(), - ), - ), + Container( + height: 200, + child: ListView( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + children: products + .map( + (e) => Container( + width: MediaQuery.of(context).size.width / 2.2, + child: ProductItemContainer(product: e), + ), + ) + .toList(), + ), + ), ], ); } diff --git a/LabelStoreMax/lib/resources/widgets/safearea_widget.dart b/LabelStoreMax/lib/resources/widgets/safearea_widget.dart index 1029d77..1915e70 100644 --- a/LabelStoreMax/lib/resources/widgets/safearea_widget.dart +++ b/LabelStoreMax/lib/resources/widgets/safearea_widget.dart @@ -16,7 +16,6 @@ class SafeAreaWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return SafeArea( minimum: EdgeInsets.only(left: 16, right: 16, bottom: 8), child: child!, diff --git a/LabelStoreMax/lib/resources/widgets/woosignal_ui.dart b/LabelStoreMax/lib/resources/widgets/woosignal_ui.dart index 9d8ecf1..cd58296 100644 --- a/LabelStoreMax/lib/resources/widgets/woosignal_ui.dart +++ b/LabelStoreMax/lib/resources/widgets/woosignal_ui.dart @@ -313,148 +313,134 @@ class ProductItemContainer extends StatelessWidget { return SizedBox.shrink(); } return LayoutBuilder( - builder: (cxt, constraints) => - InkWell( - child: Container( - margin: EdgeInsets.all(4), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - height: constraints.maxHeight / 2, - child: ClipRRect( - borderRadius: BorderRadius.circular(3.0), - child: Stack( - children: [ - Container( - color: Colors.grey[100], - height: double.infinity, - width: double.infinity, - ), - CachedImageWidget( - image: (product!.images.isNotEmpty - ? product!.images.first.src - : getEnv("PRODUCT_PLACEHOLDER_IMAGE")), - fit: BoxFit.contain, - height: constraints.maxHeight / 2, - width: double.infinity, - ), - if (product!.onSale! && product!.type != "variable") - Positioned( - bottom: 0, - left: 0, - right: 0, - child: Container( - padding: EdgeInsets.all(3), - decoration: BoxDecoration( - color: Colors.white70, - borderRadius: BorderRadius.circular(4), - ), - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - text: '', - style: Theme - .of(context) + builder: (cxt, constraints) => InkWell( + child: Container( + margin: EdgeInsets.all(4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + height: constraints.maxHeight / 2, + child: ClipRRect( + borderRadius: BorderRadius.circular(3.0), + child: Stack( + children: [ + Container( + color: Colors.grey[100], + height: double.infinity, + width: double.infinity, + ), + CachedImageWidget( + image: (product!.images.isNotEmpty + ? product!.images.first.src + : getEnv("PRODUCT_PLACEHOLDER_IMAGE")), + fit: BoxFit.contain, + height: constraints.maxHeight / 2, + width: double.infinity, + ), + if (product!.onSale! && product!.type != "variable") + Positioned( + bottom: 0, + left: 0, + right: 0, + child: Container( + padding: EdgeInsets.all(3), + decoration: BoxDecoration( + color: Colors.white70, + borderRadius: BorderRadius.circular(4), + ), + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + text: '', + style: Theme.of(context).textTheme.bodyText1, + children: [ + TextSpan( + text: + "${workoutSaleDiscount(salePrice: product!.salePrice, priceBefore: product!.regularPrice)}% ${trans("off")}", + style: Theme.of(context) .textTheme - .bodyText1, - children: [ - TextSpan( - text: - "${workoutSaleDiscount( - salePrice: product!.salePrice, - priceBefore: product! - .regularPrice)}% ${trans( - "off")}", - style: Theme - .of(context) - .textTheme - .bodyText1! - .copyWith( + .bodyText1! + .copyWith( color: Colors.black87, fontSize: 11, ), - ), - ], ), - ), + ], ), ), - ], - ), - ), - ), - Container( - margin: const EdgeInsets.only(top: 2, bottom: 2), - child: Text( - product!.name!, - style: Theme - .of(context) - .textTheme - .bodyText2! - .copyWith(fontSize: 15), - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), - ), - Flexible( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - AutoSizeText( - "${formatStringCurrency(total: product!.price)} ", - style: Theme - .of(context) - .textTheme - .bodyText2! - .copyWith(fontWeight: FontWeight.w600), - textAlign: TextAlign.left, ), - if (product!.onSale! && product!.type != "variable") - RichText( - text: TextSpan(children: [ - TextSpan( - text: '${trans("Was")}: ', - style: Theme - .of(context) - .textTheme - .bodyText1! - .copyWith( + ), + ], + ), + ), + ), + Container( + margin: const EdgeInsets.only(top: 2, bottom: 2), + child: Text( + product!.name!, + style: Theme.of(context) + .textTheme + .bodyText2! + .copyWith(fontSize: 15), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ), + Flexible( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AutoSizeText( + "${formatStringCurrency(total: product!.price)} ", + style: Theme.of(context) + .textTheme + .bodyText2! + .copyWith(fontWeight: FontWeight.w600), + textAlign: TextAlign.left, + ), + if (product!.onSale! && product!.type != "variable") + RichText( + text: TextSpan(children: [ + TextSpan( + text: '${trans("Was")}: ', + style: Theme.of(context) + .textTheme + .bodyText1! + .copyWith( fontSize: 11, ), - ), - TextSpan( - text: formatStringCurrency( - total: product!.regularPrice, - ), - style: Theme - .of(context) - .textTheme - .bodyText1! - .copyWith( + ), + TextSpan( + text: formatStringCurrency( + total: product!.regularPrice, + ), + style: Theme.of(context) + .textTheme + .bodyText1! + .copyWith( decoration: TextDecoration.lineThrough, color: Colors.grey, fontSize: 11, ), - ), - ]), ), - ].toList(), - ), - ), + ]), + ), + ].toList(), ), - ], + ), ), - ), - onTap: () => - onTap != null - ? onTap!(product) - : Navigator.pushNamed(context, "/product-detail", - arguments: product), + ], ), + ), + onTap: () => onTap != null + ? onTap!(product) + : Navigator.pushNamed(context, "/product-detail", + arguments: product), + ), ); } }