v6.0.0 - Flutter format

This commit is contained in:
Anthony 2022-05-19 21:46:20 +01:00
parent e40b36a181
commit f5d22921b9
15 changed files with 153 additions and 166 deletions

View File

@ -516,8 +516,7 @@ Future<List<dynamic>> getWishlistProducts() async {
String? currentProductsJSON = String? currentProductsJSON =
await (NyStorage.read(SharedKey.wishlistProducts)); await (NyStorage.read(SharedKey.wishlistProducts));
if (currentProductsJSON != null) { if (currentProductsJSON != null) {
favouriteProducts = favouriteProducts = (jsonDecode(currentProductsJSON)).toList();
(jsonDecode(currentProductsJSON)).toList();
} }
return favouriteProducts; return favouriteProducts;
} }

View File

@ -16,7 +16,6 @@ import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_framework/nylo_framework.dart'; import 'package:nylo_framework/nylo_framework.dart';
import 'package:woosignal/models/response/order.dart'; import 'package:woosignal/models/response/order.dart';
class AccountOrderDetailPage extends NyStatefulWidget { class AccountOrderDetailPage extends NyStatefulWidget {

View File

@ -19,7 +19,6 @@ import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_framework/nylo_framework.dart'; import 'package:nylo_framework/nylo_framework.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:woosignal/models/response/product_category.dart'; import 'package:woosignal/models/response/product_category.dart';
import 'package:woosignal/models/response/products.dart' as ws_product; import 'package:woosignal/models/response/products.dart' as ws_product;

View File

@ -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:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:nylo_framework/nylo_framework.dart'; import 'package:nylo_framework/nylo_framework.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:woosignal/models/response/products.dart' as ws_product; import 'package:woosignal/models/response/products.dart' as ws_product;

View File

@ -17,7 +17,6 @@ import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_app/resources/widgets/woosignal_ui.dart'; import 'package:flutter_app/resources/widgets/woosignal_ui.dart';
import 'package:nylo_framework/nylo_framework.dart'; import 'package:nylo_framework/nylo_framework.dart';
class CheckoutPaymentTypePage extends StatefulWidget { class CheckoutPaymentTypePage extends StatefulWidget {
CheckoutPaymentTypePage(); CheckoutPaymentTypePage();

View File

@ -18,7 +18,6 @@ import 'package:nylo_framework/nylo_framework.dart';
import 'package:woosignal/models/response/order.dart' as ws_order; import 'package:woosignal/models/response/order.dart' as ws_order;
import '../widgets/woosignal_ui.dart'; import '../widgets/woosignal_ui.dart';
class CheckoutStatusPage extends NyStatefulWidget { class CheckoutStatusPage extends NyStatefulWidget {

View File

@ -15,9 +15,6 @@ import 'package:flutter_app/resources/widgets/safearea_widget.dart';
import 'package:flutter_swiper_tv/flutter_swiper.dart'; import 'package:flutter_swiper_tv/flutter_swiper.dart';
import 'package:nylo_framework/nylo_framework.dart'; import 'package:nylo_framework/nylo_framework.dart';
class ProductImageViewerPage extends NyStatefulWidget { class ProductImageViewerPage extends NyStatefulWidget {
@override @override
final ProductImageViewerController controller = final ProductImageViewerController controller =

View File

@ -104,7 +104,13 @@ class _WishListPageWidgetState extends State<WishListPageWidget> {
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.center, MainAxisAlignment.center,
children: [ 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( Text(
formatStringCurrency( formatStringCurrency(
total: product.price), total: product.price),

View File

@ -176,18 +176,21 @@ class _NoticHomeWidgetState extends State<NoticHomeWidget> {
onLoading: _onLoading, onLoading: _onLoading,
child: (products.isNotEmpty child: (products.isNotEmpty
? ListView.builder( ? ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
shrinkWrap: false, shrinkWrap: false,
itemBuilder: (cxt, i) { itemBuilder: (cxt, i) {
return Container( return Container(
// height: 200, // height: 200,
width: MediaQuery.of(context).size.width / 2.5, width:
child: ProductItemContainer( MediaQuery.of(context).size.width /
product: products[i], onTap: _showProduct), 2.5,
); child: ProductItemContainer(
}, product: products[i],
itemCount: products.length, onTap: _showProduct),
) );
},
itemCount: products.length,
)
: NoResultsForProductsWidget()), : NoResultsForProductsWidget()),
), ),
) )

View File

@ -73,9 +73,8 @@ class _NoticThemeWidgetState extends State<NoticThemeWidget> {
), ),
showSelectedLabels: false, showSelectedLabels: false,
showUnselectedLabels: false, showUnselectedLabels: false,
items: allNavWidgets! items:
.map((e) => e.bottomNavigationBarItem) allNavWidgets!.map((e) => e.bottomNavigationBarItem).toList(),
.toList(),
), ),
); );
} }

View File

@ -47,8 +47,8 @@ class ProductDetailBodyWidget extends StatelessWidget {
// </Product reviews> // </Product reviews>
if (product != null) if (product != null)
ProductDetailUpsellWidget( ProductDetailUpsellWidget(
productIds: product!.upsellIds, wooSignalApp: wooSignalApp), productIds: product!.upsellIds, wooSignalApp: wooSignalApp),
// </You may also like> // </You may also like>
ProductDetailRelatedProductsWidget( ProductDetailRelatedProductsWidget(

View File

@ -28,7 +28,6 @@ class ProductDetailUpsellWidget extends StatefulWidget {
} }
class _ProductDetailUpsellWidgetState extends State<ProductDetailUpsellWidget> { class _ProductDetailUpsellWidgetState extends State<ProductDetailUpsellWidget> {
final ProductLoaderController _productLoaderController = final ProductLoaderController _productLoaderController =
ProductLoaderController(); ProductLoaderController();
@ -73,18 +72,21 @@ class _ProductDetailUpsellWidgetState extends State<ProductDetailUpsellWidget> {
], ],
), ),
), ),
Container( Container(
height: 200, height: 200,
child: ListView( child: ListView(
shrinkWrap: true, shrinkWrap: true,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: products children: products
.map((e) => Container( .map(
width: MediaQuery.of(context).size.width / 2.2, (e) => Container(
child: ProductItemContainer(product: e),),) width: MediaQuery.of(context).size.width / 2.2,
.toList(), child: ProductItemContainer(product: e),
), ),
), )
.toList(),
),
),
], ],
); );
} }

