Skip to content

Commit 392a4a0

Browse files
committed
fix: update layout of ProductCard in MainApp for better alignment and dimensions
1 parent 734ccbf commit 392a4a0

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

example/lib/main.dart

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,36 @@ class MainApp extends StatelessWidget {
1212
Widget build(BuildContext context) {
1313
return MaterialApp(
1414
home: Scaffold(
15-
body: Center(
16-
child: SizedBox(
17-
height: 400,
18-
width: 300,
19-
child: ProductCard(
20-
imageUrl:
21-
'https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcQndSK7hvssofrM2uzv75NxVjrkAwH3RwyqWcBesUsmq1ipmkuljRr6x_SRbCKaBXvjTR9CKfAaEFtmUFw-69o52wgVMgk2hp8KDYr4FvKtQ8ZfKewgOW4gDQ&usqp=CAE',
22-
categoryName: 'Pants',
23-
productName: 'Men Linen Pants',
24-
price: 199.99,
25-
currency: '\$', // Default is '$'
26-
onTap: () {
27-
// Handle card tap event
28-
},
29-
onFavoritePressed: () {
30-
// Handle favorite button press
31-
},
32-
shortDescription:
33-
'comfortable & airy.', // Optional short description
34-
rating: 4.2, // Optional rating
35-
discountPercentage: 35.0, // Optional discount percentage
36-
isAvailable: true, // Optional availability status
37-
cardColor: Colors.white, // Optional card background color
38-
textColor: Colors.black, // Optional text color
39-
borderRadius: 8.0, // Optional border radius
15+
body: Row(
16+
mainAxisAlignment: MainAxisAlignment.center,
17+
children: [
18+
Center(
19+
child: ProductCard(
20+
imageUrl:
21+
'https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcQndSK7hvssofrM2uzv75NxVjrkAwH3RwyqWcBesUsmq1ipmkuljRr6x_SRbCKaBXvjTR9CKfAaEFtmUFw-69o52wgVMgk2hp8KDYr4FvKtQ8ZfKewgOW4gDQ&usqp=CAE',
22+
categoryName: 'Pants',
23+
productName: 'Men Linen Pants',
24+
price: 199.99,
25+
currency: '\$', // Default is '$'
26+
onTap: () {
27+
// Handle card tap event
28+
},
29+
onFavoritePressed: () {
30+
// Handle favorite button press
31+
},
32+
shortDescription:
33+
'comfortable & airy.', // Optional short description
34+
rating: 4.2, // Optional rating
35+
discountPercentage: 35.0, // Optional discount percentage
36+
isAvailable: true, // Optional availability status
37+
cardColor: Colors.white, // Optional card background color
38+
textColor: Colors.black, // Optional text color
39+
borderRadius: 8.0, // Optional border radius
40+
width: 300, // optional
41+
height: 380, // optional
42+
),
4043
),
41-
),
44+
],
4245
),
4346
),
4447
);

0 commit comments

Comments
 (0)