1111import 'dart:developer' ;
1212
1313import 'package:flutter/cupertino.dart' ;
14+ import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart' ;
1415import 'package:intl/intl.dart' ;
1516import 'package:label_storemax/app_payment_methods.dart' ;
1617import 'package:label_storemax/helpers/app_localizations.dart' ;
@@ -78,7 +79,12 @@ class EdgeAlertStyle {
7879}
7980
8081void showEdgeAlertWith (context,
81- {title = "" , desc = "" , int gravity = 1 , int style = 1 , IconData icon}) {
82+ {title = "" ,
83+ desc = "" ,
84+ int gravity = 1 ,
85+ int style = 1 ,
86+ IconData icon,
87+ int duration}) {
8288 switch (style) {
8389 case 1 : // SUCCESS
8490 EdgeAlert .show (context,
@@ -87,7 +93,7 @@ void showEdgeAlertWith(context,
8793 gravity: gravity,
8894 backgroundColor: Colors .green,
8995 icon: icon ?? Icons .check,
90- duration: EdgeAlert .LENGTH_LONG );
96+ duration: duration ?? EdgeAlert .LENGTH_LONG );
9197 break ;
9298 case 2 : // WARNING
9399 EdgeAlert .show (context,
@@ -96,7 +102,7 @@ void showEdgeAlertWith(context,
96102 gravity: gravity,
97103 backgroundColor: Colors .orange,
98104 icon: icon ?? Icons .error_outline,
99- duration: EdgeAlert .LENGTH_LONG );
105+ duration: duration ?? EdgeAlert .LENGTH_LONG );
100106 break ;
101107 case 3 : // INFO
102108 EdgeAlert .show (context,
@@ -105,7 +111,7 @@ void showEdgeAlertWith(context,
105111 gravity: gravity,
106112 backgroundColor: Colors .teal,
107113 icon: icon ?? Icons .info,
108- duration: EdgeAlert .LENGTH_LONG );
114+ duration: duration ?? EdgeAlert .LENGTH_LONG );
109115 break ;
110116 case 4 : // DANGER
111117 EdgeAlert .show (context,
@@ -114,7 +120,7 @@ void showEdgeAlertWith(context,
114120 gravity: gravity,
115121 backgroundColor: Colors .redAccent,
116122 icon: icon ?? Icons .warning,
117- duration: EdgeAlert .LENGTH_LONG );
123+ duration: duration ?? EdgeAlert .LENGTH_LONG );
118124 break ;
119125 default :
120126 break ;
@@ -509,14 +515,24 @@ Widget refreshableScroll(context,
509515 onRefresh: onRefresh,
510516 onLoading: onLoading,
511517 child: (products.length != null && products.length > 0
512- ? GridView . count (
518+ ? StaggeredGridView . countBuilder (
513519 crossAxisCount: 2 ,
514- shrinkWrap: true ,
515- children: List .generate (
516- products.length,
517- (index) => wsCardProductItem (context,
518- index: index, product: products[index], onTap: onTap),
519- ))
520+ itemCount: products.length,
521+ itemBuilder: (BuildContext context, int index) {
522+ return Container (
523+ height: 200 ,
524+ child: wsCardProductItem (
525+ context,
526+ index: (index),
527+ product: products[index],
528+ onTap: onTap,
529+ ),
530+ );
531+ },
532+ staggeredTileBuilder: (int index) => new StaggeredTile .fit (1 ),
533+ mainAxisSpacing: 4.0 ,
534+ crossAxisSpacing: 4.0 ,
535+ )
520536 : wsNoResults (context)),
521537 );
522538}
0 commit comments