Skip to content

Commit

Permalink
Adding scroll physics for grid view instead of explicit height
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaSys committed Jan 23, 2023
1 parent e46b696 commit 5413e5a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/src/view/screen/all_product_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class AllProductScreen extends StatelessWidget {
_recommendedProductListView(context),
_topCategoriesHeader(context),
_topCategoriesListView(),
const SizedBox(height: 400, child: ProductGridView())
const ProductGridView()
],
),
),
Expand Down
19 changes: 13 additions & 6 deletions lib/src/view/widget/product_grid_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class ProductGridView extends StatelessWidget {
visible: controller.isPriceOff(product),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30), color: Colors.white),
borderRadius: BorderRadius.circular(30),
color: Colors.white,
),
width: 80,
height: 30,
alignment: Alignment.center,
Expand Down Expand Up @@ -75,7 +77,9 @@ class ProductGridView extends StatelessWidget {
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: const TextStyle(
fontWeight: FontWeight.w500, color: Colors.grey),
fontWeight: FontWeight.w500,
color: Colors.grey,
),
),
),
const SizedBox(height: 5),
Expand Down Expand Up @@ -115,11 +119,14 @@ class ProductGridView extends StatelessWidget {
padding: const EdgeInsets.only(top: 20),
child: GridView.builder(
itemCount: controller.filteredProducts.length,
shrinkWrap: true,
physics: const ScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
childAspectRatio: 10 / 16,
crossAxisCount: 2,
mainAxisSpacing: 10,
crossAxisSpacing: 10),
childAspectRatio: 10 / 16,
crossAxisCount: 2,
mainAxisSpacing: 10,
crossAxisSpacing: 10,
),
itemBuilder: (_, index) {
Product product = controller.filteredProducts[index];
return OpenContainerWrapper(
Expand Down

0 comments on commit 5413e5a

Please sign in to comment.