From 727940c5c687360eb3b01e1a75a0225667310ca7 Mon Sep 17 00:00:00 2001 From: enadhilal Date: Tue, 8 Dec 2020 10:18:48 +0300 Subject: [PATCH] fixed merging issues --- lib/widgets/others/app_scaffold_widget.dart | 229 ++++------ lib/widgets/pharmacy/product_tile.dart | 476 ++++++++++---------- 2 files changed, 346 insertions(+), 359 deletions(-) diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 7d0d60f8..4b588453 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -37,7 +37,6 @@ class AppScaffold extends StatelessWidget { final bool isBottomBar; final Widget floatingActionButton; final bool isPharmacy; - final bool showCart; final String title; final String description; final String image; @@ -49,29 +48,28 @@ class AppScaffold extends StatelessWidget { final PreferredSizeWidget appBarWidget; AuthenticatedUserObject authenticatedUserObject = - locator(); + locator(); AppScaffold( {@required this.body, - this.appBarTitle = '', - this.isLoading = false, - this.isShowAppBar = false, - this.hasAppBarParam, - this.bottomSheet, - this.baseViewModel, - this.floatingActionButton, - this.isPharmacy = false, - this.showCart = false, - this.title, - this.description, - this.isShowDecPage = true, - this.isBottomBar, - this.backgroundColor, - this.preferredSize = 0.0, - this.appBarIcons, - this.appBarWidget, - this.image, - this.infoList}); + this.appBarTitle = '', + this.isLoading = false, + this.isShowAppBar = false, + this.hasAppBarParam, + this.bottomSheet, + this.baseViewModel, + this.floatingActionButton, + this.isPharmacy = false, + this.title, + this.description, + this.isShowDecPage = true, + this.isBottomBar, + this.backgroundColor, + this.preferredSize = 0.0, + this.appBarIcons, + this.appBarWidget, + this.image, + this.infoList}); @override Widget build(BuildContext context) { @@ -90,58 +88,29 @@ class AppScaffold extends StatelessWidget { appBar = preferredSize == 0 ? appBarWidget : PreferredSize( - child: appBarWidget, - preferredSize: Size.fromHeight(preferredSize)); + child: appBarWidget, + preferredSize: Size.fromHeight(preferredSize)); } else { appBar = this.appBarWidget; } return Scaffold( - backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, - appBar: isShowAppBar - ? AppBar( - elevation: 0, - backgroundColor: isPharmacy - ? Colors.green - : Theme.of(context).appBarTheme.color, - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Text(authenticatedUserObject.isLogin - ? appBarTitle.toUpperCase() - : TranslationBase.of(context).serviceInformationTitle),leading: Builder( - builder: (BuildContext context) { - return ArrowBack(); - }, - ), - centerTitle: true, - actions: [ - isPharmacy && showCart - ? IconButton( - icon: Icon(Icons.shopping_cart), - color: Colors.white, - onPressed: () { - Navigator.of(context) - .popUntil(ModalRoute.withName('/')); - }, - ) - : isPharmacy && !showCart ? Container() :IconButton( - icon: Icon(FontAwesomeIcons.home), - color: Colors.white, - onPressed: () { - Navigator.of(context) - .popUntil(ModalRoute.withName('/')); - }, - ), - ], - ) + backgroundColor: + backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, + appBar: appBar, + body: (!Provider.of(context, listen: false).isLogin && + isShowDecPage) + ? NotAutPage( + title: appBarTitle, + description: description, + infoList: infoList, + ) : baseViewModel != null - ? NetworkBaseView( - child: buildBodyWidget(), - baseViewModel: baseViewModel, - ) - : buildBodyWidget(), + ? NetworkBaseView( + child: buildBodyWidget(), + baseViewModel: baseViewModel, + ) + : buildBodyWidget(), bottomSheet: bottomSheet, //floatingActionButton: floatingActionButton ?? floatingActionButton, // bottomNavigationBar: @@ -164,7 +133,7 @@ class AppScaffold extends StatelessWidget { class AppBarWidget extends StatelessWidget with PreferredSizeWidget { final AuthenticatedUserObject authenticatedUserObject = - locator(); + locator(); final String appBarTitle; final List appBarIcons; @@ -184,72 +153,72 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { Widget buildAppBar(BuildContext context) { return isShowAppBar ? AppBar( - elevation: 0, - backgroundColor: - isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + elevation: 0, + backgroundColor: + isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, + textTheme: TextTheme( + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Texts( + authenticatedUserObject.isLogin || !isShowDecPage + ? appBarTitle.toUpperCase() + : TranslationBase.of(context).serviceInformationTitle, + color: Colors.white, + bold: true, + ), + leading: Builder( + builder: (BuildContext context) { + return ArrowBack(); + }, + ), + centerTitle: true, + actions: [ + isPharmacy + ? IconButton( + icon: Icon(Icons.shopping_cart), + color: Colors.white, + onPressed: () { + Navigator.of(context) + .popUntil(ModalRoute.withName('/')); + }) + : Container(), + image != null + ? InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: InsuranceUpdate(), ), - title: Texts( - authenticatedUserObject.isLogin || !isShowDecPage - ? appBarTitle.toUpperCase() - : TranslationBase.of(context).serviceInformationTitle, + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Image.asset( + image, + height: SizeConfig.heightMultiplier * 5, + width: SizeConfig.heightMultiplier * 5, color: Colors.white, - bold: true, ), - leading: Builder( - builder: (BuildContext context) { - return ArrowBack(); - }, - ), - centerTitle: true, - actions: [ - isPharmacy - ? IconButton( - icon: Icon(Icons.shopping_cart), - color: Colors.white, - onPressed: () { - Navigator.of(context) - .popUntil(ModalRoute.withName('/')); - }) - : Container(), - image != null - ? InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: InsuranceUpdate(), - ), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - image, - height: SizeConfig.heightMultiplier * 5, - width: SizeConfig.heightMultiplier * 5, - color: Colors.white, - ), - ), - ) - : IconButton( - icon: Icon(FontAwesomeIcons.home), - color: Colors.white, - onPressed: () { - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute( - builder: (context) => LandingPage()), - (Route r) => false); - }, - ), - if (appBarIcons != null) ...appBarIcons - ], - ) + ), + ) + : IconButton( + icon: Icon(FontAwesomeIcons.home), + color: Colors.white, + onPressed: () { + Navigator.pushAndRemoveUntil( + context, + MaterialPageRoute( + builder: (context) => LandingPage()), + (Route r) => false); + }, + ), + if (appBarIcons != null) ...appBarIcons + ], + ) : Container( - height: 0, - width: 0, - ); + height: 0, + width: 0, + ); } @override diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index 78b89ef0..725966d5 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -6,9 +6,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:rating_bar/rating_bar.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; - - - class productTile extends StatelessWidget { final String productName; final String productPrice; @@ -16,14 +13,20 @@ class productTile extends StatelessWidget { final int productReviews; final String qyt; final String totalPrice; - final bool isOrderDetails; - final String productImage; - final bool showLine; - + final bool isOrderDetails; + final String productImage; + final bool showLine; - productTile({this.productName, this.productPrice, this.productRate, - this.qyt, this.totalPrice, this.productReviews, - this.isOrderDetails=true, this.productImage ,this.showLine = true}); + productTile( + {this.productName, + this.productPrice, + this.productRate, + this.qyt, + this.totalPrice, + this.productReviews, + this.isOrderDetails = true, + this.productImage, + this.showLine = true}); @override Widget build(BuildContext context) { @@ -63,8 +66,7 @@ class productTile extends StatelessWidget { alignment: Alignment.topLeft, child: RichText( text: TextSpan( - text: - productName, + text: productName, style: TextStyle( color: Colors.black54, fontSize: 15, @@ -88,251 +90,267 @@ class productTile extends StatelessWidget { ), ), ), - this.isOrderDetails == false ? Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RatingBar.readOnly( - initialRating: productRate, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ), - ): Container(), + this.isOrderDetails == false + ? Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: productRate, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ) + : Container(), ], ), ), - this.isOrderDetails == false ? Expanded( - flex: 1, - child: Column ( - children: [ - Icon(FontAwesomeIcons.trashAlt, size: 15), - SizedBox(height: 50,), - Icon(FontAwesomeIcons.shoppingCart, size: 15), - ], - ), - ) : Container(), + this.isOrderDetails == false + ? Expanded( + flex: 1, + child: Column( + children: [ + Icon(FontAwesomeIcons.trashAlt, size: 15), + SizedBox( + height: 50, + ), + Icon(FontAwesomeIcons.shoppingCart, size: 15), + ], + ), + ) + : Container(), ], ), - this.isOrderDetails == true ?Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Container( - margin: EdgeInsets.only(bottom: 5.0), - child: RichText( - text: TextSpan( - text: 'QYT: $qyt', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 13), - ), - ), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text( - TranslationBase.of(context).total, - style: TextStyle( - color: Colors.grey, - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - RichText( + this.isOrderDetails == true + ? Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + margin: EdgeInsets.only(bottom: 5.0), + child: RichText( text: TextSpan( - text: ' $totalPrice SAR', + text: 'QYT: $qyt', style: TextStyle( fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 15), + color: Colors.grey, + fontSize: 13), ), ), - ], - ), - ], - ), - ], - ), - ): Container(), -// this.isOrderDetails == true && model.order[0].orderStatusId == 30? - this.isOrderDetails == true? - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Container( -// margin: EdgeInsets.all(5.0), - child: Align( - alignment: Alignment.topLeft, - child: RatingBar.readOnly( - initialRating: productRate, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ), - ), - Container( -// margin: EdgeInsets.all(5), - child: Align( -// alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: '($productReviews reviews)', - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.grey, - fontSize: 13), - ), - ), - ), - ), - InkWell( - onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) => ProductReviewPage())); - }, - child: Container( - padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), - height: 30.0, - decoration: BoxDecoration( - border: Border.all( - color: Colors.orange, - style: BorderStyle.solid, - width: 1.0 ), - color: Colors.transparent, - borderRadius: BorderRadius.circular(5.0) - ), - child: Text( - TranslationBase.of(context).writeReview, - style: TextStyle( - fontSize:12, - color: Colors.orange, - ), - ), - ), - ), - ], - ), - ) : Container(), - ], - ), - ): - Container( - child: Padding( - padding: EdgeInsets.all(8.0), - child: Row( - children: [ - Padding( - padding: EdgeInsets.only(left:15), - child: Container( - width: 160, - height: 200, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - border: Border( - top: BorderSide(width: 0.5, color: Colors.grey), - left: BorderSide(width: 0.5, color: Colors.grey), - right: BorderSide(width: 0.5, color: Colors.grey), - bottom: BorderSide(width: 0.5, color: Colors.grey), - ), - color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox(height: 2,), - Container( - child: Image.network( - productImage.trim(), - fit: BoxFit.cover, - width: 80, - height: 70, - ), - ), - SizedBox(height: 10,), -// Container(width: 150,height: 20,color: Colors.green,), - Container( - alignment: Alignment.centerLeft, - child:Column( + Column( + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: TextSpan( - text: - productName, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + TranslationBase.of(context).total, + style: TextStyle( + color: Colors.grey, + fontSize: 13.0, + fontWeight: FontWeight.bold, ), ), - ), + ], ), - Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + RichText( text: TextSpan( - text: 'SAR $productPrice', + text: ' $totalPrice SAR', style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, - fontSize: 13), + fontSize: 15), ), ), + ], + ), + ], + ), + ], + ), + ) + : Container(), +// this.isOrderDetails == true && model.order[0].orderStatusId == 30? + this.isOrderDetails == true + ? Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( +// margin: EdgeInsets.all(5.0), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: productRate, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + Container( +// margin: EdgeInsets.all(5), + child: Align( +// alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: '($productReviews reviews)', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.grey, + fontSize: 13), ), ), - Container( - alignment: Alignment.topLeft, - margin: EdgeInsets.all(5), - child: Align( - child: RatingBar.readOnly( - initialRating: productRate, - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), + ), + ), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ProductReviewPage())); + }, + child: Container( + padding: EdgeInsets.only( + left: 13.0, right: 13.0, top: 5.0), + height: 30.0, + decoration: BoxDecoration( + border: Border.all( + color: Colors.orange, + style: BorderStyle.solid, + width: 1.0), + color: Colors.transparent, + borderRadius: BorderRadius.circular(5.0)), + child: Text( + TranslationBase.of(context).writeReview, + style: TextStyle( + fontSize: 12, + color: Colors.orange, ), ), - ], + ), ), + ], + ), + ) + : Container( + child: Padding( + padding: EdgeInsets.all(8.0), + child: Row( + children: [ + Padding( + padding: EdgeInsets.only(left: 15), + child: Container( + width: 160, + height: 200, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + border: Border( + top: BorderSide( + width: 0.5, color: Colors.grey), + left: BorderSide( + width: 0.5, color: Colors.grey), + right: BorderSide( + width: 0.5, color: Colors.grey), + bottom: BorderSide( + width: 0.5, color: Colors.grey), + ), + color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Container( + child: Image.network( + productImage.trim(), + fit: BoxFit.cover, + width: 80, + height: 70, + ), + ), + SizedBox( + height: 10, + ), +// Container(width: 150,height: 20,color: Colors.green,), + Container( + alignment: Alignment.centerLeft, + child: Column( + children: [ + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: productName, + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), + ), + ), + ), + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: 'SAR $productPrice', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ), + ), + ), + ), + Container( + alignment: Alignment.topLeft, + margin: EdgeInsets.all(5), + child: Align( + child: RatingBar.readOnly( + initialRating: productRate, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + ], + ), + ), + ], + ), + ), + ), + ], ), - ], + ), ), - ), - ), - ], - ), + ], ), ); }