@@ -237,143 +237,138 @@ class _CheckoutShippingTypePageState extends State<CheckoutShippingTypePage> {
237
237
body: SafeAreaWidget (
238
238
child: GestureDetector (
239
239
onTap: () => FocusScope .of (context).requestFocus (FocusNode ()),
240
- child: LayoutBuilder (
241
- builder: (context, constraints) => Column (
242
- crossAxisAlignment: CrossAxisAlignment .start,
243
- mainAxisAlignment: MainAxisAlignment .spaceEvenly,
244
- children: < Widget > [
245
- Padding (
246
- child: Center (
247
- child: Image .asset (
248
- getImageAsset ('shipping_icon.png' ),
249
- height: 100 ,
250
- color: (Theme .of (context).brightness == Brightness .light)
251
- ? null
252
- : Colors .white,
253
- fit: BoxFit .fitHeight,
254
- ),
240
+ child: Column (
241
+ crossAxisAlignment: CrossAxisAlignment .center,
242
+ mainAxisAlignment: MainAxisAlignment .center,
243
+ children: [
244
+ Padding (
245
+ child: Center (
246
+ child: Image .asset (
247
+ getImageAsset ('shipping_icon.png' ),
248
+ height: 100 ,
249
+ color: (Theme .of (context).brightness == Brightness .light)
250
+ ? null
251
+ : Colors .white,
252
+ fit: BoxFit .fitHeight,
255
253
),
256
- padding: EdgeInsets .only (top: 20 ),
257
254
),
258
- SizedBox (
259
- child: Container (
260
- child: Column (
261
- crossAxisAlignment: CrossAxisAlignment .center,
262
- mainAxisAlignment: MainAxisAlignment .spaceAround,
263
- children: < Widget > [
264
- (_isLoading
265
- ? Expanded (child: AppLoaderWidget ())
266
- : (_isShippingSupported
267
- ? Expanded (
268
- child: ListView .separated (
269
- itemCount: _wsShippingOptions.length,
270
- separatorBuilder: (context, index) =>
271
- Divider (
272
- color: Colors .black12,
273
- ),
274
- itemBuilder:
275
- (BuildContext context, int index) {
276
- return ListTile (
277
- contentPadding: EdgeInsets .only (
278
- left: 16 ,
279
- right: 16 ,
280
- ),
281
- title: Text (
282
- _wsShippingOptions[index]['title' ],
283
- style: Theme .of (context)
255
+ padding: EdgeInsets .only (top: 20 ),
256
+ ),
257
+ Expanded (child: Container (
258
+ child: Column (
259
+ crossAxisAlignment: CrossAxisAlignment .center,
260
+ mainAxisAlignment: MainAxisAlignment .spaceAround,
261
+ children: < Widget > [
262
+ (_isLoading
263
+ ? Expanded (child: AppLoaderWidget ())
264
+ : (_isShippingSupported
265
+ ? Expanded (
266
+ child: ListView .separated (
267
+ itemCount: _wsShippingOptions.length,
268
+ separatorBuilder: (context, index) =>
269
+ Divider (
270
+ color: Colors .black12,
271
+ ),
272
+ itemBuilder:
273
+ (BuildContext context, int index) {
274
+ return ListTile (
275
+ contentPadding: EdgeInsets .only (
276
+ left: 16 ,
277
+ right: 16 ,
278
+ ),
279
+ title: Text (
280
+ _wsShippingOptions[index]['title' ],
281
+ style: Theme .of (context)
282
+ .textTheme
283
+ .titleMedium!
284
+ .copyWith (
285
+ fontWeight: FontWeight .bold,
286
+ ),
287
+ ),
288
+ selected: true ,
289
+ subtitle: NyFutureBuilder <String >(
290
+ future: _getShippingPrice (index),
291
+ child:
292
+ (BuildContext context, data) {
293
+ Map <String , dynamic >
294
+ shippingOption =
295
+ _wsShippingOptions[index];
296
+ return RichText (
297
+ text: TextSpan (
298
+ text: '' ,
299
+ style: Theme .of (context)
300
+ .textTheme
301
+ .bodyMedium,
302
+ children: < TextSpan > [
303
+ (shippingOption["object" ]
304
+ is FreeShipping
305
+ ? TextSpan (
306
+ text: trans (
307
+ "Free postage" ),
308
+ )
309
+ : TextSpan (
310
+ text:
311
+ "${trans ("Price" )}: ${formatStringCurrency (total : data )}" ,
312
+ )),
313
+ if (shippingOption[
314
+ "min_amount" ] !=
315
+ null )
316
+ TextSpan (
317
+ text:
318
+ "\n ${trans ("Spend a minimum of" )} ${formatStringCurrency (total : shippingOption ["min_amount" ])}" ,
319
+ style:
320
+ Theme .of (context)
284
321
.textTheme
285
- .titleMedium !
322
+ .bodyMedium !
286
323
.copyWith (
287
- fontWeight: FontWeight .bold,
288
- ),
289
- ),
290
- selected: true ,
291
- subtitle: NyFutureBuilder <String >(
292
- future: _getShippingPrice (index),
293
- child:
294
- (BuildContext context, data) {
295
- Map <String , dynamic >
296
- shippingOption =
297
- _wsShippingOptions[index];
298
- return RichText (
299
- text: TextSpan (
300
- text: '' ,
301
- style: Theme .of (context)
302
- .textTheme
303
- .bodyMedium,
304
- children: < TextSpan > [
305
- (shippingOption["object" ]
306
- is FreeShipping
307
- ? TextSpan (
308
- text: trans (
309
- "Free postage" ),
310
- )
311
- : TextSpan (
312
- text:
313
- "${trans ("Price" )}: ${formatStringCurrency (total : data )}" ,
314
- )),
315
- if (shippingOption[
316
- "min_amount" ] !=
317
- null )
318
- TextSpan (
319
- text:
320
- "\n ${trans ("Spend a minimum of" )} ${formatStringCurrency (total : shippingOption ["min_amount" ])}" ,
321
- style:
322
- Theme .of (context)
323
- .textTheme
324
- .bodyMedium!
325
- .copyWith (
326
- fontSize:
327
- 14 ))
328
- ],
329
- ),
330
- );
331
- },
332
- ),
333
- trailing: (CheckoutSession .getInstance
334
- .shippingType !=
335
- null &&
336
- CheckoutSession
337
- .getInstance
338
- .shippingType!
339
- .object ==
340
- _wsShippingOptions[index]
341
- ["object" ]
342
- ? Icon (Icons .check)
343
- : null ),
344
- onTap: () =>
345
- _handleCheckoutTapped (index),
346
- );
347
- },
348
- ),
349
- )
350
- : Text (
351
- trans (
352
- "Shipping is not supported for your location, sorry" ),
353
- style:
354
- Theme .of (context).textTheme.titleLarge,
355
- textAlign: TextAlign .center,
356
- ))),
357
- LinkButton (
358
- title: trans ("CANCEL" ),
359
- action: () => Navigator .pop (context),
360
- ),
361
- ],
362
- ),
363
- decoration: BoxDecoration (
364
- color: ThemeColor .get (context).backgroundContainer,
365
- borderRadius: BorderRadius .circular (10 ),
366
- boxShadow:
367
- (Theme .of (context).brightness == Brightness .light)
368
- ? wsBoxShadow ()
369
- : null ,
324
+ fontSize:
325
+ 14 ))
326
+ ],
327
+ ),
328
+ );
329
+ },
330
+ ),
331
+ trailing: (CheckoutSession .getInstance
332
+ .shippingType !=
333
+ null &&
334
+ CheckoutSession
335
+ .getInstance
336
+ .shippingType!
337
+ .object ==
338
+ _wsShippingOptions[index]
339
+ ["object" ]
340
+ ? Icon (Icons .check)
341
+ : null ),
342
+ onTap: () =>
343
+ _handleCheckoutTapped (index),
344
+ );
345
+ },
346
+ ),
347
+ )
348
+ : Text (
349
+ trans (
350
+ "Shipping is not supported for your location, sorry" ),
351
+ style:
352
+ Theme .of (context).textTheme.titleLarge,
353
+ textAlign: TextAlign .center,
354
+ ))),
355
+ LinkButton (
356
+ title: trans ("CANCEL" ),
357
+ action: () => Navigator .pop (context),
370
358
),
371
- padding: EdgeInsets .all (8 ),
372
- ),
373
- height: (constraints.maxHeight - constraints.minHeight) * 0.5 ,
359
+ ],
360
+ ),
361
+ decoration: BoxDecoration (
362
+ color: ThemeColor .get (context).backgroundContainer,
363
+ borderRadius: BorderRadius .circular (10 ),
364
+ boxShadow:
365
+ (Theme .of (context).brightness == Brightness .light)
366
+ ? wsBoxShadow ()
367
+ : null ,
374
368
),
375
- ],
376
- ),
369
+ padding: EdgeInsets .all (8 ),
370
+ ),),
371
+ ],
377
372
),
378
373
),
379
374
),
0 commit comments