From e85b21c08fa5eed40fba319fa71eb2c31b416976 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 9 Dec 2020 19:15:56 +0200 Subject: [PATCH] parent_categorise_page update --- lib/pages/parent_categorise_page.dart | 1734 +++++++++++++------------ 1 file changed, 888 insertions(+), 846 deletions(-) diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 4acb3b68..414106b1 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart'; @@ -52,766 +53,970 @@ class _ParentCategorisePageState extends State { backgroundColor: Colors.white, isShowDecPage: false, baseViewModel: model, - body: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 5.90, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Image.network( - id == '1' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' - : id == '2' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' - : id == '3' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' - : id == '4' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' - : id == '5' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' - : id == '6' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' - : id == '7' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' - : id == '8' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' - : id == '9' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' - : id == '10' - ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' - : '', - fit: BoxFit.fill, - height: 160.0, - width: double.infinity), - ), - if (model.categoriseParent.length > 8) - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + body: Container( + child: ListView( + scrollDirection: Axis.vertical, + children: [ + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Image.network( + id == '1' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089188_personal-care_2.png' + : id == '2' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089189_skin-care_2.png' + : id == '3' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089190_health-care_2.png' + : id == '4' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089191_sexual-health_2.png' + : id == '5' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089192_beauty_2.png' + : id == '6' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089193_baby-child_2.png' + : id == '7' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089194_vitamins-supplements_2.png' + : id == '8' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' + : id == '9' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' + : id == '10' + ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' + : '', + fit: BoxFit.fill, + height: 160.0, + width: double.infinity), + ), + if (model.categoriseParent.length > 8) + Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: EdgeInsets.all(10.0), - child: InkWell( - child: Container( - child: Texts( - 'View All Categories', - fontWeight: FontWeight.w300, - ), - ), - onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return Container( - height: MediaQuery.of(context) - .size - .height * - 0.89, - color: Colors.white, - child: Center( - child: ListView.builder( - scrollDirection: - Axis.vertical, - itemCount: model - .categoriseParent.length, - itemBuilder: - (BuildContext context, - int index) { - return Container( - child: Padding( - padding: - EdgeInsets.all(8.0), - child: InkWell( - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .start, - children: [ - Texts(model - .categoriseParent[ - index] - .name), - Divider( - thickness: 0.6, - color: Colors - .black12, - ) - ], + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: InkWell( + child: Container( + child: Texts( + 'View All Categories', + fontWeight: FontWeight.w300, + ), + ), + onTap: () { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return Container( + height: MediaQuery.of(context) + .size + .height * + 0.89, + color: Colors.white, + child: Center( + child: ListView.builder( + scrollDirection: + Axis.vertical, + itemCount: model + .categoriseParent + .length, + itemBuilder: + (BuildContext context, + int index) { + return Container( + child: Padding( + padding: + EdgeInsets.all( + 8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Texts(model + .categoriseParent[ + index] + .name), + Divider( + thickness: + 0.6, + color: Colors + .black12, + ) + ], + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + SubCategorisePage( + title: model.categoriseParent[index].name, + id: model.categoriseParent[index].id, + parentId: id, + )), + ); + }, + ), ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - SubCategorisePage( - title: - model.categoriseParent[index].name, - id: model.categoriseParent[index].id, - parentId: - id, - )), - ); - }, - ), - ), - ); - }), - ), + ); + }), + ), + ); + }, ); }, - ); - }, - ), + ), + ), + Icon(Icons.arrow_forward) + ], + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, ), - Icon(Icons.arrow_forward) ], ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - ], - ), //Expanded widget heree if nassery - Padding( - padding: EdgeInsets.only(top: 35.0), - child: Container( - height: MediaQuery.of(context).size.height * 0.2, - child: Center( - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: model.categoriseParent.length > 8 - ? 8 - : model.categoriseParent.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: - EdgeInsets.symmetric(horizontal: 8.0), - child: InkWell( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.symmetric( - horizontal: 13.0), - child: Container( - height: 60.0, - width: 65.0, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.orange.shade200 - .withOpacity(0.45), - ), - child: Center( - child: Icon( - Icons.apps_sharp, - size: 32.0, + Padding( + padding: EdgeInsets.only(top: 35.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.2, + child: Center( + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: model.categoriseParent.length > 8 + ? 8 + : model.categoriseParent.length, + itemBuilder: + (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric( + horizontal: 8.0), + child: InkWell( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.symmetric( + horizontal: 13.0), + child: Container( + height: 60.0, + width: 65.0, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors + .orange.shade200 + .withOpacity(0.45), + ), + child: Center( + child: Icon( + Icons.apps_sharp, + size: 32.0, + ), + ), ), ), - ), - ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.197, - height: MediaQuery.of(context) - .size - .height * - 0.08, - child: Center( - child: Texts( - projectViewModel.isArabic - ? model - .categoriseParent[index] - .namen - : model - .categoriseParent[index] - .name, - fontSize: 13.4, - fontWeight: FontWeight.w600, - maxLines: 3, + Container( + width: MediaQuery.of(context) + .size + .width * + 0.197, + height: MediaQuery.of(context) + .size + .height * + 0.08, + child: Center( + child: Texts( + projectViewModel.isArabic + ? model + .categoriseParent[ + index] + .namen + : model + .categoriseParent[ + index] + .name, + fontSize: 13.4, + fontWeight: FontWeight.w600, + maxLines: 3, + ), + ), ), - ), + ], ), - ], - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - SubCategorisePage( - title: model - .categoriseParent[index] - .name, - id: model - .categoriseParent[index] - .id, - parentId: id, - )), - ); - print(id); - }, - ), - ); - }), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + SubCategorisePage( + title: model + .categoriseParent[ + index] + .name, + id: model + .categoriseParent[ + index] + .id, + parentId: id, + )), + ); + print(id); + }, + ), + ); + }), + ), + ), ), - ), - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - child: Row( - children: [ - Icon( - Icons.wrap_text, - ), - SizedBox( - width: 10.0, - ), - Texts( - 'Refine', - fontWeight: FontWeight.w600, + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + child: Row( + children: [ + Icon( + Icons.wrap_text, + ), + SizedBox( + width: 10.0, + ), + Texts( + 'Refine', + fontWeight: FontWeight.w600, + ), + ], ), - ], - ), - onTap: () { - showModalBottomSheet( - isScrollControlled: true, - context: context, - builder: (BuildContext context) { - return DraggableScrollableSheet( - initialChildSize: 0.95, - maxChildSize: 0.95, - minChildSize: 0.9, - builder: (BuildContext context, - ScrollController scrollController) { - return SingleChildScrollView( - controller: scrollController, - child: Container( - height: MediaQuery.of(context) - .size - .height * - 1.95, - child: Column( - children: [ - Padding( - padding: - EdgeInsets.all(8.0), - child: Row( - children: [ - Icon( - Icons.wrap_text, - ), - SizedBox( - width: 10.0, - ), - Texts( - 'Refine', - fontWeight: - FontWeight.w600, - ), - SizedBox( - width: 250.0, - ), - InkWell( - child: Texts( - 'Close', - color: Colors.red, - fontWeight: - FontWeight.w600, - fontSize: 15.0, - ), - onTap: () { - Navigator.pop( - context); - }, - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - Column( + onTap: () { + showModalBottomSheet( + isScrollControlled: true, + context: context, + builder: (BuildContext context) { + return DraggableScrollableSheet( + initialChildSize: 0.95, + maxChildSize: 0.95, + minChildSize: 0.9, + builder: (BuildContext context, + ScrollController + scrollController) { + return SingleChildScrollView( + controller: scrollController, + child: Container( + height: MediaQuery.of(context) + .size + .height * + 1.95, + child: Column( children: [ - ExpansionTile( - title: - Texts('Categorise'), - children: [ - Container( - height: 350, - child: ListView - .builder( - controller: - scrollController, - scrollDirection: - Axis - .vertical, - shrinkWrap: - true, - itemCount: model - .categoriseParent - .length, - itemBuilder: - (BuildContext - context, - int index) { - return CheckboxListTile( - tristate: - true, - title: Texts(model - .categoriseParent[index] - .name), - controlAffinity: - ListTileControlAffinity.leading, - value: - checkedCategorise, - onChanged: - (bool - value) { - setState( - () { - checkedCategorise = - value; - }); - }, - ); - }), - ) - ], + Padding( + padding: + EdgeInsets.all(8.0), + child: Row( + children: [ + Icon( + Icons.wrap_text, + ), + SizedBox( + width: 10.0, + ), + Texts( + 'Refine', + fontWeight: + FontWeight + .w600, + ), + SizedBox( + width: 250.0, + ), + InkWell( + child: Texts( + 'Close', + color: + Colors.red, + fontWeight: + FontWeight + .w600, + fontSize: 15.0, + ), + onTap: () { + Navigator.pop( + context); + }, + ), + ], + ), ), Divider( thickness: 1.0, color: Colors.black12, ), - ExpansionTile( - title: Texts('Brands'), + Column( children: [ - Container( - height: 350, - child: ListView - .builder( - scrollDirection: - Axis - .vertical, - shrinkWrap: - true, - itemCount: model - .brandsList - .length, - itemBuilder: - (BuildContext - context, - int index) { - return CheckboxListTile( - tristate: + ExpansionTile( + title: Texts( + 'Categorise'), + children: [ + Container( + height: 350, + child: ListView + .builder( + controller: + scrollController, + scrollDirection: + Axis + .vertical, + shrinkWrap: true, - title: Texts(model - .brandsList[index] - .name), - controlAffinity: - ListTileControlAffinity.leading, - value: - checkedBrands, - onChanged: - (bool - value) { - setState( - () { - checkedBrands = - value; - }); - }, - autofocus: + itemCount: model + .categoriseParent + .length, + itemBuilder: + (BuildContext context, + int index) { + return CheckboxListTile( + tristate: + true, + title: + Texts(model.categoriseParent[index].name), + controlAffinity: + ListTileControlAffinity.leading, + value: + checkedCategorise, + onChanged: + (bool value) { + setState(() { + checkedCategorise = value; + }); + }, + ); + }), + ) + ], + ), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + ExpansionTile( + title: + Texts('Brands'), + children: [ + Container( + height: 350, + child: ListView + .builder( + scrollDirection: + Axis + .vertical, + shrinkWrap: true, - ); - }), - ) - ], - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - ExpansionTile( - title: Texts('Price'), - children: [ - Container( - color: Color( - 0xffEEEEEE), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceAround, - children: [ - Column( + itemCount: model + .brandsList + .length, + itemBuilder: + (BuildContext context, + int index) { + return CheckboxListTile( + tristate: + true, + title: + Texts(model.brandsList[index].name), + controlAffinity: + ListTileControlAffinity.leading, + value: + checkedBrands, + onChanged: + (bool value) { + setState(() { + checkedBrands = value; + }); + }, + autofocus: + true, + ); + }), + ) + ], + ), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + ExpansionTile( + title: + Texts('Price'), + children: [ + Container( + color: Color( + 0xffEEEEEE), + child: Row( mainAxisAlignment: MainAxisAlignment - .start, + .spaceAround, children: [ - Texts( - 'Min'), - Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Texts( + 'Min'), + Container( + color: + Colors.white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: OutlineInputBorder(), + ), + ), ), - ), + ], ), - ], - ), - Column( - mainAxisAlignment: - MainAxisAlignment - .start, - children: [ - Texts( - 'Max'), - Container( - color: Colors - .white, - width: - 200, - height: - 40, - child: - TextFormField( - decoration: - InputDecoration( - border: - OutlineInputBorder(), + Column( + mainAxisAlignment: + MainAxisAlignment + .start, + children: [ + Texts( + 'Max'), + Container( + color: + Colors.white, + width: + 200, + height: + 40, + child: + TextFormField( + decoration: + InputDecoration( + border: OutlineInputBorder(), + ), + ), ), - ), + ], ), ], ), + ) + ], + ), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + SizedBox( + height: MediaQuery.of( + context) + .size + .height * + 0.4, + ), + Padding( + padding: + EdgeInsets.all( + 8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceEvenly, + children: [ + Container( + width: 100, + child: Button( + label: + 'Reset', + backgroundColor: + Colors + .red, + ), + ), + SizedBox( + width: 30, + ), + Container( + width: 200, + child: Button( + label: + 'Apply', + backgroundColor: + Colors + .green, + ), + ), ], ), - ) + ), ], ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - SizedBox( - height: MediaQuery.of( - context) - .size - .height * - 0.4, - ), - Padding( - padding: - EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment - .spaceEvenly, - children: [ - Container( - width: 100, - child: Button( - label: 'Reset', - backgroundColor: + ], + ), + ), + ); + }); + }, + ); + }, + ), + Row( + children: [ + Container( + height: 44.0, + child: VerticalDivider( + color: Colors.black45, + thickness: 1.0, +//width: 0.3, +// indent: 0.0, + ), + ), + Padding( + padding: EdgeInsets.all(8.0), + child: InkWell( + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: Colors.blue, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: Colors.blue, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + styleOne == true + ? Container( + height: SizeConfig.screenHeight * 7.8, + child: GridView.builder( + physics: NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 0.5, + mainAxisSpacing: 2.0, + childAspectRatio: 0.9, + ), + itemCount: model.parentProducts.length, + itemBuilder: + (BuildContext context, int index) { + return NetworkBaseView( + baseViewModel: model, + child: Card( + color: model.parentProducts[index] + .discountName != + null + ? Color(0xffFFFF00) + : Colors.white, + elevation: 0, + shape: Border( + right: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + left: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + bottom: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + top: BorderSide( + color: Colors.grey.shade300, + width: 1, + ), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: + Radius.circular(110.0), + ), + color: Colors.white, + ), + padding: EdgeInsets.symmetric( + horizontal: 0), + width: MediaQuery.of(context) + .size + .width / + 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Stack( + children: [ + if (model + .parentProducts[ + index] + .discountName != + null) + RotatedBox( + quarterTurns: 4, + child: Container( + decoration: + BoxDecoration(), + child: Padding( + padding: + EdgeInsets + .only( + right: 5.0, + top: 20.0, + bottom: 5.0, + ), + child: Texts( + 'offer' + .toUpperCase(), + color: Colors.red, + fontSize: 13.0, + fontWeight: + FontWeight + .w900, ), ), - SizedBox( - width: 30, + transform: new Matrix4 + .rotationZ( + 5.837200), + ), + ), + Container( + margin: + EdgeInsets.fromLTRB( + 0, 16, 0, 0), + alignment: + Alignment.center, + child: Image.network( + model + .parentProducts[ + index] + .images + .isNotEmpty + ? model + .parentProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.cover, + height: 80, + ), + ), + Container( + width: model + .parentProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 + : 0, + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: + Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: Texts( + model + .parentProducts[ + index] + .rxMessage != + null + ? model + .parentProducts[ + index] + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ], + ), + Container( + margin: + EdgeInsets.symmetric( + horizontal: 6, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + if (model + .parentProducts[ + index] + .discountName != + null) + Container( + width: + double.infinity, + height: 13.0, + decoration: + BoxDecoration( + color: Color( + 0xff5AB145), ), - Container( - width: 200, - child: Button( - label: 'Apply', - backgroundColor: - Colors - .green, + child: Center( + child: Texts( + model + .parentProducts[ + index] + .discountName, + regular: true, + color: Colors + .white, + fontSize: 10.4, ), ), + ), + Texts( + model + .parentProducts[ + index] + .name, + regular: true, + fontSize: 12, + fontWeight: + FontWeight.w700, + ), + Padding( + padding: + const EdgeInsets + .only( + top: 4, + bottom: 4), + child: Texts( + "SAR ${model.parentProducts[index].price}", + bold: true, + fontSize: 14, + ), + ), + Row( + children: [ + StarRating( + totalAverage: model + .parentProducts[ + index] + .approvedRatingSum > + 0 + ? (model.parentProducts[index].approvedRatingSum.toDouble() / + model.parentProducts[index].approvedRatingSum + .toDouble()) + .toDouble() + : 0, + forceStars: + true), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: + FontWeight + .w400, + ) ], ), - ), - ], + ], + ), ), ], ), ), - ); - }); - }, - ); - }, - ), - Row( - children: [ - Container( - height: 44.0, - child: VerticalDivider( - color: Colors.black45, - thickness: 1.0, -//width: 0.3, -// indent: 0.0, - ), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: InkWell( - child: styleIcon, - onTap: () { - setState(() { - if (styleOne == true) { - styleOne = false; - styleTwo = true; - styleIcon = Icon( - Icons.auto_awesome_mosaic, - color: Colors.blue, - size: 29.0, - ); - } else { - styleOne = true; - styleTwo = false; - styleIcon = Icon( - Icons.widgets_sharp, - color: Colors.blue, - size: 29.0, - ); - } - }); + )); }, ), - ), - ], - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - styleOne == true - ? Container( - height: MediaQuery.of(context).size.height * 4.89, - child: GridView.builder( - physics: NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 0.5, - mainAxisSpacing: 2.0, - childAspectRatio: 0.9, - ), - itemCount: model.parentProducts.length, - itemBuilder: (BuildContext context, int index) { - return NetworkBaseView( - baseViewModel: model, - child: Card( - color: model.parentProducts[index] - .discountName != - null - ? Color(0xffFFFF00) - : Colors.white, - elevation: 0, - shape: Border( - right: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - left: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - bottom: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - top: BorderSide( - color: Colors.grey.shade300, - width: 1, - ), - ), - margin: EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(110.0), - ), - color: Colors.white, - ), - padding: EdgeInsets.symmetric( - horizontal: 0), - width: MediaQuery.of(context) - .size - .width / - 3, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + ) + : Container( + height: + MediaQuery.of(context).size.height * 5.0, + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + itemCount: model.parentProducts.length, + itemBuilder: + (BuildContext context, int index) { + return Card( + child: Row( children: [ Stack( children: [ - if (model - .parentProducts[index] - .discountName != - null) - RotatedBox( - quarterTurns: 4, - child: Container( + Column( + children: [ + Container( decoration: BoxDecoration(), child: Padding( padding: EdgeInsets.only( - right: 5.0, - top: 20.0, - bottom: 5.0, - ), - child: Texts( - 'offer' - .toUpperCase(), - color: Colors.red, - fontSize: 13.0, - fontWeight: - FontWeight.w900, + left: 9.0, + top: 8.0, + right: 10.0, ), ), - transform: new Matrix4 - .rotationZ( - 5.837200), ), - ), - Container( - margin: EdgeInsets.fromLTRB( - 0, 16, 0, 0), - alignment: Alignment.center, - child: Image.network( - model - .parentProducts[ - index] - .images - .isNotEmpty - ? model - .parentProducts[ - index] - .images[0] - .thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.cover, - height: 80, - ), + Container( + margin: + EdgeInsets.fromLTRB( + 0, 0, 0, 0), + alignment: + Alignment.center, + child: Image.network( + model + .parentProducts[ + index] + .images + .isNotEmpty + ? model + .parentProducts[ + index] + .images[0] + .thumb + : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', + fit: BoxFit.contain, + height: 80, + ), + ), + ], ), - Container( - width: model - .parentProducts[ - index] - .rxMessage != - null - ? MediaQuery.of(context) - .size - .width / - 5 - : 0, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Color(0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular(6)), - ), - child: Texts( - model + Column( + children: [ + Container( + width: model + .parentProducts[ + index] + .rxMessage != + null + ? MediaQuery.of( + context) + .size + .width / + 5 + : 0, + padding: + EdgeInsets.all(4), + decoration: + BoxDecoration( + color: + Color(0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: Radius + .circular( + 6)), + ), + child: Texts( + model + .parentProducts[ + index] + .rxMessage != + null + ? model .parentProducts[ index] - .rxMessage != - null - ? model - .parentProducts[ - index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ), + .rxMessage + : "", + color: Colors.white, + regular: true, + fontSize: 10, + fontWeight: + FontWeight.w400, + ), + ), + ], ), ], ), Container( + height: 100.0, margin: EdgeInsets.symmetric( horizontal: 6, vertical: 0, ), child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (model - .parentProducts[ - index] - .discountName != - null) - Container( - width: double.infinity, - height: 13.0, - decoration: - BoxDecoration( - color: - Color(0xff5AB145), - ), - child: Center( - child: Texts( - model - .parentProducts[ - index] - .discountName, - regular: true, - color: Colors.white, - fontSize: 10.4, - ), - ), - ), + SizedBox( + height: 4.0, + ), Texts( model .parentProducts[index] .name, regular: true, - fontSize: 12, + fontSize: 13.2, fontWeight: - FontWeight.w700, + FontWeight.w500, + maxLines: 5, + ), + SizedBox( + height: 8.0, ), Padding( padding: @@ -855,176 +1060,13 @@ class _ParentCategorisePageState extends State { ), ], ), - ), - )); - }, - ), - ) - : Container( - height: MediaQuery.of(context).size.height * 5.0, - child: ListView.builder( - physics: NeverScrollableScrollPhysics(), - itemCount: model.parentProducts.length, - itemBuilder: - (BuildContext context, int index) { - return Card( - child: Row( - children: [ - Stack( - children: [ - Column( - children: [ - Container( - decoration: BoxDecoration(), - child: Padding( - padding: EdgeInsets.only( - left: 9.0, - top: 8.0, - right: 10.0, - ), - ), - ), - Container( - margin: EdgeInsets.fromLTRB( - 0, 0, 0, 0), - alignment: Alignment.center, - child: Image.network( - model - .parentProducts[ - index] - .images - .isNotEmpty - ? model - .parentProducts[ - index] - .images[0] - .thumb - : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', - fit: BoxFit.contain, - height: 80, - ), - ), - ], - ), - Column( - children: [ - Container( - width: model - .parentProducts[ - index] - .rxMessage != - null - ? MediaQuery.of(context) - .size - .width / - 5 - : 0, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Color(0xffb23838), - borderRadius: - BorderRadius.only( - topLeft: Radius - .circular(6)), - ), - child: Texts( - model - .parentProducts[ - index] - .rxMessage != - null - ? model - .parentProducts[ - index] - .rxMessage - : "", - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ), - ), - ], - ), - ], - ), - Container( - height: 100.0, - margin: EdgeInsets.symmetric( - horizontal: 6, - vertical: 0, - ), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceAround, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 4.0, - ), - Texts( - model.parentProducts[index] - .name, - regular: true, - fontSize: 13.2, - fontWeight: FontWeight.w500, - maxLines: 5, - ), - SizedBox( - height: 8.0, - ), - Padding( - padding: - const EdgeInsets.only( - top: 4, bottom: 4), - child: Texts( - "SAR ${model.parentProducts[index].price}", - bold: true, - fontSize: 14, - ), - ), - Row( - children: [ - StarRating( - totalAverage: model - .parentProducts[ - index] - .approvedRatingSum > - 0 - ? (model - .parentProducts[ - index] - .approvedRatingSum - .toDouble() / - model - .parentProducts[ - index] - .approvedRatingSum - .toDouble()) - .toDouble() - : 0, - forceStars: true), - Texts( - "(${model.parentProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: - FontWeight.w400, - ) - ], - ), - ], - ), - ), - ], - ), - ); - }), - ) - ], - ), + ); + }), + ) + ], + ), + ), + ], ), ), ));