Skip to content

Commit

Permalink
Improve code style using lint rules v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaSys committed Jan 27, 2023
1 parent bfdd3b9 commit 277c37c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
4 changes: 2 additions & 2 deletions lib/src/controller/product_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ class ProductController extends GetxController {
if (product.sizes?.categorical != null) {
for (var element in product.sizes!.categorical!) {
if (element.isSelected) {
currentSize = "Size:" + element.categorical.name.toString();
currentSize = "Size: ${element.categorical.name}";
}
}
}

if (product.sizes?.numerical != null) {
for (var element in product.sizes!.numerical!) {
if (element.isSelected) {
currentSize = "Size:" + element.numerical;
currentSize = "Size: ${element.numerical}";
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/view/screen/cart_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ class CartScreen extends StatelessWidget {
padding: const EdgeInsets.only(left: 30, right: 30, bottom: 20),
child: ElevatedButton(
style: ElevatedButton.styleFrom(padding: const EdgeInsets.all(20)),
child: const Text("Buy Now"),
onPressed: controller.isEmptyCart ? null : () {},
child: const Text("Buy Now"),
),
),
);
Expand Down
20 changes: 5 additions & 15 deletions lib/src/view/screen/product_detail_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ class ProductDetailScreen extends StatelessWidget {
controller.productImageDefaultIndex.value = 0;
Navigator.pop(context);
},
icon: const Icon(
Icons.arrow_back,
color: Colors.black,
),
icon: const Icon(Icons.arrow_back, color: Colors.black),
),
);
}
Expand All @@ -54,10 +51,7 @@ class ProductDetailScreen extends StatelessWidget {
itemBuilder: (_, index) {
return FittedBox(
fit: BoxFit.none,
child: Image.asset(
product.images[index],
scale: 3,
),
child: Image.asset(product.images[index], scale: 3),
);
},
),
Expand All @@ -83,9 +77,7 @@ class ProductDetailScreen extends StatelessWidget {
RatingBar.builder(
initialRating: product.rating,
direction: Axis.horizontal,
itemBuilder: (_, index) {
return const Icon(Icons.star, color: Colors.amber);
},
itemBuilder: (_, __) => const Icon(Icons.star, color: Colors.amber),
onRatingUpdate: (_) {},
),
Text(
Expand Down Expand Up @@ -196,19 +188,17 @@ class ProductDetailScreen extends StatelessWidget {
SizedBox(
height: 40,
child: GetBuilder<ProductController>(
builder: (ProductController controller) {
return productSizesListView();
},
builder: (_) => productSizesListView(),
),
),
const SizedBox(height: 20),
SizedBox(
width: double.infinity,
child: ElevatedButton(
child: const Text("Add to cart"),
onPressed: product.isAvailable
? () => controller.addToCart(product)
: null,
child: const Text("Add to cart"),
),
)
],
Expand Down
2 changes: 1 addition & 1 deletion lib/src/view/widget/product_grid_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ class ProductGridView extends StatelessWidget {
itemBuilder: (_, index) {
Product product = controller.filteredProducts[index];
return OpenContainerWrapper(
product: product,
child: GridTile(
header: _gridItemHeader(product, index),
footer: _gridItemFooter(product, context),
child: _gridItemBody(product),
),
product: product,
);
},
),
Expand Down

0 comments on commit 277c37c

Please sign in to comment.