You are on page 1of 5
zo 1:18 Citi -mohammadkamalfayya: E-Commerce hie ppleston | mohammadkamal / Bayya (Public E-Commerce flutter application Wy Ostars = Y 1 fork star - D. Notifications <> Code © Issues [} Pullrequests © Actions [H Projects © Security | Insights F omain + Go to file (@ mohammadkamal on Apr 22, 2022 @ View code Bayya An e-commerce flutter application. Features ‘© Shopping Cart & Watchlist tracking ‘© User Login and registration support ‘Reviewing the products © Different views * Dynamic search mechanism Challenges ‘© Build list views on demand - less memory Using Listview.builder() instead of ListView() default constructor Example: More-memory consuming code Widget _listofProducts() { return ListView( padding: FdgeInsets.symmetric(vertical: 8.0), children: //Check if the list is empty Provider .of (context). shoppingItemQuantites. isNotempty hitpssigthub.com/mohemmadkamalBayya 15 zovovan23 1:19 Citius - monammadkamaliBayye: E-Commerce iter application ? Provider.of(context) «shoppingItemQuantites keys smap((e) { return ShoppingCartrtem(productId: e)5 }).tolist() 2 Os Less-memory consuming code Widget _listofProducts() { return ListView. builder( padding: EdgeInsets.symmetric(vertical: 8.0), // Get items count using Provider itemCount: Provider.of (context) - shoppingItenQuantites -keys -length, itemBuilder: (context, index) { return ShoppingCartItem( productId: Provider.of(context) -shoppingItenQuantites -keys -elementAt(index)); * Future code organization Using Futuresuilder instead of setting the state manually Example: Manual state management string _vendor = ‘vendor not provided’ ; Widget _vendorcard() { _getVendorName(); return Container( Padding: const EdgeInsets.all(4), margin: const EdgeInsets.only(bottom: 2), color: Colors.white, child: Colunn( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [Text(*Vendor:')], ds Row( children: [Text(_vendor)], ) 1, hitpssigthub.com/mohemmadkamalBayya 215 0101/2028 11:19 GitHub - mohammadkamal/Bayya: E-Commerce futer application ds uw Futurecvoid> _getVendorName() asyne { var _result = await Provider. of(context) .getVendorNameByUid( Provider .of (context) .productsCatalog[ widget . productId] . vendor) ; vendor = _result; Future state managemet Widget _vendorText() return FutureBuilder( future: Provider.of (context) .getVendorNaneByUid( Provider. of(context) -productsCatalog[ widget productId] -vendor), builder: (context, snapshot) { if (snapshot.hasData) { return Text(snapshot.data, style: TextStyle(fontweight: FontWeight bold); } else { return Text("Vendor isn't provieded"); } Ds Demo & Images Video Demo hitpssigthub comimohammadkamallbayy 35 0101/2028 11:19 GitHub - mohammadkamal/Bayya: E-Commerce fuer application README.md Main screen le-List view la.Grid view @ Sidebar lesidebar Product page Product main screen #Added to cart ‘#-Watchlist l#-Reviews Search page esearch Releases 3 © Baya 0.1.2 con Jun 27, 2021 + 2 releases Packages No packages published hitpsigthu.comimohammadkamalfayya ais 0101/2028 11:19 Languages © Dart 79.3% Other 0.19% © cae 135% hitpssigthub.com/mohemmadkamalBayya GitHub - mohammadkamal/Bayya: E-Commerce futer application © CMake 53% © HTML10% © CO5% © Swifto3% 55

You might also like