View File

@ -16,7 +16,6 @@ class SafeAreaWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SafeArea( return SafeArea(
minimum: EdgeInsets.only(left: 16, right: 16, bottom: 8), minimum: EdgeInsets.only(left: 16, right: 16, bottom: 8),
child: child!, child: child!,

View File

@ -313,148 +313,134 @@ class ProductItemContainer extends StatelessWidget {
return SizedBox.shrink(); return SizedBox.shrink();
} }
return LayoutBuilder( return LayoutBuilder(
builder: (cxt, constraints) => builder: (cxt, constraints) => InkWell(
InkWell( child: Container(
child: Container( margin: EdgeInsets.all(4),
margin: EdgeInsets.all(4), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[
children: <Widget>[ Container(
Container( height: constraints.maxHeight / 2,
height: constraints.maxHeight / 2, child: ClipRRect(
child: ClipRRect( borderRadius: BorderRadius.circular(3.0),
borderRadius: BorderRadius.circular(3.0), child: Stack(
child: Stack( children: [
children: [ Container(
Container( color: Colors.grey[100],
color: Colors.grey[100], height: double.infinity,
height: double.infinity, width: double.infinity,
width: double.infinity, ),
), CachedImageWidget(
CachedImageWidget( image: (product!.images.isNotEmpty
image: (product!.images.isNotEmpty ? product!.images.first.src
? product!.images.first.src : getEnv("PRODUCT_PLACEHOLDER_IMAGE")),
: getEnv("PRODUCT_PLACEHOLDER_IMAGE")), fit: BoxFit.contain,
fit: BoxFit.contain, height: constraints.maxHeight / 2,
height: constraints.maxHeight / 2, width: double.infinity,
width: double.infinity, ),
), if (product!.onSale! && product!.type != "variable")
if (product!.onSale! && product!.type != "variable") Positioned(
Positioned( bottom: 0,
bottom: 0, left: 0,
left: 0, right: 0,
right: 0, child: Container(
child: Container( padding: EdgeInsets.all(3),
padding: EdgeInsets.all(3), decoration: BoxDecoration(
decoration: BoxDecoration( color: Colors.white70,
color: Colors.white70, borderRadius: BorderRadius.circular(4),
borderRadius: BorderRadius.circular(4), ),
), child: RichText(
child: RichText( textAlign: TextAlign.center,
textAlign: TextAlign.center, text: TextSpan(
text: TextSpan( text: '',
text: '', style: Theme.of(context).textTheme.bodyText1,
style: Theme children: <TextSpan>[
.of(context) TextSpan(
text:
"${workoutSaleDiscount(salePrice: product!.salePrice, priceBefore: product!.regularPrice)}% ${trans("off")}",
style: Theme.of(context)
.textTheme .textTheme
.bodyText1, .bodyText1!
children: <TextSpan>[ .copyWith(
TextSpan(
text:
"${workoutSaleDiscount(
salePrice: product!.salePrice,
priceBefore: product!
.regularPrice)}% ${trans(
"off")}",
style: Theme
.of(context)
.textTheme
.bodyText1!
.copyWith(
color: Colors.black87, color: Colors.black87,
fontSize: 11, 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 Container(
.of(context) margin: const EdgeInsets.only(top: 2, bottom: 2),
.textTheme child: Text(
.bodyText1! product!.name!,
.copyWith( 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, fontSize: 11,
), ),
), ),
TextSpan( TextSpan(
text: formatStringCurrency( text: formatStringCurrency(
total: product!.regularPrice, total: product!.regularPrice,
), ),
style: Theme style: Theme.of(context)
.of(context) .textTheme
.textTheme .bodyText1!
.bodyText1! .copyWith(
.copyWith(
decoration: TextDecoration.lineThrough, decoration: TextDecoration.lineThrough,
color: Colors.grey, color: Colors.grey,
fontSize: 11, 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),
),
); );
} }
} }