@@ -17,9 +17,10 @@ class CustomerProductCard extends StatelessWidget {
1717 @override
1818 Widget build (BuildContext context) {
1919 final snackBar = SnackBar (
20- content: const Text ('This is the maximum quantity that can be ordered.' ),
21- duration: const Duration (seconds: 2 ),
22- );
20+ content: const Text ('This is the maximum quantity that can be ordered.' ),
21+ duration: const Duration (seconds: 2 ),
22+ );
23+
2324 return BlocBuilder <CustomerCubit , CustomerState >(
2425 builder: (context, state) {
2526 int inCartQty = 0 ;
@@ -75,7 +76,7 @@ class CustomerProductCard extends StatelessWidget {
7576 ),
7677 const SizedBox (height: 4 ),
7778
78- // --- ADDED: Retailer Name ---
79+ // --- Retailer Name ---
7980 Text (
8081 "Sold by ${product .retailerName }" ,
8182 style: TextStyle (fontSize: 10 , color: Colors .grey[600 ], fontStyle: FontStyle .italic),
@@ -104,16 +105,28 @@ class CustomerProductCard extends StatelessWidget {
104105 ),
105106 )
106107 else if (inCartQty == 0 )
107- SizedBox (
108- width: double .infinity,
109- height: 36 ,
110- child: ElevatedButton (
111- onPressed: onAdd,
112- style: ElevatedButton .styleFrom (
113- shape: RoundedRectangleBorder (borderRadius: BorderRadius .circular (8 )),
114- ),
115- child: const Text ("Add to Cart" , style: TextStyle (fontSize: 12 )),
116- ),
108+ LayoutBuilder (
109+ builder: (context, constraints) {
110+ // Check if the screen is mobile width
111+ bool isMobile = MediaQuery .of (context).size.width < 600 ;
112+
113+ return SizedBox (
114+ width: double .infinity,
115+ height: 36 ,
116+ child: ElevatedButton (
117+ onPressed: onAdd,
118+ style: ElevatedButton .styleFrom (
119+ backgroundColor: Colors .black, // Always Black
120+ shape: RoundedRectangleBorder (borderRadius: BorderRadius .circular (8 )),
121+ padding: EdgeInsets .zero, // Ensures icon is centered
122+ ),
123+ // Show Icon on mobile, Text on desktop
124+ child: isMobile
125+ ? const Icon (Icons .shopping_cart_outlined, color: Colors .white, size: 20 )
126+ : const Text ("Add to Cart" , style: TextStyle (fontSize: 12 , color: Colors .white)),
127+ ),
128+ );
129+ }
117130 )
118131 else
119132 Container (
@@ -135,7 +148,7 @@ class CustomerProductCard extends StatelessWidget {
135148
136149 Text (
137150 '$inCartQty ' ,
138- style: const TextStyle (fontWeight: FontWeight .bold, fontSize: 14 )
151+ style: const TextStyle (fontWeight: FontWeight .bold, fontSize: 14 , color : Colors .white )
139152 ),
140153
141154 IconButton (
0 commit comments