From 3c971223088b7cc91eb2167a238b4301b1248f89 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 25 Nov 2021 09:41:23 +0200 Subject: [PATCH 01/39] pharmacy home dsign --- lib/pages/landing/landing_page_pharmcy.dart | 7 +- .../screens/pharmacy_module_page.dart | 2 +- .../pharmacies/widgets/ProductTileItem.dart | 369 +++++++++--------- .../widgets/home/BestSellerWidget.dart | 2 +- .../widgets/home/MostViewedWidget.dart | 7 +- .../widgets/home/RecentlyViewedWidget.dart | 2 +- .../widgets/home/ViewAllHomeWidget.dart | 3 +- 7 files changed, 205 insertions(+), 187 deletions(-) diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index c90a317a..05c20dd8 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -90,7 +90,9 @@ class _LandingPagePharmacyState extends State { try { String barcode = result; GifLoaderDialogUtils.showMyDialog(context); - await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", onSuccess: (dynamic response, int statusCode) { + await BaseAppClient() + .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", + onSuccess: (dynamic response, int statusCode) { print(response); var product = PharmacyProduct.fromJson(response["products"][0]); GifLoaderDialogUtils.hideDialog(context); @@ -100,7 +102,8 @@ class _LandingPagePharmacyState extends State { AppToast.showErrorToast(message: "Product not found"); }); } catch (apiEx) { - AppToast.showErrorToast(message: "Something went wrong, please try again"); + AppToast.showErrorToast( + message: "Something went wrong, please try again"); } } catch (barcodeEx) {} } diff --git a/lib/pages/pharmacies/screens/pharmacy_module_page.dart b/lib/pages/pharmacies/screens/pharmacy_module_page.dart index 1f90f454..8f500064 100644 --- a/lib/pages/pharmacies/screens/pharmacy_module_page.dart +++ b/lib/pages/pharmacies/screens/pharmacy_module_page.dart @@ -48,7 +48,7 @@ class _PharmacyPageState extends State { isMainPharmacyPages: true, isPharmacy: true, isShowPharmacyAppbar: true, - backgroundColor: Colors.white, + backgroundColor: Color(0xffFEFEFE), body: Container( width: double.infinity, child: SingleChildScrollView( diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index fcdb0ad6..f16aca03 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -77,202 +77,210 @@ class ProductTileItem extends StatelessWidget { @override Widget build(BuildContext context) { ProjectViewModel projectProvider = Provider.of(context); - return InkWell( - onTap: () => productOnClick(context), - splashColor: Theme.of(context).primaryColor, - child: Container( - margin: EdgeInsets.all(7), - decoration: BoxDecoration( - border: Border.all(color: Colors.grey.shade300, width: 0.5), - borderRadius: BorderRadius.circular(8)), - padding: EdgeInsets.symmetric(horizontal: 4), - width: MediaQuery.of(context).size.width / 2.8, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Stack( - // children: [ - // Container( - // margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - // alignment: Alignment.center, - // child: (item.images != null && item.images.length > 0) - // ? Image.network( - // item.images[0].src, - // fit: BoxFit.cover, - // height: itemHeight / 2, - // ) - // : Image.asset( - // "assets/images/no_image.png", - // fit: BoxFit.cover, - // height: itemHeight / 2, - // ), - // ), - // ], - // ), + return Container( + margin: EdgeInsets.all(7), + decoration: BoxDecoration( + border: Border.all(color: Colors.grey.shade300, width: 0.2), + borderRadius: BorderRadius.circular(10), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0xffF1F1F1), + spreadRadius: 4, + blurRadius: 5.5, + offset: Offset(0, 3), // changes position of shadow + ), + ], + ), + padding: EdgeInsets.symmetric(horizontal: 4), + width: MediaQuery.of(context).size.width / 2.8, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Stack( + // children: [ + // Container( + // margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + // alignment: Alignment.center, + // child: (item.images != null && item.images.length > 0) + // ? Image.network( + // item.images[0].src, + // fit: BoxFit.cover, + // height: itemHeight / 2, + // ) + // : Image.asset( + // "assets/images/no_image.png", + // fit: BoxFit.cover, + // height: itemHeight / 2, + // ), + // ), + // ], + // ), - Container( + Container( + width: double.infinity, + height: MediaQuery.of(context).size.width * 0.3, + padding: EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 7), + color: Colors.white, + child: Container( width: double.infinity, - height: MediaQuery.of(context).size.width * 0.3, - padding: - EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14), - color: Colors.white, - child: InkWell( - onTap: () {}, - child: Container( - width: double.infinity, - height: double.infinity, - clipBehavior: Clip.antiAlias, - decoration: containerRadiusWithGradientServices(33, - lightColor: Colors.transparent, - darkColor: Colors.transparent), - child: Stack( - children: [ - Container( - width: double.infinity, - height: double.infinity, - //clipBehavior: Clip.antiAlias, - // decoration: projectProvider.isArabic - // ? containerBottomRightRadiusWithGradientForAr(0, lightColor: Colors.transparent, darkColor: Colors.transparent) - // : containerBottomRightRadiusWithGradient(0, lightColor: Colors.red, darkColor: CustomColors.green), - child: Stack( - children: [ - Container( - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - alignment: Alignment.center, - child: (item.images != null && - item.images.length > 0) - ? Image.network( - item.images[0].src, - fit: BoxFit.cover, - height: itemHeight / 2, - ) - : Image.asset( - "assets/images/no_image.png", - fit: BoxFit.cover, - height: itemHeight / 2, - ), + height: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: containerRadiusWithGradientServices(0, + lightColor: Colors.transparent, + darkColor: Colors.transparent), + child: Stack( + children: [ + Container( + width: double.infinity, + height: double.infinity, + //clipBehavior: Clip.antiAlias, + // decoration: projectProvider.isArabic + // ? containerBottomRightRadiusWithGradientForAr(0, lightColor: Colors.transparent, darkColor: Colors.transparent) + // : containerBottomRightRadiusWithGradient(0, lightColor: Colors.red, darkColor: CustomColors.green), + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade300, width: 1.1), + borderRadius: BorderRadius.only( + topRight: Radius.circular( + item.rxMessage != null && + projectProvider.isArabic + ? 20 + : 8), + bottomLeft: Radius.circular(8), + bottomRight: Radius.circular(8), + topLeft: Radius.circular(item.rxMessage != null && + !projectProvider.isArabic + ? 25 + : 8), ), - ], + ), + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + alignment: Alignment.center, + child: (item.images != null && item.images.length > 0) + ? Padding( + padding: EdgeInsets.all(12.0), + child: Image.network( + item.images[0].src, + fit: BoxFit.cover, + height: itemHeight / 2, + ), + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: itemHeight / 2, + ), ), - ), - if (item.rxMessage != null) - projectProvider.isArabic - ? Positioned( - right: -16, - top: 2, - child: Transform.rotate( - angle: math.pi / 4, - child: Container( - padding: EdgeInsets.only( - left: 18, right: 18, top: 6, bottom: 3), - color: CustomColors.accentColor, - child: Padding( - padding: EdgeInsets.all(2.0), - child: Text( - "الوصفة\n مطلوبة", - style: TextStyle( - color: Colors.white, - fontSize: 7.5, - height: 0.8, - fontWeight: FontWeight.bold, - letterSpacing: -0.27, - ), - ), + ], + ), + ), + if (item.rxMessage != null) + projectProvider.isArabic + ? Positioned( + right: -16, + top: 2, + child: Transform.rotate( + angle: math.pi / 4, + child: Container( + padding: EdgeInsets.only( + left: 18, right: 18, top: 6, bottom: 3), + color: CustomColors.accentColor, + child: Padding( + padding: EdgeInsets.all(2.0), + child: Text( + "الوصفة\n مطلوبة", + style: TextStyle( + color: Colors.white, + fontSize: 7.5, + height: 0.8, + fontWeight: FontWeight.bold, + letterSpacing: -0.27, ), ), ), - ) - : Positioned( - left: -24, - top: 2, - child: Transform.rotate( - angle: -math.pi / 4, - child: Container( - padding: EdgeInsets.only( - left: 18, right: 18, top: 6, bottom: 3), - color: CustomColors.accentColor, - child: Text( - "\n E-Prescription \n Is required", - style: TextStyle( - color: Colors.white, - fontSize: 7.5, - //letterSpacing: -0.27, - height: 1.2, - fontWeight: FontWeight.w600, - ), - ), + ), + ), + ) + : Positioned( + left: -24, + top: 2, + child: Transform.rotate( + angle: -math.pi / 4, + child: Container( + padding: EdgeInsets.only( + left: 18, right: 18, top: 6, bottom: 3), + color: CustomColors.accentColor, + child: Text( + "\n E-Prescription \n Is required", + style: TextStyle( + color: Colors.white, + fontSize: 7.5, + //letterSpacing: -0.27, + height: 1.2, + fontWeight: FontWeight.w600, ), ), ), - ], - ), - ), + ), + ), + ], ), ), - - // Padding( - // padding: EdgeInsets.fromLTRB(1, 1, 1, 1), - // child: Container( - // width: item.rxMessage != null - // ? MediaQuery.of(context).size.width / 1.0 - // : 0, - // padding: EdgeInsets.fromLTRB(8, 2, 8, 2), - // decoration: BoxDecoration( - // color: Color(0xffb23838), - // ), - // child: item.rxMessage != null - // ? Texts( - // projectProvider.isArabic - // ? item.rxMessagen - // : item.rxMessage, - // color: Colors.white, - // regular: true, - // fontSize: 10, - // fontWeight: FontWeight.w400, - // ) - // : Texts(""), - // ), - // ), - // SizedBox(height: 4,), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 4.0), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.075, child: Texts( projectProvider.isArabic ? item.namen : item.name, - regular: true, - fontSize: 12, - fontWeight: FontWeight.w400, + //regular: true, + fontSize: 10, + color: Color(0xff2B353E), + fontWeight: FontWeight.w500, ), ), - Expanded( - child: Container( - margin: EdgeInsets.symmetric( - horizontal: 4, - vertical: 0, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Padding( - padding: const EdgeInsets.only(top: 2, bottom: 2), - child: Texts( - "SAR ${item.price}", - fontWeight: FontWeight.w600, - fontSize: 14, - ), + ), + SizedBox( + height: 7.0, + ), + Expanded( + child: Container( + margin: EdgeInsets.symmetric( + horizontal: 4, + vertical: 0, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.end, + children: [ + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 10, vertical: 2), + child: Texts( + "SAR ${item.price}", + fontWeight: FontWeight.bold, + fontSize: 11, + color: Color(0xff2B353E), ), - Row( + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 5), + child: Row( children: [ // Expanded( RatingBar.readOnly( initialRating: item.approvedRatingSum.toDouble(), size: 15.0, - filledColor: Color(0xffD02127), - emptyColor: Colors.grey[500], + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), isHalfAllowed: true, halfFilledIcon: Icons.star_half, filledIcon: Icons.star, - emptyIcon: Icons.star, + emptyIcon: Icons.star_border, ), Texts( "(${item.approvedTotalReviews})", @@ -282,11 +290,12 @@ class ProductTileItem extends StatelessWidget { ), SizedBox( - width: 20.0, + width: 10.0, ), Icon( Icons.arrow_forward, - size: 18, + size: 15, + color: Color(0xff2D2F39), ), // StarRating( @@ -299,15 +308,15 @@ class ProductTileItem extends StatelessWidget { // ), ], ), - ], - ), + ), + ], ), ), - SizedBox( - height: 5, - ), - ], - ), + ), + SizedBox( + height: 1, + ), + ], ), ); } diff --git a/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart b/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart index 780adba9..2fcab506 100644 --- a/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart +++ b/lib/pages/pharmacies/widgets/home/BestSellerWidget.dart @@ -29,7 +29,7 @@ class BestSellerWidget extends StatelessWidget { )), if (model.state != ViewState.BusyLocal) Container( - height: MediaQuery.of(context).size.height / 3 + 20, + height: MediaQuery.of(context).size.height / 3 + 1, child: ListView.builder( itemBuilder: (ctx, i) => ProductTileItem( model.bestSellerProduct[i], diff --git a/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart b/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart index de34863d..a1ce0bc4 100644 --- a/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart +++ b/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart @@ -31,7 +31,12 @@ class MostViewedWidget extends StatelessWidget { )), if (model.state != ViewState.BusyLocal) Container( - height: MediaQuery.of(context).size.height / 3 + 20, + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade300, width: 0.1), + borderRadius: BorderRadius.circular(8), + ), + height: MediaQuery.of(context).size.height / 3 + 1, child: ListView.builder( itemBuilder: (ctx, i) => ProductTileItem( model.mostViewedProducts[i], diff --git a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart index 3c2cb710..f03c384d 100644 --- a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart +++ b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart @@ -31,7 +31,7 @@ class RecentlyViewedWidget extends StatelessWidget { if (model.state != ViewState.BusyLocal) Container( height: model.lastVisitedProducts.length > 0 - ? MediaQuery.of(context).size.height / 3 + 20 + ? MediaQuery.of(context).size.height / 3 + 1 : 0, child: ListView.builder( itemBuilder: (ctx, i) => ProductTileItem( diff --git a/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart index 1289e733..9d56deff 100644 --- a/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart +++ b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart @@ -18,8 +18,9 @@ class ViewAllHomeWidget extends StatelessWidget { children: [ Texts( title, + color: Color(0xff2E303A), bold: true, - fontSize: 16, + fontSize: 19, ), InkWell( onTap: () { From 1984400239e9ff02309dd6006f17dd4c7d1e59be Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 25 Nov 2021 11:15:05 +0200 Subject: [PATCH 02/39] fix ontap on prodcut card --- .../pharmacies/widgets/ProductTileItem.dart | 421 +++++++++--------- 1 file changed, 213 insertions(+), 208 deletions(-) diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index f16aca03..248901b6 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -77,226 +77,230 @@ class ProductTileItem extends StatelessWidget { @override Widget build(BuildContext context) { ProjectViewModel projectProvider = Provider.of(context); - return Container( - margin: EdgeInsets.all(7), - decoration: BoxDecoration( - border: Border.all(color: Colors.grey.shade300, width: 0.2), - borderRadius: BorderRadius.circular(10), - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Color(0xffF1F1F1), - spreadRadius: 4, - blurRadius: 5.5, - offset: Offset(0, 3), // changes position of shadow - ), - ], - ), - padding: EdgeInsets.symmetric(horizontal: 4), - width: MediaQuery.of(context).size.width / 2.8, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - // Stack( - // children: [ - // Container( - // margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - // alignment: Alignment.center, - // child: (item.images != null && item.images.length > 0) - // ? Image.network( - // item.images[0].src, - // fit: BoxFit.cover, - // height: itemHeight / 2, - // ) - // : Image.asset( - // "assets/images/no_image.png", - // fit: BoxFit.cover, - // height: itemHeight / 2, - // ), - // ), - // ], - // ), + return InkWell( + onTap: () => productOnClick(context), + child: Container( + margin: EdgeInsets.all(7), + decoration: BoxDecoration( + border: Border.all(color: Colors.grey.shade300, width: 0.2), + borderRadius: BorderRadius.circular(10), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Color(0xffF1F1F1), + spreadRadius: 4, + blurRadius: 5.5, + offset: Offset(0, 3), // changes position of shadow + ), + ], + ), + padding: EdgeInsets.symmetric(horizontal: 4), + width: MediaQuery.of(context).size.width / 2.8, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Stack( + // children: [ + // Container( + // margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + // alignment: Alignment.center, + // child: (item.images != null && item.images.length > 0) + // ? Image.network( + // item.images[0].src, + // fit: BoxFit.cover, + // height: itemHeight / 2, + // ) + // : Image.asset( + // "assets/images/no_image.png", + // fit: BoxFit.cover, + // height: itemHeight / 2, + // ), + // ), + // ], + // ), - Container( - width: double.infinity, - height: MediaQuery.of(context).size.width * 0.3, - padding: EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 7), - color: Colors.white, - child: Container( + Container( width: double.infinity, - height: double.infinity, - clipBehavior: Clip.antiAlias, - decoration: containerRadiusWithGradientServices(0, - lightColor: Colors.transparent, - darkColor: Colors.transparent), - child: Stack( - children: [ - Container( - width: double.infinity, - height: double.infinity, - //clipBehavior: Clip.antiAlias, - // decoration: projectProvider.isArabic - // ? containerBottomRightRadiusWithGradientForAr(0, lightColor: Colors.transparent, darkColor: Colors.transparent) - // : containerBottomRightRadiusWithGradient(0, lightColor: Colors.red, darkColor: CustomColors.green), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - border: Border.all( - color: Colors.grey.shade300, width: 1.1), - borderRadius: BorderRadius.only( - topRight: Radius.circular( - item.rxMessage != null && - projectProvider.isArabic - ? 20 - : 8), - bottomLeft: Radius.circular(8), - bottomRight: Radius.circular(8), - topLeft: Radius.circular(item.rxMessage != null && - !projectProvider.isArabic - ? 25 - : 8), + height: MediaQuery.of(context).size.width * 0.3, + padding: EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 7), + color: Colors.white, + child: Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: containerRadiusWithGradientServices(0, + lightColor: Colors.transparent, + darkColor: Colors.transparent), + child: Stack( + children: [ + Container( + width: double.infinity, + height: double.infinity, + //clipBehavior: Clip.antiAlias, + // decoration: projectProvider.isArabic + // ? containerBottomRightRadiusWithGradientForAr(0, lightColor: Colors.transparent, darkColor: Colors.transparent) + // : containerBottomRightRadiusWithGradient(0, lightColor: Colors.red, darkColor: CustomColors.green), + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.grey.shade300, width: 1.1), + borderRadius: BorderRadius.only( + topRight: Radius.circular( + item.rxMessage != null && + projectProvider.isArabic + ? 20 + : 8), + bottomLeft: Radius.circular(8), + bottomRight: Radius.circular(8), + topLeft: Radius.circular( + item.rxMessage != null && + !projectProvider.isArabic + ? 25 + : 8), + ), ), + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + alignment: Alignment.center, + child: + (item.images != null && item.images.length > 0) + ? Padding( + padding: EdgeInsets.all(12.0), + child: Image.network( + item.images[0].src, + fit: BoxFit.cover, + height: itemHeight / 2, + ), + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: itemHeight / 2, + ), ), - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - alignment: Alignment.center, - child: (item.images != null && item.images.length > 0) - ? Padding( - padding: EdgeInsets.all(12.0), - child: Image.network( - item.images[0].src, - fit: BoxFit.cover, - height: itemHeight / 2, + ], + ), + ), + if (item.rxMessage != null) + projectProvider.isArabic + ? Positioned( + right: -16, + top: 2, + child: Transform.rotate( + angle: math.pi / 4, + child: Container( + padding: EdgeInsets.only( + left: 18, right: 18, top: 6, bottom: 3), + color: CustomColors.accentColor, + child: Padding( + padding: EdgeInsets.all(2.0), + child: Text( + "الوصفة\n مطلوبة", + style: TextStyle( + color: Colors.white, + fontSize: 7.5, + height: 0.8, + fontWeight: FontWeight.bold, + letterSpacing: -0.27, + ), + ), ), - ) - : Image.asset( - "assets/images/no_image.png", - fit: BoxFit.cover, - height: itemHeight / 2, ), - ), - ], - ), - ), - if (item.rxMessage != null) - projectProvider.isArabic - ? Positioned( - right: -16, - top: 2, - child: Transform.rotate( - angle: math.pi / 4, - child: Container( - padding: EdgeInsets.only( - left: 18, right: 18, top: 6, bottom: 3), - color: CustomColors.accentColor, - child: Padding( - padding: EdgeInsets.all(2.0), + ), + ) + : Positioned( + left: -24, + top: 2, + child: Transform.rotate( + angle: -math.pi / 4, + child: Container( + padding: EdgeInsets.only( + left: 18, right: 18, top: 6, bottom: 3), + color: CustomColors.accentColor, child: Text( - "الوصفة\n مطلوبة", + "\n E-Prescription \n Is required", style: TextStyle( color: Colors.white, fontSize: 7.5, - height: 0.8, - fontWeight: FontWeight.bold, - letterSpacing: -0.27, + //letterSpacing: -0.27, + height: 1.2, + fontWeight: FontWeight.w600, ), ), ), ), ), - ) - : Positioned( - left: -24, - top: 2, - child: Transform.rotate( - angle: -math.pi / 4, - child: Container( - padding: EdgeInsets.only( - left: 18, right: 18, top: 6, bottom: 3), - color: CustomColors.accentColor, - child: Text( - "\n E-Prescription \n Is required", - style: TextStyle( - color: Colors.white, - fontSize: 7.5, - //letterSpacing: -0.27, - height: 1.2, - fontWeight: FontWeight.w600, - ), - ), - ), - ), - ), - ], + ], + ), ), ), - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: Container( - height: MediaQuery.of(context).size.height * 0.075, - child: Texts( - projectProvider.isArabic ? item.namen : item.name, - //regular: true, - fontSize: 10, - color: Color(0xff2B353E), - fontWeight: FontWeight.w500, + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.075, + child: Texts( + projectProvider.isArabic ? item.namen : item.name, + //regular: true, + fontSize: 10, + color: Color(0xff2B353E), + fontWeight: FontWeight.w500, + ), ), ), - ), - SizedBox( - height: 7.0, - ), - Expanded( - child: Container( - margin: EdgeInsets.symmetric( - horizontal: 4, - vertical: 0, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.end, - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 10, vertical: 2), - child: Texts( - "SAR ${item.price}", - fontWeight: FontWeight.bold, - fontSize: 11, - color: Color(0xff2B353E), + SizedBox( + height: 7.0, + ), + Expanded( + child: Container( + margin: EdgeInsets.symmetric( + horizontal: 4, + vertical: 0, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.end, + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 2), + child: Texts( + "SAR ${item.price}", + fontWeight: FontWeight.bold, + fontSize: 11, + color: Color(0xff2B353E), + ), ), - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 5), - child: Row( - children: [ - // Expanded( - RatingBar.readOnly( - initialRating: item.approvedRatingSum.toDouble(), - size: 15.0, - filledColor: Color(0XFFD02127), - emptyColor: Color(0XFFD02127), - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star_border, - ), - Texts( - "(${item.approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 5), + child: Row( + children: [ + // Expanded( + RatingBar.readOnly( + initialRating: item.approvedRatingSum.toDouble(), + size: 15.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + Texts( + "(${item.approvedTotalReviews})", + regular: true, + fontSize: 10, + fontWeight: FontWeight.w400, + ), - SizedBox( - width: 10.0, - ), - Icon( - Icons.arrow_forward, - size: 15, - color: Color(0xff2D2F39), - ), + SizedBox( + width: 10.0, + ), + Icon( + Icons.arrow_forward, + size: 15, + color: Color(0xff2D2F39), + ), // StarRating( // totalAverage: item.approvedTotalReviews > 0 @@ -305,18 +309,19 @@ class ProductTileItem extends StatelessWidget { // .toDouble() // : 0, // forceStars: true), - // ), - ], + // ), + ], + ), ), - ), - ], + ], + ), ), ), - ), - SizedBox( - height: 1, - ), - ], + SizedBox( + height: 1, + ), + ], + ), ), ); } From 8f044a635a18b3a10d2bcf097b23c01e02a1a003 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 28 Nov 2021 14:31:28 +0200 Subject: [PATCH 03/39] fix footer design --- .../product-details/footor/footer-widget.dart | 58 +++++++++++++------ lib/widgets/buttons/secondary_button.dart | 10 ++-- 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index e0cf8168..3807714e 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -57,7 +57,15 @@ class _FooterWidgetState extends State { borderRadius: BorderRadius.all( Radius.circular(0.0), ), - border: Border.all(color: Color(0xFF707070), width: 0), + boxShadow: [ + BoxShadow( + color: Color(0xFFCCCCCC), + spreadRadius: 0, + blurRadius: 4, + offset: Offset(2, 2), // changes position of shadow + ), + ], + // border: Border.all(color: Color(0xFF707070), width: 0), ), width: double.infinity, height: quantityUI, @@ -219,12 +227,12 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, + margin: EdgeInsets.symmetric( vertical: 5.0), + child: SecondaryButton( label: TranslationBase.of(context).addToCart, - disabled: (!widget.isAvailable && widget.quantity > 0) || - widget.quantity > widget.quantityLimit || - widget.item.isRx, - fontSize: 16, + disabled: isAddToCartDisable(), + fontSize: 15, onTap: () async { if (!authenticatedUserObject.isLogin) { login(); @@ -235,8 +243,9 @@ class _FooterWidgetState extends State { model: widget.model); }, fontWeight: FontWeight.w600, - borderColor: Color(0xFF4CAF50).withOpacity(0.7), borderRadius: 6, + disableColor:Color(0xFFD6D6D6), + textColor: isAddToCartDisable()?Color(0xFFACACAC):Colors.white, color: Color(0xFF535353), ), ), @@ -245,12 +254,13 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, + margin: EdgeInsets.symmetric( vertical: 5.0), + child: SecondaryButton( label: TranslationBase.of(context).buyNow, - fontSize: 16, - disabled: (!widget.isAvailable && widget.quantity > 0) || - (widget.quantity > widget.quantityLimit) || - widget.item.isRx, + fontSize: 15, + disabled: isBuyNowDisable(), + onTap: () async { if (!authenticatedUserObject.isLogin) { login(); @@ -261,15 +271,11 @@ class _FooterWidgetState extends State { model: widget.model); } }, + textColor: isBuyNowDisable()?Color(0xFFACACAC):Colors.white, fontWeight: FontWeight.w600, - borderColor: Colors.grey[800].withOpacity(0.7), borderRadius: 6, - disableColor: Colors.grey[700], - color: !widget.isAvailable && widget.quantity > 0 || - widget.quantity > widget.quantityLimit || - widget.item.isRx - ? Color(0xFF535353).withOpacity(0.7) - : Color(0xFF5AB145), + disableColor: Color(0xFFD6D6D6), + color: Color(0xFF5AB145), ), ), ], @@ -280,6 +286,24 @@ class _FooterWidgetState extends State { ); } + bool isBuyNowDisable(){ + // return true; + return (!widget.isAvailable && widget.quantity > 0) || + (widget.quantity > widget.quantityLimit) || + widget.item.isRx; + + + } + + bool isAddToCartDisable(){ + // return true; + return (!widget.isAvailable && widget.quantity > 0) || + widget.quantity > widget.quantityLimit || + widget.item.isRx; + + + } + void setUserValues(value) async { if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); } diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index 8f0ae5f1..a5ac63aa 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -200,9 +200,9 @@ class _SecondaryButtonState extends State width: MediaQuery.of(context).size.width * 2.2, height: MediaQuery.of(context).size.width * 2.2, decoration: BoxDecoration( - shape: BoxShape.circle, + // shape: BoxShape.circle, color: widget.disabled - ? Colors.grey + ? widget.disableColor ?? Colors.grey : widget.color ?? Theme.of(context).buttonColor, ), ), @@ -212,8 +212,8 @@ class _SecondaryButtonState extends State padding: widget.iconOnly ? EdgeInsets.symmetric(vertical: 4.0, horizontal: 5.0) : EdgeInsets.only( - top: widget.small ? 8.0 : 14.0, - bottom: widget.small ? 6.0 : 14.0, + top: widget.small ? 8.0 : 12.0, + bottom: widget.small ? 6.0 : 12.0, left: 18.0, right: 18.0), child: Stack( @@ -246,8 +246,10 @@ class _SecondaryButtonState extends State bottom: widget.small ? 4.0 : 3.0), child: Text( widget.label, + textAlign: TextAlign.center, style: TextStyle( color: widget.textColor, + fontSize: widget.small ? 12.0 : widget.fontSize??14.0, fontWeight: FontWeight.w700, fontFamily: projectViewModel.isArabic From 01433963bd260fef240f2e3433533f61c9e418cb Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 29 Nov 2021 11:50:25 +0200 Subject: [PATCH 04/39] pharmacy home design --- .../pharmacies/widgets/ProductTileItem.dart | 14 ++-- .../widgets/home/MostViewedWidget.dart | 5 -- .../widgets/home/RecentlyViewedWidget.dart | 78 +++++++++---------- .../widgets/home/ViewAllHomeWidget.dart | 2 +- 4 files changed, 45 insertions(+), 54 deletions(-) diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index 248901b6..b349d675 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -85,6 +85,7 @@ class ProductTileItem extends StatelessWidget { border: Border.all(color: Colors.grey.shade300, width: 0.2), borderRadius: BorderRadius.circular(10), color: Colors.white, + shape: BoxShape.rectangle, boxShadow: [ BoxShadow( color: Color(0xffF1F1F1), @@ -145,7 +146,7 @@ class ProductTileItem extends StatelessWidget { Container( decoration: BoxDecoration( border: Border.all( - color: Colors.grey.shade300, width: 1.1), + color: Color(0xffF0F0F0), width: 1.0), borderRadius: BorderRadius.only( topRight: Radius.circular( item.rxMessage != null && @@ -157,7 +158,7 @@ class ProductTileItem extends StatelessWidget { topLeft: Radius.circular( item.rxMessage != null && !projectProvider.isArabic - ? 25 + ? 9 : 8), ), ), @@ -192,14 +193,13 @@ class ProductTileItem extends StatelessWidget { child: Container( padding: EdgeInsets.only( left: 18, right: 18, top: 6, bottom: 3), - color: CustomColors.accentColor, child: Padding( padding: EdgeInsets.all(2.0), child: Text( "الوصفة\n مطلوبة", style: TextStyle( color: Colors.white, - fontSize: 7.5, + fontSize: 7.0, height: 0.8, fontWeight: FontWeight.bold, letterSpacing: -0.27, @@ -222,7 +222,7 @@ class ProductTileItem extends StatelessWidget { "\n E-Prescription \n Is required", style: TextStyle( color: Colors.white, - fontSize: 7.5, + fontSize: 7.0, //letterSpacing: -0.27, height: 1.2, fontWeight: FontWeight.w600, @@ -244,7 +244,7 @@ class ProductTileItem extends StatelessWidget { //regular: true, fontSize: 10, color: Color(0xff2B353E), - fontWeight: FontWeight.w500, + fontWeight: FontWeight.w600, ), ), ), @@ -266,7 +266,7 @@ class ProductTileItem extends StatelessWidget { horizontal: 10, vertical: 2), child: Texts( "SAR ${item.price}", - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w700, fontSize: 11, color: Color(0xff2B353E), ), diff --git a/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart b/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart index a1ce0bc4..01fea98e 100644 --- a/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart +++ b/lib/pages/pharmacies/widgets/home/MostViewedWidget.dart @@ -31,11 +31,6 @@ class MostViewedWidget extends StatelessWidget { )), if (model.state != ViewState.BusyLocal) Container( - decoration: BoxDecoration( - border: Border.all( - color: Colors.grey.shade300, width: 0.1), - borderRadius: BorderRadius.circular(8), - ), height: MediaQuery.of(context).size.height / 3 + 1, child: ListView.builder( itemBuilder: (ctx, i) => ProductTileItem( diff --git a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart index f03c384d..e1eab06c 100644 --- a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart +++ b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart @@ -16,48 +16,44 @@ class RecentlyViewedWidget extends StatelessWidget { onModelReady: (model) => model.getLastVisitedProducts(), allowAny: true, builder: (_, model, wi) => NetworkBaseView( - isLocalLoader: true, - baseViewModel: model, - child: model.lastVisitedProducts.isNotEmpty - ? Container( - child: Column( - children: [ - ViewAllHomeWidget( - TranslationBase.of(context).recentlyViewed, - FinalProductsPage( - id: "", - productType: 3, - )), - if (model.state != ViewState.BusyLocal) - Container( - height: model.lastVisitedProducts.length > 0 - ? MediaQuery.of(context).size.height / 3 + 1 - : 0, - child: ListView.builder( - itemBuilder: (ctx, i) => ProductTileItem( - model.lastVisitedProducts[i], - MediaQuery.of(context).size.height / 4 + - 20), - scrollDirection: Axis.horizontal, - itemCount: model.lastVisitedProducts.length, - ), - ) - else - Container( - height: 80, - child: Center( - child: CircularProgressIndicator( - backgroundColor: Colors.white, - valueColor: AlwaysStoppedAnimation( - Colors.grey[500], - ), - ), - ), - ), - ], + isLocalLoader: true, + baseViewModel: model, + child: Container( + child: Column( + children: [ + ViewAllHomeWidget( + TranslationBase.of(context).recentlyViewed, + FinalProductsPage( + id: "", + productType: 3, + )), + if (model.state != ViewState.BusyLocal) + Container( + height: model.lastVisitedProducts.length > 0 + ? MediaQuery.of(context).size.height / 3 + 1 + : 0, + child: ListView.builder( + itemBuilder: (ctx, i) => ProductTileItem( + model.lastVisitedProducts[i], + MediaQuery.of(context).size.height / 4 + 20), + scrollDirection: Axis.horizontal, + itemCount: model.lastVisitedProducts.length, ), ) - : Container(), - )); + else + Container( + height: 80, + child: Center( + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), + ), + ), + ), + ], + ), + ))); } } diff --git a/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart index 9d56deff..2b73a15a 100644 --- a/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart +++ b/lib/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart @@ -19,7 +19,7 @@ class ViewAllHomeWidget extends StatelessWidget { Texts( title, color: Color(0xff2E303A), - bold: true, + fontWeight: FontWeight.w700, fontSize: 19, ), InkWell( From f623828d7835d43d748f79aef7121bb6ff81b9ab Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 29 Nov 2021 12:06:41 +0200 Subject: [PATCH 05/39] fix arabic language --- .../product-details/footor/footer-widget.dart | 2 - lib/pages/search_products_page.dart | 127 ++++++++++++------ 2 files changed, 89 insertions(+), 40 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index 3807714e..5d974cc4 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -287,7 +287,6 @@ class _FooterWidgetState extends State { } bool isBuyNowDisable(){ - // return true; return (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx; @@ -296,7 +295,6 @@ class _FooterWidgetState extends State { } bool isAddToCartDisable(){ - // return true; return (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx; diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 8ec9f014..74e4ff37 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -11,12 +11,16 @@ import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; +import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import 'base/base_view.dart'; +import 'package:intl/intl.dart' as international; + + class SearchProductsPage extends StatefulWidget { @override @@ -27,6 +31,8 @@ class _SearchProductsPageState extends State { final textController = TextEditingController(); final _formKey = GlobalKey(); String msg = ''; + String validText=""; + bool isTextValid = true; @override Widget build(BuildContext context) { @@ -55,47 +61,90 @@ class _SearchProductsPageState extends State { width: MediaQuery.of(context).size.width * 0.70, child: Form( key: _formKey, - child: TextFields( - autoFocus: true, - hintText: TranslationBase.of(context).search, - fontSize: 14.5, - prefixIcon: Icon(Icons.search), - inputAction: TextInputAction.search, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(r'([A-Za-z0-9 a space])')) - ], - validator: (value) { - RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); - if (value.isEmpty) { - TranslationBase.of(context) - .pleaseEnterProductName; - } else if (!regExp.hasMatch(value)) { - AppToast.showErrorToast( - message: TranslationBase.of(context) - .noArabicLetters); - } - return null; - }, - onSaved: (value) { - //searchMedicine(model, context); - }, - onSubmit: (value) { - searchMedicine(model, context); + child: Column( + children: [ + TextFields( + autoFocus: true, + hintText: TranslationBase.of(context).search, + fontSize: 14.5, + prefixIcon: Icon(Icons.search), + inputAction: TextInputAction.search, + + validator: (value) { + RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); + if (value.isEmpty) { + TranslationBase.of(context) + .pleaseEnterProductName; + } else if (isRTL(value))) { + AppToast.showErrorToast( + message: TranslationBase.of(context) + .noArabicLetters); + } + return null; + }, + onChanged: (value){ + if (value.isEmpty) { + TranslationBase.of(context) + .pleaseEnterProductName; + + Future.delayed(const Duration(milliseconds: 10), (){ + setState(() { + textController.text = ""; + isTextValid = true; + }); + }) + ; + + + } else if (isRTL(value)) { + Future.delayed(const Duration(milliseconds: 10), (){ + setState(() { + textController.text = validText; + isTextValid = false; + }); + }) + ; + + }else{ + + Future.delayed(const Duration(milliseconds: 10), (){ + setState(() { + textController.text = value; + validText = value; + isTextValid = true; + }); + }) + ; + + } + + }, + onSaved: (value) { + setState(() { + textController.text = validText; + isTextValid = false; + }); + //searchMedicine(model, context); + }, + onSubmit: (value) { + searchMedicine(model, context); // msg = 'No Result Found'; - msg = TranslationBase.of(context).noResultFound; - }, - controller: textController, -// validator: (value) { -// if (value.isEmpty) { -//// return 'please Enter Product Name'; -// return TranslationBase.of(context).pleaseEnterProductName; -// } -// return null; -// }, + msg = TranslationBase.of(context).noResultFound; + }, + controller: textController, + ), + SizedBox( + width: 10.0, + ), + if(!isTextValid) + AppText( TranslationBase.of(context) + .noArabicLetters, color: Colors.red,), + ], ), ), ), + + SizedBox( width: 10.0, ), @@ -337,7 +386,9 @@ class _SearchProductsPageState extends State { ), ); } - + bool isRTL(String text) { + return international.Bidi.detectRtlDirectionality(text); + } searchMedicine(PharmacyCategoriseViewModel model, BuildContext context) { Utils.hideKeyboard(context); if (_formKey.currentState.validate()) From 3e667d6b8745a2262bb48288e8ab331322ed3b62 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 29 Nov 2021 12:07:08 +0200 Subject: [PATCH 06/39] fix arabic language --- lib/pages/search_products_page.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 74e4ff37..f74d38d6 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -75,7 +75,7 @@ class _SearchProductsPageState extends State { if (value.isEmpty) { TranslationBase.of(context) .pleaseEnterProductName; - } else if (isRTL(value))) { + } else if (isRTL(value)) { AppToast.showErrorToast( message: TranslationBase.of(context) .noArabicLetters); From 16c1064a4585fe95e40ba3dbae885cca9f94a9a1 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 29 Nov 2021 15:15:44 +0200 Subject: [PATCH 07/39] PMAU-19 --- lib/config/config.dart | 4 +- .../pharmacies/widgets/home/BannerPager.dart | 28 +++++++++++- lib/widgets/others/entity_checkbox_list.dart | 43 ++++++++++++------- 3 files changed, 56 insertions(+), 19 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index dafe7ab9..42861cce 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,8 +15,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; diff --git a/lib/pages/pharmacies/widgets/home/BannerPager.dart b/lib/pages/pharmacies/widgets/home/BannerPager.dart index 6302f263..8c62f458 100644 --- a/lib/pages/pharmacies/widgets/home/BannerPager.dart +++ b/lib/pages/pharmacies/widgets/home/BannerPager.dart @@ -4,6 +4,9 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_mod import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/landing/home_page.dart'; import 'package:diplomaticquarterapp/pages/offers_categorise_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-activitaion-vida-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lacum-registration-page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/GridViewCard.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -50,7 +53,7 @@ class _BannerPagerState extends State { (item, index) { return InkWell( onTap: () { - Navigator.push(context, FadePage(page: OffersCategorisePage())); + bannerNavigator(index); }, child: Container( margin: EdgeInsets.symmetric(horizontal: 1.0), @@ -93,4 +96,27 @@ class _BannerPagerState extends State { ], )); } + + bannerNavigator(index){ + switch(index) { + case 1: { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + } + break; + case 2: { + Navigator.push(context, FadePage(page: LakumActivationVidaPage())); + } + break; + case 5: { + Navigator.push(context, FadePage(page: OffersCategorisePage())); + } + break; + + default: { + + } + break; + } + + } } diff --git a/lib/widgets/others/entity_checkbox_list.dart b/lib/widgets/others/entity_checkbox_list.dart index c03fe029..0a34778f 100644 --- a/lib/widgets/others/entity_checkbox_list.dart +++ b/lib/widgets/others/entity_checkbox_list.dart @@ -93,24 +93,22 @@ class _ProcedureListWidgetState extends State { historyInfo), activeColor: Colors.red[800], onChanged: (bool newValue) { - setState(() { - if (widget.isEntityListSelected( - historyInfo)) { - widget - .removeHistory(historyInfo); - } else { - widget.addHistory(historyInfo); - } - }); + selectOption(historyInfo); + }), Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts(historyInfo.name, - variant: "bodyText", - bold: true, - color: Colors.black), + child: InkWell( + onTap:(){ + selectOption(historyInfo); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts(historyInfo.name, + variant: "bodyText", + bold: true, + color: Colors.black), + ), ), ), ], @@ -142,6 +140,19 @@ class _ProcedureListWidgetState extends State { ); } + + selectOption(historyInfo){ + setState(() { + if (widget.isEntityListSelected( + historyInfo)) { + widget + .removeHistory(historyInfo); + } else { + widget.addHistory(historyInfo); + } + }); + } + void filterSearchResults(String query) { List dummySearchList = List(); dummySearchList.addAll(widget.masterList); From 6b1c0e04d0dd69458fdd798841f4f37946108893 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 29 Nov 2021 17:10:13 +0200 Subject: [PATCH 08/39] pharmacy design home page --- .../pharmacies/widgets/ProductTileItem.dart | 96 +++++++------ .../widgets/home/RecentlyViewedWidget.dart | 78 ++++++----- lib/uitl/utils_new.dart | 128 +++++++++++++----- 3 files changed, 179 insertions(+), 123 deletions(-) diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index b349d675..a4988695 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -123,65 +123,62 @@ class ProductTileItem extends StatelessWidget { Container( width: double.infinity, height: MediaQuery.of(context).size.width * 0.3, - padding: EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 7), + padding: + EdgeInsets.only(left: 10, right: 10, top: 7, bottom: 3.5), color: Colors.white, child: Container( width: double.infinity, height: double.infinity, clipBehavior: Clip.antiAlias, - decoration: containerRadiusWithGradientServices(0, + decoration: containerRadiusWithGradientServices(0.0, + prescriptionRequired: item.rxMessage != null, + isProduct: true, + isEnglish: !projectProvider.isArabic, lightColor: Colors.transparent, darkColor: Colors.transparent), child: Stack( children: [ - Container( - width: double.infinity, - height: double.infinity, - //clipBehavior: Clip.antiAlias, - // decoration: projectProvider.isArabic - // ? containerBottomRightRadiusWithGradientForAr(0, lightColor: Colors.transparent, darkColor: Colors.transparent) - // : containerBottomRightRadiusWithGradient(0, lightColor: Colors.red, darkColor: CustomColors.green), - child: Stack( - children: [ - Container( - decoration: BoxDecoration( - border: Border.all( - color: Color(0xffF0F0F0), width: 1.0), - borderRadius: BorderRadius.only( - topRight: Radius.circular( - item.rxMessage != null && - projectProvider.isArabic - ? 20 - : 8), - bottomLeft: Radius.circular(8), - bottomRight: Radius.circular(8), - topLeft: Radius.circular( - item.rxMessage != null && - !projectProvider.isArabic - ? 9 - : 8), - ), + Stack( + children: [ + Container( + decoration: BoxDecoration( + border: Border.all( + color: Color(0xffF0F0F0), width: 1.0), + borderRadius: BorderRadius.only( + topRight: Radius.circular( + item.rxMessage != null && + projectProvider.isArabic + ? 20 + : 8), + bottomLeft: Radius.circular(8), + bottomRight: Radius.circular(8), + topLeft: Radius.circular(item.rxMessage != null && + !projectProvider.isArabic + ? 20 + : 8), ), - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - alignment: Alignment.center, - child: - (item.images != null && item.images.length > 0) - ? Padding( - padding: EdgeInsets.all(12.0), - child: Image.network( - item.images[0].src, - fit: BoxFit.cover, - height: itemHeight / 2, - ), - ) - : Image.asset( - "assets/images/no_image.png", - fit: BoxFit.cover, - height: itemHeight / 2, - ), ), - ], - ), + margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + alignment: Alignment.center, + child: (item.images != null && item.images.length > 0) + ? Padding( + padding: EdgeInsets.all(12.0), + child: Image.network( + item.images[0].src, + fit: BoxFit.cover, + height: itemHeight / 2, + ), + ) + : Padding( + padding: EdgeInsets.all(8.0), + child: Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: itemHeight / 2, + ), + ), + ), + ], ), if (item.rxMessage != null) projectProvider.isArabic @@ -191,6 +188,7 @@ class ProductTileItem extends StatelessWidget { child: Transform.rotate( angle: math.pi / 4, child: Container( + color: CustomColors.accentColor, padding: EdgeInsets.only( left: 18, right: 18, top: 6, bottom: 3), child: Padding( @@ -201,7 +199,7 @@ class ProductTileItem extends StatelessWidget { color: Colors.white, fontSize: 7.0, height: 0.8, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w600, letterSpacing: -0.27, ), ), diff --git a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart index e1eab06c..f03c384d 100644 --- a/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart +++ b/lib/pages/pharmacies/widgets/home/RecentlyViewedWidget.dart @@ -16,44 +16,48 @@ class RecentlyViewedWidget extends StatelessWidget { onModelReady: (model) => model.getLastVisitedProducts(), allowAny: true, builder: (_, model, wi) => NetworkBaseView( - isLocalLoader: true, - baseViewModel: model, - child: Container( - child: Column( - children: [ - ViewAllHomeWidget( - TranslationBase.of(context).recentlyViewed, - FinalProductsPage( - id: "", - productType: 3, - )), - if (model.state != ViewState.BusyLocal) - Container( - height: model.lastVisitedProducts.length > 0 - ? MediaQuery.of(context).size.height / 3 + 1 - : 0, - child: ListView.builder( - itemBuilder: (ctx, i) => ProductTileItem( - model.lastVisitedProducts[i], - MediaQuery.of(context).size.height / 4 + 20), - scrollDirection: Axis.horizontal, - itemCount: model.lastVisitedProducts.length, + isLocalLoader: true, + baseViewModel: model, + child: model.lastVisitedProducts.isNotEmpty + ? Container( + child: Column( + children: [ + ViewAllHomeWidget( + TranslationBase.of(context).recentlyViewed, + FinalProductsPage( + id: "", + productType: 3, + )), + if (model.state != ViewState.BusyLocal) + Container( + height: model.lastVisitedProducts.length > 0 + ? MediaQuery.of(context).size.height / 3 + 1 + : 0, + child: ListView.builder( + itemBuilder: (ctx, i) => ProductTileItem( + model.lastVisitedProducts[i], + MediaQuery.of(context).size.height / 4 + + 20), + scrollDirection: Axis.horizontal, + itemCount: model.lastVisitedProducts.length, + ), + ) + else + Container( + height: 80, + child: Center( + child: CircularProgressIndicator( + backgroundColor: Colors.white, + valueColor: AlwaysStoppedAnimation( + Colors.grey[500], + ), + ), + ), + ), + ], ), ) - else - Container( - height: 80, - child: Center( - child: CircularProgressIndicator( - backgroundColor: Colors.white, - valueColor: AlwaysStoppedAnimation( - Colors.grey[500], - ), - ), - ), - ), - ], - ), - ))); + : Container(), + )); } } diff --git a/lib/uitl/utils_new.dart b/lib/uitl/utils_new.dart index 832a92b1..ec71ff24 100644 --- a/lib/uitl/utils_new.dart +++ b/lib/uitl/utils_new.dart @@ -32,11 +32,16 @@ Widget getPaymentMethods() { mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Image.asset("assets/images/new/payment/Mada.png", width: 50, height: 50), - Image.asset("assets/images/new/payment/visa.png", width: 50, height: 50), - Image.asset("assets/images/new/payment/Mastercard.png", width: 50, height: 50), - Image.asset("assets/images/new/payment/Apple_Pay.png", width: 50, height: 50), - Image.asset("assets/images/new/payment/installments.png", width: 50, height: 50), + Image.asset("assets/images/new/payment/Mada.png", + width: 50, height: 50), + Image.asset("assets/images/new/payment/visa.png", + width: 50, height: 50), + Image.asset("assets/images/new/payment/Mastercard.png", + width: 50, height: 50), + Image.asset("assets/images/new/payment/Apple_Pay.png", + width: 50, height: 50), + Image.asset("assets/images/new/payment/installments.png", + width: 50, height: 50), ], ), ); @@ -48,10 +53,15 @@ Widget getNoDataWidget(BuildContext context) { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - SvgPicture.asset('assets/images/new/not_found.svg', width: 110.0, height: 110.0), + SvgPicture.asset('assets/images/new/not_found.svg', + width: 110.0, height: 110.0), Container( - margin: EdgeInsets.only(top: 15.0), - child: Text(TranslationBase.of(context).noResultFound, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xFFBABABA)))), + margin: EdgeInsets.only(top: 15.0), + child: Text(TranslationBase.of(context).noResultFound, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xFFBABABA)))), ], ), ), @@ -79,7 +89,8 @@ spacer() { } Future navigateTo(context, page) async { - return await Navigator.push(context, MaterialPageRoute(builder: (context) => page)); + return await Navigator.push( + context, MaterialPageRoute(builder: (context) => page)); } // Future navigateToReplace(context, page) async { @@ -137,7 +148,11 @@ Widget circularAviator( child: Container( width: s, height: s, - decoration: containerColorRadiusBorderWidth(bcColor == null ? Colors.grey[200] : bcColor, 2000, brColor == null ? Colors.blueGrey[800] : brColor, borderWidth == null ? 2 : borderWidth), + decoration: containerColorRadiusBorderWidth( + bcColor == null ? Colors.grey[200] : bcColor, + 2000, + brColor == null ? Colors.blueGrey[800] : brColor, + borderWidth == null ? 2 : borderWidth), child: Icon( icon == null ? Icons.person : icon, size: s / 1.7, @@ -219,13 +234,14 @@ RoundedRectangleBorder buttonShape() { ); } -Decoration containerRadiusWithGradient(double radius,{Color color1,Color color2}) { +Decoration containerRadiusWithGradient(double radius, + {Color color1, Color color2}) { return BoxDecoration( borderRadius: BorderRadius.circular(radius), gradient: LinearGradient( colors: [ - color1?? Color(0xFFF71787E), - color2?? Color(0xFFF2B353E), + color1 ?? Color(0xFFF71787E), + color2 ?? Color(0xFFF2B353E), ], begin: Alignment.centerLeft, end: Alignment.centerRight, @@ -233,7 +249,8 @@ Decoration containerRadiusWithGradient(double radius,{Color color1,Color color2} ); } -Decoration containerBottomRightRadiusWithGradient(double radius, {Color darkColor, Color lightColor}) { +Decoration containerBottomRightRadiusWithGradient(double radius, + {Color darkColor, Color lightColor}) { return BoxDecoration( borderRadius: BorderRadius.only(bottomRight: Radius.circular(radius)), gradient: LinearGradient( @@ -247,7 +264,8 @@ Decoration containerBottomRightRadiusWithGradient(double radius, {Color darkColo ); } -Decoration containerBottomRightRadiusWithGradientForAr(double radius, {Color darkColor, Color lightColor}) { +Decoration containerBottomRightRadiusWithGradientForAr(double radius, + {Color darkColor, Color lightColor}) { return BoxDecoration( borderRadius: BorderRadius.only(bottomLeft: Radius.circular(radius)), gradient: LinearGradient( @@ -261,9 +279,24 @@ Decoration containerBottomRightRadiusWithGradientForAr(double radius, {Color dar ); } -Decoration containerRadiusWithGradientServices(double radius, {Color darkColor, Color lightColor}) { +Decoration containerRadiusWithGradientServices( + double radius, { + Color darkColor, + Color lightColor, + bool isProduct = false, + bool prescriptionRequired = false, + bool isEnglish = true, +}) { return BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(radius)), + borderRadius: !isProduct || !prescriptionRequired + ? BorderRadius.all(Radius.circular(radius)) + : isEnglish + ? BorderRadius.only( + topLeft: Radius.circular(26), + ) + : BorderRadius.only( + topRight: Radius.circular(26), + ), gradient: LinearGradient( colors: [ darkColor == null ? Color(0xFF2B353E) : darkColor, @@ -275,7 +308,11 @@ Decoration containerRadiusWithGradientServices(double radius, {Color darkColor, ); } -Decoration containerBottomRightRadiusWithGradientBorder(double radius, {Color darkColor, Color lightColor, Color borderColor = Colors.transparent, double w = 0}) { +Decoration containerBottomRightRadiusWithGradientBorder(double radius, + {Color darkColor, + Color lightColor, + Color borderColor = Colors.transparent, + double w = 0}) { return BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(radius)), border: Border.all( @@ -304,7 +341,8 @@ Decoration containerRadius(Color background, double radius) { ); } -Decoration containerColorRadiusBorder(Color background, double radius, Color color) { +Decoration containerColorRadiusBorder( + Color background, double radius, Color color) { return BoxDecoration( color: background, border: Border.all( @@ -315,7 +353,8 @@ Decoration containerColorRadiusBorder(Color background, double radius, Color col ); } -Decoration containerColorRadiusBorderWidth(Color background, double radius, Color color, double w) { +Decoration containerColorRadiusBorderWidth( + Color background, double radius, Color color, double w) { return BoxDecoration( color: background, border: Border.all( @@ -326,13 +365,14 @@ Decoration containerColorRadiusBorderWidth(Color background, double radius, Colo ); } -Decoration containerColorRadiusBorderWidthCircular(Color background, double radius, Color color, double w) { +Decoration containerColorRadiusBorderWidthCircular( + Color background, double radius, Color color, double w) { return BoxDecoration( color: background, border: Border.all( width: w, // color: color // <--- border width here - ), + ), // borderRadius: BorderRadius.circular(radius), shape: BoxShape.circle, ); @@ -341,29 +381,36 @@ Decoration containerColorRadiusBorderWidthCircular(Color background, double radi Decoration containerColorRadiusRight(Color background, double radius) { return BoxDecoration( color: background, - borderRadius: BorderRadius.only(topRight: Radius.circular(radius), bottomRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topRight: Radius.circular(radius), + bottomRight: Radius.circular(radius)), ); } Decoration containerColorRadiusLeft(Color background, double radius) { return BoxDecoration( color: background, - borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), ); } -Decoration containerColorRadiusRightBorder(Color background, double radius, double w) { +Decoration containerColorRadiusRightBorder( + Color background, double radius, double w) { return BoxDecoration( color: background, border: Border.all( width: w, // color: Colors.white // <--- border width here ), - borderRadius: BorderRadius.only(topRight: Radius.circular(radius), bottomRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topRight: Radius.circular(radius), + bottomRight: Radius.circular(radius)), ); } -Decoration containerColorRadiusRightBorderc(Color background, double radius, double w, Color borderColor) { +Decoration containerColorRadiusRightBorderc( + Color background, double radius, double w, Color borderColor) { return BoxDecoration( color: background, border: Border.all( @@ -394,21 +441,23 @@ Decoration containerColorRadiusBottom(Color color, double radius) { ); } -Decoration containerColorRadiusLeftBorder(Color background, double radius, double w) { +Decoration containerColorRadiusLeftBorder( + Color background, double radius, double w) { return BoxDecoration( color: background, border: Border.all( width: w, // color: Colors.white // <--- border width here ), - borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), bottomLeft: Radius.circular(radius)), ); } -BoxDecoration cardRadius(double radius,{Color color,double elevation}) { - return BoxDecoration( +BoxDecoration cardRadius(double radius, {Color color, double elevation}) { + return BoxDecoration( shape: BoxShape.rectangle, - color: color??Colors.white, + color: color ?? Colors.white, borderRadius: BorderRadius.all( Radius.circular(radius), ), @@ -416,7 +465,7 @@ BoxDecoration cardRadius(double radius,{Color color,double elevation}) { BoxShadow( color: Color(0xff000000).withOpacity(.05), //spreadRadius: 5, - blurRadius:elevation?? 27, + blurRadius: elevation ?? 27, offset: Offset(-2, 3), ), ], @@ -433,19 +482,23 @@ ShapeBorder cardRadiusNew(double radius) { ShapeBorder cardRadiusTop(double radius) { return RoundedRectangleBorder( side: BorderSide(color: Colors.transparent, width: 0), - borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), ); } ShapeBorder cardRadiusTop2(double radius) { return RoundedRectangleBorder( - borderRadius: BorderRadius.only(topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(radius), topRight: Radius.circular(radius)), ); } ShapeBorder cardRadiusBottom(double radius) { return RoundedRectangleBorder( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(radius), bottomRight: Radius.circular(radius)), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(radius), + bottomRight: Radius.circular(radius)), ); } @@ -568,7 +621,8 @@ FontStyle getFontStyle(String fontStyle) { bool timeCalculator(int startHour, int startMint, int endHour, int endMint) { DateTime now = DateTime.now(); - DateTime startDate = DateTime(now.year, now.month, now.day, startHour, startHour); + DateTime startDate = + DateTime(now.year, now.month, now.day, startHour, startHour); DateTime endDate = DateTime(now.year, now.month, now.day, endHour, endMint); if (startDate.isBefore(now) && endDate.isAfter(now)) return true; From b0ae08d6a5e8af749c3fb149bb8f7bdabc5d3677 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 30 Nov 2021 11:06:59 +0300 Subject: [PATCH 09/39] updates & fixes --- .../labs/patient_lab_special_result.dart | 2 +- .../screens/cart-page/cart-order-page.dart | 2 +- .../pharmacyAddresses/PharmacyAddresses.dart | 5 +- lib/widgets/others/app_scaffold_widget.dart | 94 +++++-------------- 4 files changed, 27 insertions(+), 76 deletions(-) diff --git a/lib/core/model/labs/patient_lab_special_result.dart b/lib/core/model/labs/patient_lab_special_result.dart index 2fbcb832..8e24a04d 100644 --- a/lib/core/model/labs/patient_lab_special_result.dart +++ b/lib/core/model/labs/patient_lab_special_result.dart @@ -3,7 +3,7 @@ class PatientLabSpecialResult { String moduleID; String resultData; String resultDataHTML; - Null resultDataTxt; + dynamic resultDataTxt; PatientLabSpecialResult( {this.invoiceNo, diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index df44c706..7a252bd6 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -412,7 +412,7 @@ class _OrderBottomWidgetState extends State { if (widget.model.isCartItemsOutOfStock()) {AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg)} else - {_navigateToAddressPage(widget.model.user.patientIdentificationNo)} + {_navigateToAddressPage(projectProvider.user.patientIdentificationNo)} } : null, child: new Text( diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index 6a423b82..2fe78395 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart'; @@ -15,6 +16,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; ///TODO Elham* split this to tow files class PharmacyAddressesPage extends StatefulWidget { @@ -44,6 +46,7 @@ class _PharmacyAddressesState extends State { Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; + ProjectViewModel projectProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getAddressesList(), @@ -127,7 +130,7 @@ class _PharmacyAddressesState extends State { GifLoaderDialogUtils.showMyDialog(context); - await widget.orderPreviewViewModel.getInformationsByAddress(widget.orderPreviewViewModel.user.patientIdentificationNo); + await widget.orderPreviewViewModel.getInformationsByAddress(projectProvider.user.patientIdentificationNo); if (widget.orderPreviewViewModel.error == "") { await widget.orderPreviewViewModel.getShoppingCart(); GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index c5b45b77..75b750d4 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -14,7 +14,6 @@ import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page_pharmcy.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/search_products_page.dart'; -import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -135,8 +134,7 @@ class AppScaffold extends StatefulWidget { } class _AppScaffoldState extends State { - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); AppBarWidget appBar; @override @@ -185,8 +183,7 @@ class _AppScaffoldState extends State { builder: (BuildContext context) { return InkWell( onTap: () { - Provider.of(context, listen: false) - .changeCurrentTab(0); + Provider.of(context, listen: false).changeCurrentTab(0); }, child: Container( height: 2.0, @@ -216,12 +213,9 @@ class _AppScaffoldState extends State { AppGlobal.context = context; PharmacyPagesViewModel pagesViewModel = Provider.of(context); - bool isUserNotLogin = - (!Provider.of(context, listen: false).isLogin && - widget.isShowDecPage); + bool isUserNotLogin = (!Provider.of(context, listen: false).isLogin && widget.isShowDecPage); return Scaffold( - backgroundColor: - widget.backgroundColor ?? CustomColors.appBackgroudGrey2Color, + backgroundColor: widget.backgroundColor ?? CustomColors.appBackgroudGrey2Color, // appBar: widget.isShowPharmacyAppbar // ? pharmacyAppbar() @@ -254,8 +248,7 @@ class _AppScaffoldState extends State { isPharmacy: widget.isPharmacy, showPharmacyCart: widget.showPharmacyCart, isOfferPackages: widget.isOfferPackages, - showOfferPackagesCart: - widget.showOfferPackagesCart, + showOfferPackagesCart: widget.showOfferPackagesCart, isShowDecPage: widget.isShowDecPage, backButtonTab: widget.backButtonTab, ) @@ -294,10 +287,7 @@ class _AppScaffoldState extends State { widget.changeCurrentTab(value); } else { Navigator.pushAndRemoveUntil( - locator().navigatorKey.currentContext, - MaterialPageRoute( - builder: (context) => LandingPagePharmacy(currentTab: value)), - (Route r) => false); + locator().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: value)), (Route r) => false); } } @@ -307,9 +297,7 @@ class _AppScaffoldState extends State { try { String barcode = result; GifLoaderDialogUtils.showMyDialog(context); - await BaseAppClient() - .getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", - onSuccess: (dynamic response, int statusCode) { + await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", onSuccess: (dynamic response, int statusCode) { print(response); var product = PharmacyProduct.fromJson(response["products"][0]); GifLoaderDialogUtils.hideDialog(context); @@ -319,8 +307,7 @@ class _AppScaffoldState extends State { AppToast.showErrorToast(message: "Product not found"); }); } catch (apiEx) { - AppToast.showErrorToast( - message: "Something went wrong, please try again"); + AppToast.showErrorToast(message: "Something went wrong, please try again"); } } catch (barcodeEx) {} } @@ -330,10 +317,7 @@ class _AppScaffoldState extends State { } buildBodyWidget(context) { - return Stack(children: [ - widget.body, - widget.isHelp == true ? RobotIcon() : Container() - ]); + return Stack(children: [widget.body, widget.isHelp == true ? RobotIcon() : Container()]); } } @@ -347,16 +331,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { final List appBarIcons; Function onTap; - NewAppBarWidget( - {Key key, - this.showTitle = false, - this.showDropDown = false, - this.title = "", - this.dropDownList, - this.appBarIcons, - this.dropdownIndexValue, - this.dropDownIndexChange, - this.onTap}) + NewAppBarWidget({Key key, this.showTitle = false, this.showDropDown = false, this.title = "", this.dropDownList, this.appBarIcons, this.dropdownIndexValue, this.dropDownIndexChange, this.onTap}) : super(key: key); @override @@ -381,13 +356,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { title, maxLines: 1, style: TextStyle( - fontSize: 24, - fontFamily: - (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - fontWeight: FontWeight.w700, - color: Color(0xff2B353E), - letterSpacing: -1.44, - height: 35 / 24), + fontSize: 24, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24), ), ), if (showDropDown) @@ -399,8 +368,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { alignedDropdown: true, child: DropdownButton( iconEnabledColor: CustomColors.grey2, - style: TextStyle( - color: CustomColors.lightGreyColor, fontSize: 12), + style: TextStyle(color: CustomColors.lightGreyColor, fontSize: 12), dropdownColor: CustomColors.lightGreyColor, value: dropdownIndexValue, items: [ @@ -411,9 +379,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { dropDownList[i], style: TextStyle( fontSize: 12, - fontFamily: (projectViewModel.isArabic - ? 'Cairo' - : 'Poppins'), + fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w600, color: Color(0xff2B2E31), letterSpacing: -.48, @@ -455,8 +421,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { } class AppBarWidget extends StatefulWidget with PreferredSizeWidget { - final AuthenticatedUserObject authenticatedUserObject = - locator(); + final AuthenticatedUserObject authenticatedUserObject = locator(); final String appBarTitle; final bool showHomeAppBarIcon; @@ -509,22 +474,12 @@ class AppBarWidgetState extends State { return AppBar( elevation: 0, - backgroundColor: widget.isPharmacy - ? Colors.green - : Theme.of(context).appBarTheme.color, + backgroundColor: widget.isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, textTheme: TextTheme( - headline6: TextStyle( - color: Theme.of(context).textTheme.headline1.color, - fontWeight: FontWeight.bold), + headline6: TextStyle(color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold), ), - title: Text( - widget.authenticatedUserObject.isLogin || !widget.isShowDecPage - ? widget.appBarTitle.toUpperCase() - : TranslationBase.of(context).serviceInformationTitle, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Theme.of(context).textTheme.headline1.color, - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), + title: Text(widget.authenticatedUserObject.isLogin || !widget.isShowDecPage ? widget.appBarTitle.toUpperCase() : TranslationBase.of(context).serviceInformationTitle, + style: TextStyle(fontWeight: FontWeight.bold, color: Theme.of(context).textTheme.headline1.color, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), leading: Builder( builder: (BuildContext context) { return ArrowBack( @@ -538,8 +493,7 @@ class AppBarWidgetState extends State { ? IconButton( icon: Badge( badgeContent: Text( - orderPreviewViewModel.cartResponse.quantityCount - .toString(), + orderPreviewViewModel.cartResponse.quantityCount.toString(), style: TextStyle(color: Colors.white), ), child: Icon(Icons.shopping_cart)), @@ -554,10 +508,7 @@ class AppBarWidgetState extends State { position: BadgePosition.topStart(top: -15, start: -10), badgeContent: Text( _badgeText, - style: TextStyle( - fontSize: 9, - color: Colors.white, - fontWeight: FontWeight.normal), + style: TextStyle(fontSize: 9, color: Colors.white, fontWeight: FontWeight.normal), ), child: Icon(Icons.shopping_cart)), color: Colors.white, @@ -571,10 +522,7 @@ class AppBarWidgetState extends State { icon: Icon(FontAwesomeIcons.home), color: Colors.white, onPressed: () { - Navigator.pushAndRemoveUntil( - context, - MaterialPageRoute(builder: (context) => LandingPage()), - (Route r) => false); + Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route r) => false); // Cart Click Event if (_onCartClick != null) _onCartClick(); From 9d9377d59f5cf5dfeb275d50f82e5ddbbe8fbd4e Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Tue, 30 Nov 2021 11:34:46 +0300 Subject: [PATCH 10/39] fix issues --- assets/images/pharmacy/call.svg | 7 +++++++ assets/images/pharmacy/instagram.png | Bin 0 -> 7247 bytes assets/images/pharmacy/location.svg | 3 +++ assets/images/pharmacy/whatsapp.svg | 3 +++ lib/pages/pharmacy/pharmacyContacts.dart | 0 5 files changed, 13 insertions(+) create mode 100644 assets/images/pharmacy/call.svg create mode 100644 assets/images/pharmacy/instagram.png create mode 100644 assets/images/pharmacy/location.svg create mode 100644 assets/images/pharmacy/whatsapp.svg create mode 100644 lib/pages/pharmacy/pharmacyContacts.dart diff --git a/assets/images/pharmacy/call.svg b/assets/images/pharmacy/call.svg new file mode 100644 index 00000000..677d4123 --- /dev/null +++ b/assets/images/pharmacy/call.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/images/pharmacy/instagram.png b/assets/images/pharmacy/instagram.png new file mode 100644 index 0000000000000000000000000000000000000000..a03f47bd3abe5e851905e98ab075f741443aa9ac GIT binary patch literal 7247 zcmX9@cT^MI(+&_YG?Cs3f`Et=k*1I$MZf|oAVuj&?;R3C1R>Hzq$$N8s7NnLhtPYI z-bn%o(nAq~3Gn4T-=1^#p1XhS%zfs$v(L=NJTcH^WfEWl006A|dfLyZGy1;)VxZnT zptb|l3FxP(Zw#VdNRY!@>YCA8&)g3HpsW0E(EN?u(WgG-_t!D=H}Z1y53==r1qccX zl5_EN^Ru`0ekJGS>-1??LjV8}9MspoXB?chlO2-9HCcbsVi<68RMOfidc9ZjEv;Cd zcDb0SkKrS`vSjTtRi7}+Jgk6U{jGZJYD4Evo=>9>B41K678{c{P5;X+@5+iVH$5*G zdj>zdqcx)N?g&{oXvAW2{PwsJMNEt{$dwPN2b0cxsTwTwe9RNBT|hg#Yq1P&lR#Hl*5@*W z2ekC_Cb6}b+U=K|hU;?`?4EJGjeDCtFEf&;U&i^1*Jx5hl;zEA$dJQ$1uCc8m5ozM zv1jJk|D9$$n&~~o;LMZEM`K^T7j#qMxfr%`t|Oj45p977T4*0Yjr(vmzgZF4gp_HY z?J8Ngw)UgMA72e?bU~sa>FYG~6A)N?A$cT9`$i&r<6l1eEXEx;y))*c390XF8D2G^ zM@ec`VdXlj<(9MRcth`|_79;fw!Es;5o#N00VoonWqMm8NI;^77&~vY6iWIE-Dlzu zy;?vt+JDwF3XcP}yD@TK#PDOv?auiF#PaHgx{g$?(|;~Hg(o+Y$N0xcwGsm5WSaZB zniv+aJ5gO&7Y(O-es08-P={eI3-_oH01r zdSd{_${?0nH@Qz`2_u%67`X?nXH2a@&s^9m4yKIEkcA80Loe#_04TGl`2sJyIb^Qv zd^%3qDva^Lk|_t)g)H3Dk9Zejl-4&QSM)dK66rd6)e}TRxqN24TTi&vl7Tj)eKIK~wl%PNj z5laDK&~tNMbP*4SWwl|`W-M7DSx1XVrh#!!S6a0JTO{P=%Li1-OPJs$an21+d5hjF z9h;q(g(GrVNrhWAOKooq(@at4Au5@#9s`OjgvzZ{BByjO-rhBe#yhd2=AmwaK4f6X z;apNxm#hrcA&$n)td6&3r}+Z69YN>tR>QCv{m#2qOO5}U-79|lLjX)>x-@ixAlxqafLTKed_+F7(emW8jvYANHb$)NOPpTU$*P z5=KP`f;YJ`e{m=cpot zChZaXw2ooSnW1;hGAEuz&bVJXC*IH?Dt1;+6Yo`Qi8+sLq)1baFAf*^f16TfWkSkm z^%lzR5C(L>B&6Z#eOY7 zNDSlyXOva2zrj|21JXRd-=t}A&K@tRLX^iJ$Lypb>>hcvPQ=jG=SoNKqr#rbrb3A*lC4CS8I<#?&u)9$7NFl=5~*3$%@9D@vfom(08&p8GknV5yjP|nM*7`C7@24{J<2y{sj(-W169$K<%WvKf+IUcLwsDIqxpA28LC z)I{I)9%cWXF@@6HN}_MSdG)B&+{03{Q7&Q=&}NA2Kgg$-3T6BZ&rii29kwNIH})Rx z;uj0>heMIP=U*zl7oYJ#N;+gc+A?+X*5%zJiv(|YpA)0kUqvV8Cf?%+!j{r8f_30@ z*+|+Q+V9~F#@W5oXUHPm*FBNhdUXGWi`tlRpsdO(n!6sncMd_1?uisOK+f@Q&SAxF zFWt5k9QFtqJcw3;RLz}NXQWj6Y~bgj5QCjF<|oC!cu9%ZL^eV*Jk98nd+||Tz{`B= znW*-A4hMf~22~TDF0(c7@^7LKIz0ni>%Vg>}(C?(wV(518;+q_ZW8|)VvHKOZM2PKo(*wU(1{+=&ARm15=!krV_)rEXp!nvNU$l4;)@=0mO zY*V8kl772Xd3T+Op7JJ_$YdwXSi(XZ(z$v0FE@6>imk@n$npY@iNlxp;n5pmbhycb z2=C!(!aL~-cZmtzHho72Bd+xtUP4X!%iAsD$Vj|#ZE#knHHqP#P7>{N3-}ezJ2R%F zkK0T2uXOy3a0Fgf%z)g82qjS^$agse<)Sb39ReA9+;toDt?TUS(@!IV6zK|~g%a5|s zq3um|cW#pyw*P^yCb=eUcMRQJaE$&s`YqpX*JC`}mU@w7vKhAq$_JB0@;rj{_;`Jv1K zh8v(nmz&M>Uz6E?rjtu3D5jmDkLE>2R1lp{Ry58vn$Di$@KWJ|K)(T3fBUE{X-%9u z@a6y~c9Ek;Tj=iHkeBjzE)iKHVwFcV13uu0^ACikUtHB9CAP-XapwCqTAcC{C#=b= z)-?7q!>sb?jWRPgP3ftu{oNqcguWcXE+7K`3e}+sx}Gl^aQ&|^>aOk+-765tOy-^O zGd{y+7N7BOQs468DV{mYw6-qiMlh*!m+0|0@z2iYQh@3O1@OGU`x5^v^CEF1#_QT+ zdGsJ&oz|$p{~}z8`T^<{pcqHb7BBFwv53@oIguE$8bJ3K!^pd|L@??A@gd3;yGJy# zEvrwyiezn_8C|@%IDh_D%{;0cbo^-^Qv6y4Eluhce4G9oKowgR6UiDlg8CAFGCNY2 zBjr|v9NUMQu;c&|Lz_#y?TxKQ=FdN`97OQZ7eHex7n?&jfWNAlh>TDM#us@U2g0bi z8=`b122e;zg4uXR0Lg>wW*Hs8=&TQ=Mpdc|((Y56)vBB9tw3`roKUbu??4Niyzf2q z(9H%fZc|?{OBIGOf4NcZz5sBfP2q!uAkxMIbUgl{-Ji5isa&ieBz?)#-GSYi07&V= zsFAorSoN(ZL{^S!?NT!X9)|-gcWCq;XrdNA@te^9rIL=;I3W)UT3H zw$zd3S?ED(W}Sxl!@9?!;G%9sy73dSrr@HjLV*i6zjA#23pqSVc2|mQf|-uvYGcGhyVFcY+LQk*ozZdrWRO_a^@&o;5czxs(F~w zMr+M(TrzUAI<}Uo=PXr!d1$~JE~yXs)NO^F*hfY7mOgy2y4g>1#!K$rk)r`_(`y0}gaGSt!3D2SA%W3#rzm4g&LEg05pVu+%htZlwOpl*F6eYi+iQAbAF z2>p=mz3Sven63SI>v?iZu_t1+Y`szgUr^%}%+Q?_k-7V~I$loFzfVjv{bsv+d6#=( z`-HA27rZ;|N`}(d`1tgwKn~^IVo=l4`rwIT3qfX#bU4E6#inTY%or5@hBJ2yOi`ls z7Ur0uLyG@$?|7BeZu!vm-^|Y|rHo(AI3FP1EKYvRxp>n*VD0?rWP0oF^yaQ!#G@WM z2WlY`VtAz*o$=tD!TLYuuSOx*V3U)@9$k0#g8noZhO(-bN*m)&@2blMGuQ`N&&!Vw z*2XriOaEg5bB74GarBfD9(q)5ZE8b(WbO@`V9^nY$Xd7dN zmhec@$0Sfr*tP$82?Im;<$ixuBF9N?qR1-BCoKt_0afo$qsH&o{OR;7rcwSnyI~Vx3`Xk33&!7hU2ARqH5KpGfB+}A=|=_6wuWp-X+Z#Eq&;>tC~%DF~K_G z`<6qqy)UPCo|w~gu=((JfV2a3&)y_4c_eZ&!?oj6O{=D+=`(KxHZqIy>D_F~k{}7M z@B^#45eP`~bj>)W6QKn8k=Z++%XS^9GqZkFsQ2Whd_5uM{smrK&9(U#wPE*2BUD+y z`Pf6bEGe*#8Gt7<|L?m3nP}w0q82b3AMNu>TtngJ;3~7mngYPYYnsG>6J>3)Ir_az z`(Jm7qt|+i87Ur9>sAlxqq{DR9$#kzA$!o4ynW69r)p1l1TOagReQ!o=&$9bq57IR{hwH zng%@#_lWFR8>Nb>l~eV`Z;nD(Cf12lS{$eZ#XQj=!N(+-_7V)yP$%YJHt;B3|B~>! zmqH}jtt~YIWL60@O8o^gwPXhC%0P@RSNSndE9LekXcb1FdR`F_v^?o*rBcM_sZMu0 zP`d>`FT3CQg*9ozf{s3XNh^*qJ>(|l(g&ES{-V@lXd7?*X2*c)(6&-mLkd7!TUzK8 zEl&k&&pi8_Rgk3mXfi!ROEw^~;FJJ?pk9R&V&C*tpz zxfQxKDN&R%aUn+P5dW2|vqbdhD)ZR+sn`Q|^!#3e*5@6vBQzMz?zLy;1fco@&zfU{ z_GY%hNMJq%^TMLjqX2vA_!b7KV4Qy>=uIlzA#{1~%~tI79%<@j+E?JnLgXFaZCPbC zWm&a^TS}XFrJnclRu%7e0CS3Y5Tic_^AHi?PWlM;s|p&Ami}lm6(oE? zi5E+b-6OJARo2<MKOX`UbN2n)%ca$rC+OsP(X7(+}WK%?AJDjN;HqlOKhyp>(cP|grB?YZ&`Ol=%w7Uh28R$0y6fxKt^+(-SC?K#?YUdu{cyiL>lRLJsMYCEQMf` zQmAHeYf&tz68my(6gRc{)%l?6=Rl2VRvGzr%=kWOzgsPN@u>jR<;&)dKrVRu3-fw< zZ7R5-Nvg)hYIe3wGVKfuojFb7lU(J%j&t<5lZ1ZQI$`RtSQqg~VjIA^W`cgps~6}I znxr%4Fk5w>Hp+C31)D#kT&kb$*;A)QgtW_tRdk5sP|N_hNZqc_HIjM@LA_KZ@Nu!c zyb0x5t7$#?_&}?nSrUt*1=#G3@@jhLQ`4*D^Cj1K)}t-s79}G060_b`YV*ChEo|yJ z5$E&_cOanBMMsa*cF+1|R?wHOMMSW8DM~8r4foHA6g$?v*n2>=))2~Rmd*k~(tU%z zH**RCp~~A?eQmu6THpuh4;zdy1fRH*BlCZaoW91TGffO05hZ@`X+CJMzCvCIVM+UQ zwt`r%)-+>Ha^<2H;`&Q}sdo6~rsk46G}Hfb+vh$60M3>U>;f|{y4NbKI!u2(7c97w zc*8{w1wwr!PG>v+*$Udrnf<^?1Nf6XaH2U>%;#p&OznH8q1Z7|Db}_T%{ntTW{VD7bKxc+>CWGquJ<;Y5jk0`V1Hv5m1pVRG*89_vv^S%u&5yhW8_AW`NB} z-EXqGU8(UZ{wfKAQSX(!34y$jJ@Z!)HG!K7T2>KOE3 zN_sp7Eo(o3lO6B;T$uaJ1MknFHkH(17T#h4YKyJXu^(8Tkyv9(o^|v;*{I-ckn2_A z^GLb^*L?v)y}Bn}8uuQ8;bf@_Pb7o`51JA*z%2Kzt#SzQS#5TREI`BD_zGB{K;Ulw zTai~4Yy1w+i{9`7NURLAz^Sd8Dg#;bbc+ClVKu}GVEOoI2y%HPWjQfGR6$2sq0db5 zp2_hu{|_8|zv0+>nz39`1QlrxRlQ=dNru9}&bcUCOl3)F&E|8dD + + diff --git a/assets/images/pharmacy/whatsapp.svg b/assets/images/pharmacy/whatsapp.svg new file mode 100644 index 00000000..ee18370c --- /dev/null +++ b/assets/images/pharmacy/whatsapp.svg @@ -0,0 +1,3 @@ + + + diff --git a/lib/pages/pharmacy/pharmacyContacts.dart b/lib/pages/pharmacy/pharmacyContacts.dart new file mode 100644 index 00000000..e69de29b From bc9fc5a878fe78a57bad4fc23048c0588b394cb9 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Tue, 30 Nov 2021 11:35:06 +0300 Subject: [PATCH 11/39] fix issue --- lib/config/localized_values.dart | 6 +- .../PharmacyAddressesViewModel.dart | 4 +- lib/pages/final_products_page.dart | 68 +- lib/pages/pharmacies/compare-list.dart | 2 +- lib/pages/pharmacies/compare.dart | 585 +++++++++--------- .../pharmacies/screens/lakum-main-page.dart | 12 +- .../product-name-and-price.dart | 48 +- lib/pages/pharmacies/search_brands_page.dart | 14 - lib/pages/pharmacy/order/ProductReview.dart | 2 + .../pharmacyAddresses/PharmacyAddresses.dart | 35 +- lib/pages/pharmacy/pharmacyContacts.dart | 267 ++++++++ lib/pages/pharmacy/profile/profile.dart | 3 +- lib/pages/search_products_page.dart | 16 - lib/uitl/translations_delegate_base.dart | 8 + lib/widgets/pharmacy/product_tile.dart | 2 +- 15 files changed, 713 insertions(+), 359 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index aa9c5b16..f578c465 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -50,7 +50,7 @@ const Map localizedValues = { 'searchByDocText': {'en': 'Type the name of the doctor to help you find him', 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه'}, 'enterDocName': {'en': 'Enter Doctor name', 'ar': 'أدخل إسم الطبيب'}, 'search': {'en': 'Search', 'ar': 'بحث'}, - 'noResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج'}, + 'noResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج الرجاء تغيير لغة البحث'}, 'pleaseEnterProductName': {'en': 'Please Enter Product Name', 'ar': 'ادخل اسم المنتج'}, 'bookNow': {'en': 'BOOK NOW', 'ar': 'احجز الآن'}, 'docInfo': {'en': 'Doctor Information', 'ar': 'معلومات الطبيب'}, @@ -507,7 +507,11 @@ const Map localizedValues = { "reachUs": {"en": "Reach Us", "ar": "الوصول لنا"}, "ourLocations": {"en": "Our Locations", "ar": "مواقعنا"}, "edit": {"en": "Edit", "ar": "تعديل"}, + "whatsApp": {"en": "Whats App", "ar": " واتس اب"}, + "phone": {"en": "Phone", "ar": " موبايل"}, "delete": {"en": "Delete", "ar": " حذف"}, + "deleteAddress": {"en": "Are you sure want to delete", "ar": " هل انت متأكد تريد حذف هذا العنوان"}, + "deletedAddres": {"en": "Address has been deleted", "ar": " تم حذف العنوان"}, "addAddress": {"en": "ADD A NEW ADDRESS", "ar": " اضافة عنوان جديد"}, "addNewAddress": {"en": "Add New Address", "ar": " اضافة عنوان جديد"}, "order": {"en": "My Order", "ar": " طلباتي"}, diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart index 72342b56..dae79ac1 100644 --- a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -99,9 +99,9 @@ class PharmacyAddressesViewModel extends BaseViewModel { } - Future deleteAddresses(AddressInfo sendingAddress) async { + Future deleteAddresses(AddressInfo address) async { setState(ViewState.Busy); - await _pharmacyAddressService.deleteCustomerAddress(sendingAddress); + await _pharmacyAddressService.deleteCustomerAddress(address); if (_pharmacyAddressService.hasError) { error = _pharmacyAddressService.error; setState(ViewState.Error); diff --git a/lib/pages/final_products_page.dart b/lib/pages/final_products_page.dart index 253d7c08..41fa74f0 100644 --- a/lib/pages/final_products_page.dart +++ b/lib/pages/final_products_page.dart @@ -216,20 +216,37 @@ class _FinalProductsPageState extends State { Container( margin: EdgeInsets.fromLTRB(0, 16, 0, 0), alignment: Alignment.center, - child: Image.network( - model.finalProducts[index].images.isNotEmpty - ? model.finalProducts[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, - ), + child: (model.finalProducts[index].images != null && + model.finalProducts[index].images.length > 0) + ? Image.network( + model.finalProducts[index].images[0].src, + fit: BoxFit.cover, + height: 80, + width: 80, + + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + width: 80, + ), +// Image.network( +// model.finalProducts[index].images.isNotEmpty +// ? model.finalProducts[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.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 2.8 : 0, + width: model.finalProducts[index].rxMessage != null ? double.infinity : 0, + //MediaQuery.of(context).size.width / 2.8 : 0, padding: EdgeInsets.all(4), decoration: BoxDecoration( color: Color(0xffb23838), - borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), + // borderRadius: BorderRadius.only(topLeft: Radius.circular(6) + // ), ), child: model.finalProducts[index].rxMessage != null ? Texts( @@ -374,33 +391,48 @@ class _FinalProductsPageState extends State { ), ), Container( - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + margin: EdgeInsets.fromLTRB(0, 0, 0, 8), alignment: Alignment.center, - child: Image.network( - model.finalProducts[index].images.isNotEmpty - ? model.finalProducts[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, + child:(model.finalProducts[index].images != null && + model.finalProducts[index].images.length > 0) + ? Image.network( + model.finalProducts[index].images[0].src, + fit: BoxFit.cover, height: 80, + width: 80, + + ) + : Image.asset( + "assets/images/no_image.png", + fit: BoxFit.cover, + height: 80, + width: 80, ), +// Image.network( +// model.finalProducts[index].images.isNotEmpty +// ? model.finalProducts[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.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5.3 : 0, + width: model.finalProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 4.3 : 0, padding: EdgeInsets.all(4), decoration: BoxDecoration( color: Color(0xffb23838), - borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), + //borderRadius: BorderRadius.only(topLeft: Radius.circular(5)), ), child:model.finalProducts[index].rxMessage != null ? Texts( projectProvider.isArabic ? model.finalProducts[index].rxMessagen : model.finalProducts[index].rxMessage, color: Colors.white, regular: true, - fontSize: 10, + fontSize: 8, fontWeight: FontWeight.w600, ) : Texts(""), diff --git a/lib/pages/pharmacies/compare-list.dart b/lib/pages/pharmacies/compare-list.dart index afa5382f..0b1aa73d 100644 --- a/lib/pages/pharmacies/compare-list.dart +++ b/lib/pages/pharmacies/compare-list.dart @@ -16,7 +16,7 @@ class CompareList with ChangeNotifier { ); } else { for (int i = 0; i < _product.length; i++) { - if (_product.length <= 4 && _product[i].id != data.id) { + if (_product.length < 4 && _product[i].id != data.id) { _product.add(data); AppToast.showSuccessToast(message:TranslationBase.of(context).addToCompareMsg // 'You have added a product to the Compare list' diff --git a/lib/pages/pharmacies/compare.dart b/lib/pages/pharmacies/compare.dart index f458304f..34b21001 100644 --- a/lib/pages/pharmacies/compare.dart +++ b/lib/pages/pharmacies/compare.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -113,6 +114,7 @@ class slideDetail extends StatefulWidget { class _slideDetailState extends State { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return ListView.builder( scrollDirection: Axis.horizontal, itemCount: widget.data.length, @@ -122,7 +124,7 @@ class _slideDetailState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - height: 750, + height: 760, width: 150, margin: EdgeInsets.symmetric(horizontal: 10.0), decoration: BoxDecoration( @@ -171,10 +173,10 @@ class _slideDetailState extends State { ), Container( margin: EdgeInsets.all(5), - child: Align( + child:Align( alignment: Alignment.topLeft, child: RichText( - text: languageID == "ar"? TextSpan( + text: projectViewModel.isArabic ? TextSpan( text: widget.data[index].namen, style: TextStyle( fontWeight: FontWeight.bold, @@ -193,8 +195,9 @@ class _slideDetailState extends State { ), Container( margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, child: RichText( text: TextSpan( text: "SAR ${widget.data[index].price.toString()}", @@ -204,8 +207,20 @@ class _slideDetailState extends State { fontWeight: FontWeight.bold), ), ), + ): + Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: "SAR ${widget.data[index].price.toString()}", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ), ), ), + ), Padding( padding: EdgeInsets.only(top: 8.0), child: Container( @@ -216,58 +231,61 @@ class _slideDetailState extends State { ), Container( margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, child: RichText( - text: languageID == "ar"? TextSpan( + text: TextSpan( text: widget.data[index].specifications != null ? - widget.data[index].specifications[0].nameN : -// "No data", - TranslationBase.of(context).no_data, + widget.data[index].specifications[0].nameN :"", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), ) - :TextSpan( + ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( text: widget.data[index].specifications != null ? - widget.data[index].specifications[0].name : -// "No data", - TranslationBase.of(context).no_data, + widget.data[index].specifications[0].name :"", style: TextStyle( fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13), - ), + ) ), - ), + ) ), Container( margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, child: RichText( - text: languageID == "ar"? TextSpan( + text:TextSpan( text: widget.data[index].specifications != null ? - widget.data[index].specifications[0].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, + widget.data[index].specifications[0].defaultValuen:"", style: TextStyle( color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), - ):TextSpan( + ) + ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( text: widget.data[index].specifications != null ? - widget.data[index].specifications[0].defaultValue : -// "No data", - TranslationBase.of(context).no_data, + widget.data[index].specifications[0].defaultValue:"", style: TextStyle( color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold), - ), + ) ), - ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -278,58 +296,62 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[1].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[1].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[1].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[1].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[1].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -340,58 +362,62 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[2].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[2].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[2].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[2].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[2].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[2].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[2].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[2].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -402,58 +428,62 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[3].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[3].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[3].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[3].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[3].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -464,58 +494,62 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[4].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[4].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[4].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[4].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[4].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[4].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[4].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[4].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), Padding( padding: EdgeInsets.only(top: 8.0), @@ -526,67 +560,64 @@ class _slideDetailState extends State { ), ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[5].nameN : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[5].name : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: 13), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[5].nameN :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) ), - ), - ), + ): Align( + alignment: Alignment.topLeft, + child: RichText( + text: TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[5].name :"", + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 13), + ) + ), + ) ), Container( - margin: EdgeInsets.all(5), - child: Align( - alignment: Alignment.topLeft, - child: RichText( - text: languageID == "ar"? TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[5].defaultValuen : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), - ):TextSpan( - text: widget.data[index].specifications != null ? - widget.data[index].specifications[5].defaultValue : -// "No data", - TranslationBase.of(context).no_data, - style: TextStyle( - color: Colors.black54, - fontSize: 15, - fontWeight: FontWeight.bold), + margin: EdgeInsets.all(5), + child: projectViewModel.isArabic ? + Align( + alignment: Alignment.topRight, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[5].defaultValuen:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) ), - ), - ), - ), - Padding( - padding: EdgeInsets.only(top: 8.0), - child: Container( - height: 1.0, - width: 300.0, - color: Colors.grey, - ), + ):Align( + alignment: Alignment.topLeft, + child: RichText( + text:TextSpan( + text: widget.data[index].specifications != null ? + widget.data[index].specifications[5].defaultValue:"", + style: TextStyle( + color: Colors.black54, + fontSize: 15, + fontWeight: FontWeight.bold), + ) + ), + ) ), + ], ), ), diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index 20b65c55..681be5a5 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -354,12 +354,12 @@ class LakumHomeButtons extends StatelessWidget { children: [ Expanded( child: InkWell( - onTap: () { - print("Account activate click"); - Navigator.push( - context, FadePage(page: LakumActivationVidaPage())) - .then((result) => {model.getLacumGroupData()}); - }, +// onTap: () { +// print("Account activate click"); +// Navigator.push( +// context, FadePage(page: LakumActivationVidaPage())) +// .then((result) => {model.getLacumGroupData()}); +// }, child: Container( padding: EdgeInsets.symmetric(horizontal: 8), decoration: BoxDecoration( diff --git a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart index 3a6f5c8d..a71a5a1e 100644 --- a/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart +++ b/lib/pages/pharmacies/screens/product-details/product-name-and-price.dart @@ -126,15 +126,45 @@ class _ProductNameAndPriceState extends State { widget.stockAvailability != null && !widget.isStockAvailable && widget.customerId != null - ? IconButton( - iconSize: 25, - icon: Icon(Icons.notifications_active), - color: new Color(0xff2E303A), - onPressed: () { - widget.notifyMeWhenAvailable( - context, widget.item.id); - }, - ) + ? Container( + child: Row( + children: [ + IconButton( + iconSize: 25, + icon: Icon(Icons.notifications_active), + color: new Color(0xff2E303A), + onPressed: () { + widget.notifyMeWhenAvailable( + context, widget.item.id); + }, + ), + IconButton( + icon: Icon(!widget.isInWishList + ? Icons.favorite_border + : Icons.favorite), + color: !widget.isInWishList + ? Color(0xff2E303A) + : Color(0xffD02127), + onPressed: () async { + { + if (widget.customerId != null) { + if (!widget.isInWishList) { + await widget + .addToWishlistFunction(widget.item.id); + } else { + await widget.deleteFromWishlistFunction( + widget.item.id); + } + } else { + return; + } + setState(() {}); + } + }, + ) + ], + ), + ) : IconButton( icon: Icon(!widget.isInWishList ? Icons.favorite_border diff --git a/lib/pages/pharmacies/search_brands_page.dart b/lib/pages/pharmacies/search_brands_page.dart index 7ffe8d26..c452f82f 100644 --- a/lib/pages/pharmacies/search_brands_page.dart +++ b/lib/pages/pharmacies/search_brands_page.dart @@ -54,20 +54,6 @@ class _SearchBrandsPageState extends State { fontSize: 19.0, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, - inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp(r'([A-Za-z0-9 a space])') -// ("[\u0621-\u064a-\ ]") - ) - ], - validator: (value) { - RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); - if (value.isEmpty) { - TranslationBase.of(context).pleaseEnterProductName; - }else if (!regExp.hasMatch(value)){ - AppToast.showErrorToast(message: TranslationBase.of(context).noArabicLetters); - } - return null; - }, onSaved: (value) { //searchMedicine(model, context); }, diff --git a/lib/pages/pharmacy/order/ProductReview.dart b/lib/pages/pharmacy/order/ProductReview.dart index bb680864..04c67079 100644 --- a/lib/pages/pharmacy/order/ProductReview.dart +++ b/lib/pages/pharmacy/order/ProductReview.dart @@ -34,6 +34,8 @@ class _ProductReviewPageState extends State { appBarTitle: TranslationBase.of(context).writeReview, isShowAppBar: true, isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, body: Container( color: Colors.white, child: !finishReview ? SingleChildScrollView( diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index 6a423b82..39b5e4ea 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -175,7 +175,7 @@ class _PharmacyAddressesState extends State { } } -class AddressItemWidget extends StatelessWidget { +class AddressItemWidget extends StatefulWidget { final PharmacyAddressesViewModel model; final AddressInfo address; final Function selectAddress; @@ -184,6 +184,11 @@ class AddressItemWidget extends StatelessWidget { AddressItemWidget(this.model, this.address, this.selectAddress, this.isSelected, this.onTabEditAddress); + @override + _AddressItemWidgetState createState() => _AddressItemWidgetState(); +} + +class _AddressItemWidgetState extends State { @override Widget build(BuildContext context) { return Container( @@ -199,14 +204,14 @@ class AddressItemWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ InkWell( - onTap: selectAddress, + onTap: widget.selectAddress, child: Container( margin: EdgeInsets.only(left: 16, right: 16), child: Padding( padding: const EdgeInsets.all(5.0), child: Container( decoration: new BoxDecoration( - color: !isSelected ? Colors.white : Colors.green, + color: !widget.isSelected ? Colors.white : Colors.green, shape: BoxShape.circle, border: Border.all(color: Colors.grey, style: BorderStyle.solid, width: 1.0), ), @@ -214,7 +219,7 @@ class AddressItemWidget extends StatelessWidget { padding: const EdgeInsets.all(0.0), child: Icon( Icons.check, - color: isSelected ? Colors.white : Colors.transparent, + color: widget.isSelected ? Colors.white : Colors.transparent, size: 25, ), ), @@ -234,7 +239,7 @@ class AddressItemWidget extends StatelessWidget { Padding( padding: const EdgeInsets.symmetric(vertical: 0), child: Texts( - "${address.firstName} ${address.lastName}", + "${widget.address.firstName} ${widget.address.lastName}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black, @@ -243,7 +248,7 @@ class AddressItemWidget extends StatelessWidget { Padding( padding: const EdgeInsets.symmetric(vertical: 4), child: Texts( - "${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}", + "${widget.address.address1} ${widget.address.address2} ${widget.address.address2},, ${widget.address.city}, ${widget.address.country} ${widget.address.zipPostalCode}", fontSize: 12, fontWeight: FontWeight.normal, color: Colors.grey.shade500, @@ -260,7 +265,7 @@ class AddressItemWidget extends StatelessWidget { ), ), Texts( - "${address.phoneNumber}", + "${widget.address.phoneNumber}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.grey, @@ -281,7 +286,7 @@ class AddressItemWidget extends StatelessWidget { borderColor: Colors.transparent, textColor: Color(0x990000FF), handler: () { - onTabEditAddress(address); + widget.onTabEditAddress(widget.address); }, icon: Icon( Icons.edit, @@ -306,19 +311,23 @@ class AddressItemWidget extends StatelessWidget { textColor: Color(0x99FF0000), handler: () { ConfirmDialog dialog = new ConfirmDialog( - context: context, - title: "Are you sure want to delete", - confirmMessage: "${address.address1} ${address.address2}", + // context: context, + title: TranslationBase.of(context).deleteAddress, + //"Are you sure want to delete", + confirmMessage: "${widget.address.address1} ${widget.address.address2}", okText: TranslationBase.of(context).delete, cancelText: TranslationBase.of(context).cancel_nocaps, okFunction: () => { - model.deleteAddresses(address).then((_) { + widget.model.deleteAddresses(widget.address).then((_) { ConfirmDialog.closeAlertDialog(context); - AppToast.showErrorToast(message: "Address has been deleted"); + AppToast.showErrorToast(message: TranslationBase.of(context).deletedAddress, + // "Address has been deleted" + ); }) }, cancelFunction: () => {}); dialog.showAlertDialog(context); + setState(() {}); }, icon: Icon( Icons.delete, diff --git a/lib/pages/pharmacy/pharmacyContacts.dart b/lib/pages/pharmacy/pharmacyContacts.dart index e69de29b..03a6c29d 100644 --- a/lib/pages/pharmacy/pharmacyContacts.dart +++ b/lib/pages/pharmacy/pharmacyContacts.dart @@ -0,0 +1,267 @@ + +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:maps_launcher/maps_launcher.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'dart:io' show Platform; + + + +class pharmacyContactsPage extends StatefulWidget { + + + + @override + _pharmacyContactsPageState createState() => _pharmacyContactsPageState(); +} + +class _pharmacyContactsPageState extends State { + + + + @override + Widget build(BuildContext context) { + final latitude="24.704016"; + final longitude="46.676691"; + final phone="+966112833400"; + final whatsApp="+699558434444"; + final whatappURL_android="whatsapp://send?phone="+whatsApp; + final whatappURL_ios="https://wa.me/$whatsApp"; + + return AppScaffold( + appBarTitle: TranslationBase.of(context).contactUs, + isShowAppBar: true, + isShowDecPage: false, + isPharmacy: true, + showPharmacyCart: false, + showHomeAppBarIcon: false, + isMainPharmacyPages: true, + body:Column( + children: [ + Card( + elevation: 2, + shape: RoundedRectangleBorder( + side: BorderSide( + color: Colors.grey[300], width: 2), + borderRadius: BorderRadius.circular(10), + ), + margin: EdgeInsets.symmetric( + horizontal: 8, + vertical: 8, + ), + child: Container( + margin: EdgeInsets.all(10), + padding:EdgeInsets.fromLTRB(5,15,5,15), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(15),), + ), + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text("Saturday - Wednesday 8:00 AM - 10 PM, Thursday 8:00 AM- 8:00 PM, Friday 2:00 PM - -8:00 PM", + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing:-0.68 + ) + ), + ), + ), + SizedBox( + height: 35, + ), + Row( + children: [ + InkWell( + onTap: () { + launch("tel://"+phone); + }, + child: SvgPicture.asset( + 'assets/images/pharmacy/call.svg', + width: 20, + height: 20, + ),), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context).phone, + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing:-0.68 + ) + ), + SizedBox( + width: 30, + ), + Text( + "+966 " + " -11- 2833400", + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing:-0.68 + ) + ), + ], + ), + SizedBox( + height: 30, + ), + Row( + children: [ + InkWell( + onTap: () { + // launch('whatsapp://send?phone='+whatsApp); + openWhatsApp(); + }, + child: SvgPicture.asset( + 'assets/images/pharmacy/whatsapp.svg', + width: 20, + height: 20, + ), + ), + SizedBox( + width: 20, + ), + Text( + TranslationBase.of(context).whatsApp, + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing:-0.68 + ) + ), + SizedBox( + width: 30, + ), + Text( + "+966 " + " 558434444", + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing:-0.68 + ) + ), + ], + ), + SizedBox( + height: 30, + ), + Padding( + padding: const EdgeInsets.all(5.0), + child: Row( + children: [ + InkWell( + onTap: () { + MapsLauncher.launchCoordinates(double.parse(latitude), + double.parse(longitude)); + }, + child: SvgPicture.asset( + 'assets/images/pharmacy/location.svg', + width: 20, + height: 20, + ), + ), + SizedBox( + width: 20, + ), + Expanded( + child: Text( + "P.O.BOX: 91877 - Riyadh 11643, King Fahad Road - Olaya - Kingdom of Saudi Arabia", + style: TextStyle( + color: Colors.grey[700], + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing:-0.68 + ) + ), + ), + ], + ), + ), + SizedBox( + height: 50, + ), + Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + IconButton( + icon: new Image.asset('assets/images/new-design/facebook.png'), + tooltip: 'facebook', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://facebook.com/HMG"); + // launch("https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn"); + }); + }, + ), + IconButton( + icon: new Image.asset('assets/images/new-design/twitter.png'), + tooltip: 'Twitter', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://twitter.com/HMG"); + }); + }, + ), + IconButton( + icon: new Image.asset('assets/images/pharmacy/instagram.png'), + tooltip: 'Instagram', + iconSize: 48, + onPressed: () { + setState(() { + launch("https://instagram.com/HMG"); + }); + }, + ), + + ] + ), + ) + ], + ), + ), + ), + ], + ), + ); + + } + + openWhatsApp() async{ + // bool Platform.isIOS = Theme.of(context).platform == TargetPlatform.iOS; + var whatsapp ="+699558434444"; + var whatsappURL_android = "whatsapp://send?phone="+whatsapp; + var whatappURL_ios ="https://wa.me/$whatsapp"; + if(Platform.isIOS){ + // for iOS phone only + if( await canLaunch(whatappURL_ios)){ + await launch(whatappURL_ios, forceSafariVC: false); + }else{ + } + + }else{ + // android + if( await canLaunch(whatsappURL_android)){ + await launch(whatsappURL_android); + }else{ + } + } + + } +} diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 72fa43dc..25c6e7d2 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-con import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyContacts.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -548,7 +549,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push(context, FadePage(page: LiveChatPage())); + Navigator.push(context, FadePage(page: pharmacyContactsPage())); }, child: Row( children: [ diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 8ec9f014..375265fc 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -61,22 +61,6 @@ class _SearchProductsPageState extends State { fontSize: 14.5, prefixIcon: Icon(Icons.search), inputAction: TextInputAction.search, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(r'([A-Za-z0-9 a space])')) - ], - validator: (value) { - RegExp regExp = RegExp(r'([A-Za-z0-9 a space])'); - if (value.isEmpty) { - TranslationBase.of(context) - .pleaseEnterProductName; - } else if (!regExp.hasMatch(value)) { - AppToast.showErrorToast( - message: TranslationBase.of(context) - .noArabicLetters); - } - return null; - }, onSaved: (value) { //searchMedicine(model, context); }, diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 9484c69d..635dd5ed 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -995,10 +995,18 @@ class TranslationBase { String get edit => localizedValues['edit'][locale.languageCode]; + String get whatsApp => localizedValues['whatsApp'][locale.languageCode]; + + String get phone => localizedValues['phone'][locale.languageCode]; + String get delete => localizedValues['delete'][locale.languageCode]; String get addAddress => localizedValues['addAddress'][locale.languageCode]; + String get deleteAddress => localizedValues['deleteAddress'][locale.languageCode]; + + String get deletedAddress => localizedValues['deletedAddress'][locale.languageCode]; + String get addNewAddress => localizedValues['addNewAddress'][locale.languageCode]; String get order => localizedValues['order'][locale.languageCode]; diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index 23a6dd9b..48c66dd7 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -253,7 +253,7 @@ class productTile extends StatelessWidget { : Container(), // this.isOrderDetails == true && model.order[0].orderStatusId == 30? - if (status == 30 && this.isOrderDetails == true) + if (status == 30 || status == 997 ||status == 994 && this.isOrderDetails == true) Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, From c84d1cadada054ce0e1558748691104a3dd2c1ff Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Tue, 30 Nov 2021 12:21:36 +0300 Subject: [PATCH 12/39] fix address issue --- lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index 39b5e4ea..fb6d368c 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -327,7 +327,9 @@ class _AddressItemWidgetState extends State { }, cancelFunction: () => {}); dialog.showAlertDialog(context); - setState(() {}); + setState(() { + widget.model.deleteAddresses(widget.address); + }); }, icon: Icon( Icons.delete, From 1b9e3b75bd2a695a90592be12db443cf10cc29e6 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Thu, 2 Dec 2021 08:57:24 +0300 Subject: [PATCH 13/39] fix issue of navigation --- lib/widgets/hospital_location.dart | 40 +++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/lib/widgets/hospital_location.dart b/lib/widgets/hospital_location.dart index 8ba7b4bd..780aa32e 100644 --- a/lib/widgets/hospital_location.dart +++ b/lib/widgets/hospital_location.dart @@ -8,6 +8,7 @@ import 'package:url_launcher/url_launcher.dart'; import 'avatar/large_avatar.dart'; import 'my_rich_text.dart'; +import 'dart:io' show Platform; class HospitalLocation extends StatelessWidget { final GetHMGLocationsModel location; @@ -74,7 +75,9 @@ class HospitalLocation extends StatelessWidget { Column( children: [ contactButton(Icons.location_on, TranslationBase.of(context).locationa, () { - MapsLauncher.launchCoordinates(double.parse(location.latitude), double.parse(location.longitude), location.locationName); + // MapsLauncher.launchCoordinates(double.parse(location.latitude), double.parse(location.longitude), location.locationName); + // launchMap( double.parse(location.latitude), double.parse(location.longitude)); + navigateTo(double.parse(location.latitude), double.parse(location.longitude)); }), SizedBox(height: 10), contactButton(Icons.call, TranslationBase.of(context).callNow, () { @@ -107,4 +110,39 @@ class HospitalLocation extends StatelessWidget { ), ); } + + static void navigateTo(double latitude, double longitude) async { + var uri = Uri.parse("google.navigation:q=$latitude,$longitude&mode=d"); + if (await canLaunch(uri.toString())) { + await launch(uri.toString()); + } else { + throw 'Could not launch ${uri.toString()}'; + } + } + +// launchMap(latitude, longitude) async { +// var url = ''; +// var urlAppleMaps = ''; +// if (Platform.isAndroid) { +// url = "https://www.google.com/maps/search/?api=1&query=${latitude},${longitude}"; +// } else { +// urlAppleMaps = 'https://maps.apple.com/?q=$latitude,$longitude'; +// url = "comgooglemaps://?saddr=&daddr=$latitude,$longitude&directionsmode=driving"; +// if (await canLaunch(url)) { +// await launch(url); +// } else { +// throw 'Could not launch $url'; +// } +// } +// +// if (await canLaunch(url)) { +// await launch(url); +// } else if (await canLaunch(urlAppleMaps)) { +// await launch(urlAppleMaps); +// } else { +// throw 'Could not launch $url'; +// } +// } + + } From 76984a4ef674c62502a0b4b17adeba74485a99f3 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 2 Dec 2021 09:30:54 +0300 Subject: [PATCH 14/39] Fixes --- .../insurance_approval_detail_screen.dart | 4 +- .../insurance/insurance_approval_screen.dart | 2 +- lib/pages/vaccine/my_vaccines_screen.dart | 61 +++++++++---------- 3 files changed, 33 insertions(+), 34 deletions(-) diff --git a/lib/pages/insurance/insurance_approval_detail_screen.dart b/lib/pages/insurance/insurance_approval_detail_screen.dart index fa6d0f5a..c5f84602 100644 --- a/lib/pages/insurance/insurance_approval_detail_screen.dart +++ b/lib/pages/insurance/insurance_approval_detail_screen.dart @@ -77,9 +77,9 @@ class InsuranceApprovalDetail extends StatelessWidget { MyRichText(TranslationBase.of(context).unusedCount, insuranceApprovalModel?.unUsedCount.toString() ?? "", projectViewModel.isArabic), MyRichText(TranslationBase.of(context).companyName, insuranceApprovalModel?.companyName ?? "", projectViewModel.isArabic), SizedBox(height: 6), - MyRichText(TranslationBase.of(context).receiptOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateTime(insuranceApprovalModel.receiptOn)) ?? "", + MyRichText(TranslationBase.of(context).receiptOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(insuranceApprovalModel.receiptOn)) ?? "", projectViewModel.isArabic), - MyRichText(TranslationBase.of(context).expiryOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDateTime(insuranceApprovalModel.expiryDate)) ?? "", + MyRichText(TranslationBase.of(context).expiryOn, DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(insuranceApprovalModel.expiryDate)) ?? "", projectViewModel.isArabic), ], ), diff --git a/lib/pages/insurance/insurance_approval_screen.dart b/lib/pages/insurance/insurance_approval_screen.dart index 52ce35c8..bd665046 100644 --- a/lib/pages/insurance/insurance_approval_screen.dart +++ b/lib/pages/insurance/insurance_approval_screen.dart @@ -140,7 +140,7 @@ class _InsuranceApprovalState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - MyRichText(TranslationBase.of(context).clinic + ":", model.insuranceApproval[index]?.clinicName.toLowerCase().capitalizeFirstofEach ?? "", + MyRichText(TranslationBase.of(context).clinic + ":", model.insuranceApproval[index]?.clinicName != null ? model.insuranceApproval[index]?.clinicName.toLowerCase().capitalizeFirstofEach : "", projectViewModel.isArabic), MyRichText(TranslationBase.of(context).approvalNo, model.insuranceApproval[index]?.approvalNo.toString() ?? "", projectViewModel.isArabic), ], diff --git a/lib/pages/vaccine/my_vaccines_screen.dart b/lib/pages/vaccine/my_vaccines_screen.dart index 1030c709..41475bab 100644 --- a/lib/pages/vaccine/my_vaccines_screen.dart +++ b/lib/pages/vaccine/my_vaccines_screen.dart @@ -76,38 +76,37 @@ class _MyVaccinesState extends State { bottomSheet: Container( color: Colors.white, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).availability, - () { - // Navigator.push(context, FadePage(page: MyVaccinesItemPage())); - }, - color: Color(0xffEAEAEA), - textColor: Color(0xff000000), - ), - ), - SizedBox(width: 8), - Expanded( - child: DefaultButton( - TranslationBase.of(context).sendEmail, - () { - showDialog( - context: context, - child: ConfirmSendEmailDialog( - email: projectViewModel.user.emailAddress, - onTapSendEmail: () { - model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); - }, - ), - ); - }, - ), + child: + // Row( + // mainAxisSize: MainAxisSize.min, + // children: [ + // Expanded( + // child: DefaultButton( + // TranslationBase.of(context).availability, + // () { + // // Navigator.push(context, FadePage(page: MyVaccinesItemPage())); + // }, + // color: Color(0xffEAEAEA), + // textColor: Color(0xff000000), + // ), + // ), + // SizedBox(width: 8), + DefaultButton( + TranslationBase.of(context).sendEmail, + () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: projectViewModel.user.emailAddress, + onTapSendEmail: () { + model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); + }, + ), + ); + }, ), - ], - ), + // ], + // ), ), ), ); From 3b9c1eb9edbc5206db3da4b18eeadfdbe8cfb83e Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 2 Dec 2021 11:51:37 +0300 Subject: [PATCH 15/39] Appointment booking fix --- lib/pages/BookAppointment/BookConfirm.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index f648025d..eb14805c 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -90,7 +90,6 @@ class _BookConfirmState extends State { null, widget.doctor.noOfPatientsRate, "", - ), isNeedToShowButton: false, ), @@ -201,7 +200,7 @@ class _BookConfirmState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () async { - if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && !await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertAppointment(context, widget.doctor); } else { insertLiveCareScheduledAppointment(context, widget.doctor); From 7ffb4314545f437155aa41eeae58c635cdafea55 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Thu, 2 Dec 2021 11:59:33 +0300 Subject: [PATCH 16/39] added map luncher --- ios/Runner/Info.plist | 16 +++++++ .../product-details/availability_info.dart | 10 ++++- lib/widgets/hospital_location.dart | 42 ++++--------------- pubspec.yaml | 1 + 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index ec89ac71..02eb80d9 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -96,3 +96,19 @@ + +LSApplicationQueriesSchemes + + comgooglemaps + baidumap + iosamap + waze + yandexmaps + yandexnavi + citymapper + mapswithme + osmandmaps + dgis + qqmap + here-location + diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index a5ba0956..08c6d5de 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; class AvailabilityInfo extends StatelessWidget { final ProductDetailViewModel previousModel; @@ -54,7 +55,14 @@ class AvailabilityInfo extends StatelessWidget { icon: Icon(Icons.location_on), color: Colors.red, onPressed: () { - MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription); + MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(previousModel.productLocationService[index].latitude), + double.parse(previousModel.productLocationService[index].longitude)), + title: previousModel.productLocationService[index].locationDescription, +// description: location.locationName, + ); + // MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription); }, ), ), diff --git a/lib/widgets/hospital_location.dart b/lib/widgets/hospital_location.dart index 780aa32e..e9395906 100644 --- a/lib/widgets/hospital_location.dart +++ b/lib/widgets/hospital_location.dart @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; import 'avatar/large_avatar.dart'; import 'my_rich_text.dart'; @@ -15,6 +16,7 @@ class HospitalLocation extends StatelessWidget { final bool showCity; final String waitingTime; + HospitalLocation(this.location, {Key key, this.showCity = false, this.waitingTime}) : super(key: key); @override @@ -76,8 +78,12 @@ class HospitalLocation extends StatelessWidget { children: [ contactButton(Icons.location_on, TranslationBase.of(context).locationa, () { // MapsLauncher.launchCoordinates(double.parse(location.latitude), double.parse(location.longitude), location.locationName); - // launchMap( double.parse(location.latitude), double.parse(location.longitude)); - navigateTo(double.parse(location.latitude), double.parse(location.longitude)); + MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(location.latitude), double.parse(location.longitude)), + title: location.locationName, +// description: location.locationName, + ); }), SizedBox(height: 10), contactButton(Icons.call, TranslationBase.of(context).callNow, () { @@ -111,38 +117,6 @@ class HospitalLocation extends StatelessWidget { ); } - static void navigateTo(double latitude, double longitude) async { - var uri = Uri.parse("google.navigation:q=$latitude,$longitude&mode=d"); - if (await canLaunch(uri.toString())) { - await launch(uri.toString()); - } else { - throw 'Could not launch ${uri.toString()}'; - } - } - -// launchMap(latitude, longitude) async { -// var url = ''; -// var urlAppleMaps = ''; -// if (Platform.isAndroid) { -// url = "https://www.google.com/maps/search/?api=1&query=${latitude},${longitude}"; -// } else { -// urlAppleMaps = 'https://maps.apple.com/?q=$latitude,$longitude'; -// url = "comgooglemaps://?saddr=&daddr=$latitude,$longitude&directionsmode=driving"; -// if (await canLaunch(url)) { -// await launch(url); -// } else { -// throw 'Could not launch $url'; -// } -// } -// -// if (await canLaunch(url)) { -// await launch(url); -// } else if (await canLaunch(urlAppleMaps)) { -// await launch(urlAppleMaps); -// } else { -// throw 'Could not launch $url'; -// } -// } } diff --git a/pubspec.yaml b/pubspec.yaml index ff6873fc..5b1b0a1f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -143,6 +143,7 @@ dependencies: #google maps places google_maps_place_picker: ^1.0.0 + map_launcher: ^1.1.3 #countdown timer for Upcoming List flutter_countdown_timer: ^1.6.0 From 94aab4a737a80bfd2c2c5e11f1a78859afaf4edb Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 2 Dec 2021 17:36:50 +0300 Subject: [PATCH 17/39] Speech to text fix in iOS --- lib/pages/feedback/send_feedback_page.dart | 10 ++++++- .../product-details/availability_info.dart | 22 +++++++------- .../others/floating_button_search.dart | 30 +++++++++++-------- 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index 298e617e..e409b133 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -94,6 +94,13 @@ class _SendFeedbackPageState extends State { this.appointHistory = widget.appointment; }); requestPermissions(); + event.controller.stream.listen((p) { + if (p['isIOSFeedback'] == 'true') { + if (this.mounted) { + this.titleController.value = p['data']; + } + } + }); super.initState(); } @@ -538,9 +545,10 @@ class _SendFeedbackPageState extends State { if (result.finalResult == true) { setState(() { + messageController.text += reconizedWord + '\n'; RoboSearch.closeAlertDialog(context); speech.stop(); - messageController.text = reconizedWord + '\n'; + }); } } diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index 08c6d5de..7d894069 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -1,9 +1,8 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; -import 'package:maps_launcher/maps_launcher.dart'; -import 'package:url_launcher/url_launcher.dart'; import 'package:map_launcher/map_launcher.dart'; +import 'package:url_launcher/url_launcher.dart'; class AvailabilityInfo extends StatelessWidget { final ProductDetailViewModel previousModel; @@ -21,8 +20,8 @@ class AvailabilityInfo extends StatelessWidget { ), ) : Container( - margin: EdgeInsets.only(bottom: 40), - child: ListView.builder( + margin: EdgeInsets.only(bottom: 40), + child: ListView.builder( physics: ScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, @@ -56,13 +55,14 @@ class AvailabilityInfo extends StatelessWidget { color: Colors.red, onPressed: () { MapLauncher.showMarker( - mapType: MapType.google, - coords: Coords(double.parse(previousModel.productLocationService[index].latitude), - double.parse(previousModel.productLocationService[index].longitude)), - title: previousModel.productLocationService[index].locationDescription, + mapType: MapType.googleGo, + coords: Coords(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude)), + title: previousModel.productLocationService[index].locationDescription, // description: location.locationName, - ); - // MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription); + ).then((value) {}).catchError((err) { + print(err); + }); +// MapLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription); }, ), ), @@ -84,7 +84,7 @@ class AvailabilityInfo extends StatelessWidget { ); }, ), - ); + ); } convertCityName(txt) { diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 8a9274be..b8752534 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -54,9 +54,11 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart' show TargetPlatform; import 'package:flutter/material.dart'; import 'package:flutter_tts/flutter_tts.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -896,17 +898,6 @@ class RoboSearch { }); showAlertDialog(BuildContext context) { - //AlertDialog alert = AlertDialog - // AlertDialog alert = AlertDialog(content: MyStatefulBuilder(dispose: () { - // print('dispose!!!!!!!!!!!!'); - // }) - // isClosed = true; - // streamSubscription.cancel(); - // }, builder: (BuildContext context, StateSetter setState) { - // //print(streamSubscription); - // }), - // ); - // show the dialog showDialog( context: context, @@ -918,7 +909,6 @@ class RoboSearch { ); }, ); - print(dialog); } static closeAlertDialog(BuildContext context) { @@ -946,6 +936,7 @@ class _MyStatefulBuilderState extends State { var searchText; static StreamSubscription streamSubscription; static var isClosed = false; + stt.SpeechToText speech = stt.SpeechToText(); @override void initState() { @@ -1006,6 +997,21 @@ class _MyStatefulBuilderState extends State { event.setValue({'startPopUp': 'true'}); }, )) + : SizedBox(), + searchText != 'null' && searchText != null && Theme.of(context).platform == TargetPlatform.iOS + ? Center( + child: DefaultButton( + TranslationBase.of(context).ok, + () { + RoboSearch.closeAlertDialog(context); + speech.stop(); + // event.setValue({"searchText": { + // 'isIOSFeedback':true, + // + // } + // }); + }, + )) : SizedBox() ]), ))); From 749b89b67d8ab6d9accce04a1a3cea045dcd3a0f Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Sun, 5 Dec 2021 11:03:17 +0300 Subject: [PATCH 18/39] fix issue --- ios/Runner/Info.plist | 22 ++++++------------- .../product-details/availability_info.dart | 12 +++++++--- lib/widgets/hospital_location.dart | 20 ++++++++++------- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 02eb80d9..e13174af 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -94,21 +94,13 @@ io.flutter.embedded_views_preview + LSApplicationQueriesSchemes + + comgooglemaps + baidumap + iosamap + -LSApplicationQueriesSchemes - - comgooglemaps - baidumap - iosamap - waze - yandexmaps - yandexnavi - citymapper - mapswithme - osmandmaps - dgis - qqmap - here-location - + diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index 08c6d5de..5cacf64d 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:map_launcher/map_launcher.dart'; +import 'dart:io' show Platform; class AvailabilityInfo extends StatelessWidget { final ProductDetailViewModel previousModel; @@ -55,13 +56,18 @@ class AvailabilityInfo extends StatelessWidget { icon: Icon(Icons.location_on), color: Colors.red, onPressed: () { - MapLauncher.showMarker( + if (Platform.isIOS) { MapLauncher.showMarker( + mapType: MapType.apple, + coords: Coords(double.parse(previousModel.productLocationService[index].latitude), + double.parse(previousModel.productLocationService[index].longitude)), + title: previousModel.productLocationService[index].locationDescription,); + } else { MapLauncher.showMarker( mapType: MapType.google, coords: Coords(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude)), title: previousModel.productLocationService[index].locationDescription, -// description: location.locationName, - ); + // description: location.locationName, + ); } // MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription); }, ), diff --git a/lib/widgets/hospital_location.dart b/lib/widgets/hospital_location.dart index e9395906..edd7f473 100644 --- a/lib/widgets/hospital_location.dart +++ b/lib/widgets/hospital_location.dart @@ -77,14 +77,19 @@ class HospitalLocation extends StatelessWidget { Column( children: [ contactButton(Icons.location_on, TranslationBase.of(context).locationa, () { - // MapsLauncher.launchCoordinates(double.parse(location.latitude), double.parse(location.longitude), location.locationName); - MapLauncher.showMarker( - mapType: MapType.google, + // MapsLauncher.launchCoordinates(double.parse(location.latitude), double.parse(location.longitude), location.locationName); + if (Platform.isIOS) { MapLauncher.showMarker( +// mapType: MapType.google, + mapType: MapType.apple, coords: Coords(double.parse(location.latitude), double.parse(location.longitude)), - title: location.locationName, -// description: location.locationName, - ); - }), + title: location.locationName,); + } else { MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(location.latitude), double.parse(location.longitude)), + title: location.locationName, + // description: location.locationName, + ); }} + ), SizedBox(height: 10), contactButton(Icons.call, TranslationBase.of(context).callNow, () { launch("tel://" + location.phoneNumber); @@ -118,5 +123,4 @@ class HospitalLocation extends StatelessWidget { } - } From 207525e31a2f08b4ee0a7975d818c0fc075b3eb1 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 5 Dec 2021 12:49:50 +0300 Subject: [PATCH 19/39] Fixes --- lib/config/localized_values.dart | 2 +- lib/core/service/client/base_app_client.dart | 3 ++ lib/pages/login/register.dart | 4 +- .../ClinicOfferAndPackagesPage.dart | 37 +++++++++---------- .../offers_packages/PackagesOfferCard.dart | 4 +- 5 files changed, 26 insertions(+), 24 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 7e0f8166..3962781c 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -806,7 +806,7 @@ const Map localizedValues = { "HealthTipsBasedOnCurrentWeather": {"en": "Health Tips Based On Current Weather", 'ar': ' نصائح صحية بناءاً على الطقس الحالي '}, "MoreDetails": {"en": "More details", "ar": " المزيد من التفاصيل "}, "SendCopy": {"en": "Send Copy", "ar": "ارسال نسخة"}, - "ResendOrder": {"en": "Refill Order & Delivery", "ar": "إعادة طلب و توصيل"}, + "ResendOrder": {"en": "Re-Order & Delivery", "ar": "إعادة طلب و توصيل"}, "Ports": {"en": "Ports", "ar": "المنافذ"}, "Way": {"en": "Way", "ar": "الطريقة"}, "Average": {"en": "Average", "ar": "متوسط"}, diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index f9361e90..94492c6c 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -490,6 +490,7 @@ class BaseAppClient { }) async { String url = fullUrl; print("URL Query String: $url"); + print("body: $body"); if (await Utils.checkConnection()) { headers.addAll({'Content-Type': 'application/json', 'Accept': 'application/json'}); @@ -502,6 +503,8 @@ class BaseAppClient { print("statusCode :$statusCode"); if (await handleUnauthorized(statusCode, forUrl: fullUrl)) simplePost(fullUrl, onFailure: onFailure, onSuccess: onSuccess, body: body, headers: headers); + print(response.body.toString()); + if (statusCode < 200 || statusCode >= 400 || json == null) { onFailure('Error While Fetching data', statusCode); } else { diff --git a/lib/pages/login/register.dart b/lib/pages/login/register.dart index 11ed7c79..ea8ef803 100644 --- a/lib/pages/login/register.dart +++ b/lib/pages/login/register.dart @@ -389,7 +389,9 @@ class _Register extends State { Navigator.of(context).push(FadePage(page: ConfirmLogin(changePageViewIndex: widget.changePageViewIndex))), } else - {AppToast.showErrorToast(message: result ? result : TranslationBase.of(context).somethingWentWrong)} + { + AppToast.showErrorToast(message: result != null ? result : TranslationBase.of(context).somethingWentWrong), + } }); } } diff --git a/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart b/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart index 97daf27f..da983d56 100644 --- a/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart +++ b/lib/pages/packages_offers/ClinicOfferAndPackagesPage.dart @@ -18,28 +18,25 @@ dynamic languageID; class ClinicPackagesPage extends StatefulWidget { List products; + ClinicPackagesPage({@required this.products}); @override _ClinicPackagesPageState createState() => _ClinicPackagesPageState(); - - } -class _ClinicPackagesPageState extends State with AfterLayoutMixin{ +class _ClinicPackagesPageState extends State with AfterLayoutMixin { AppScaffold appScaffold; List get _products => widget.products; PackagesViewModel viewModel; - onProductCartClick(PackagesResponseModel product) async { - if(viewModel.service.customer == null) - viewModel.service.customer = await CreateCustomerDialogPage(context: context).show(); + if (viewModel.service.customer == null) viewModel.service.customer = await CreateCustomerDialogPage(context: context).show(); - if(viewModel.service.customer != null) { + if (viewModel.service.customer != null) { var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id); - await viewModel.service.addProductToCart(request, context: context).then((response){ + await viewModel.service.addProductToCart(request, context: context).then((response) { // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); }).catchError((error) { utils.Utils.showErrorToast(error); @@ -47,9 +44,8 @@ class _ClinicPackagesPageState extends State with AfterLayo } } - @override - void afterFirstLayout(BuildContext context) async{ + void afterFirstLayout(BuildContext context) async { // appScaffold.appBar.badgeUpdater(viewModel.service.cartItemCount); } @@ -58,13 +54,11 @@ class _ClinicPackagesPageState extends State with AfterLayo super.initState(); } - @override Widget build(BuildContext context) { - return BaseView( allowAny: true, - onModelReady: (model){ + onModelReady: (model) { viewModel = model; }, builder: (_, model, wi) => appScaffold = AppScaffold( @@ -76,22 +70,25 @@ class _ClinicPackagesPageState extends State with AfterLayo isOfferPackages: true, showOfferPackagesCart: true, isShowDecPage: false, + showNewAppBar: true, + showNewAppBarTitle: true, body: Padding( - padding: const EdgeInsets.all(5), + padding: const EdgeInsets.all(12), child: StaggeredGridView.countBuilder( - crossAxisCount:4, + crossAxisCount: 4, itemCount: _products.length, itemBuilder: (BuildContext context, int index) => new Container( color: Colors.transparent, - child: PackagesItemCard( itemContentPadding: 10,itemModel: _products[index], onCartClick: onProductCartClick,) - ), + child: PackagesItemCard( + itemContentPadding: 10, + itemModel: _products[index], + onCartClick: onProductCartClick, + )), staggeredTileBuilder: (int index) => StaggeredTile.fit(2), mainAxisSpacing: 20, crossAxisSpacing: 10, - ) - ), + )), ), ); } - } diff --git a/lib/widgets/offers_packages/PackagesOfferCard.dart b/lib/widgets/offers_packages/PackagesOfferCard.dart index 14b1aeb0..3bf66383 100644 --- a/lib/widgets/offers_packages/PackagesOfferCard.dart +++ b/lib/widgets/offers_packages/PackagesOfferCard.dart @@ -47,7 +47,7 @@ class PackagesItemCardState extends State { aspectRatio: 144 / 144, child: ClipRRect( borderRadius: BorderRadius.circular(12.0), - child: Image.network("https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill, height: 180.0, width: 180.0), + child: Image.network(widget.itemModel.images.isNotEmpty ? widget.itemModel.images[0].src : "https://mdlaboratories.com/offersdiscounts/images/thumbs/0000162_dermatology-testing.jpeg", fit: BoxFit.fill, height: 180.0, width: 180.0), ), ), SizedBox(height: 6), @@ -61,7 +61,7 @@ class PackagesItemCardState extends State { color: Color(0xff2B353E), ), ), - Text("Special discount for all HMG Employees and their first…", + Text(widget.itemModel.shortDescription, maxLines: 2, style: TextStyle( fontSize: 12.0, From e291d46af7addb1430d37268968ab2905635fe2b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 5 Dec 2021 13:55:18 +0200 Subject: [PATCH 20/39] pharmacy uo fix --- lib/pages/parent_categorise_page.dart | 1930 ++++++++++------- .../pharmacies/widgets/ProductTileItem.dart | 4 +- 2 files changed, 1165 insertions(+), 769 deletions(-) diff --git a/lib/pages/parent_categorise_page.dart b/lib/pages/parent_categorise_page.dart index 393cbb27..6bdc9080 100644 --- a/lib/pages/parent_categorise_page.dart +++ b/lib/pages/parent_categorise_page.dart @@ -31,12 +31,14 @@ class ParentCategorisePage extends StatefulWidget { String id; String titleName; - AuthenticatedUserObject authenticatedUserObject = locator(); + AuthenticatedUserObject authenticatedUserObject = + locator(); ParentCategorisePage({this.id, this.titleName}); @override - _ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName); + _ParentCategorisePageState createState() => + _ParentCategorisePageState(id: id, titleName: titleName); } class _ParentCategorisePageState extends State { @@ -75,559 +77,782 @@ class _ParentCategorisePageState extends State { ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context); return BaseView( - onModelReady: (model) => model.getCategoriseParent(i: id, pageIndex: pageIndex, isLoading: false, context: context), + onModelReady: (model) => model.getCategoriseParent( + i: id, pageIndex: pageIndex, isLoading: false, context: context), allowAny: true, - builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( - isPharmacy: true, - appBarTitle: titleName, - isBottomBar: true, - isShowAppBar: true, - backgroundColor: Colors.white, - isShowDecPage: false, - showPharmacyCart: false, - showHomeAppBarIcon: false,baseViewModel: model, - body: SmartRefresher( - enablePullDown: false, - controller: controller, - enablePullUp: true, - onLoading: () async { - setState(() { - ++pageIndex; - }); - await model.getParentProducts(pageIndex: pageIndex, i: id, isLoading: true, context: context); - if (model.state != ViewState.BusyLocal && pageIndex < 5) { - controller.loadComplete(); - } else { - controller.loadFailed(); - } - }, - child: SingleChildScrollView( - child: 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: [ - InkWell( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + builder: + (BuildContext context, PharmacyCategoriseViewModel model, + Widget child) => + AppScaffold( + isPharmacy: true, + appBarTitle: titleName, + isBottomBar: true, + isShowAppBar: true, + backgroundColor: Colors.white, + isShowDecPage: false, + showPharmacyCart: false, + showHomeAppBarIcon: false, + baseViewModel: model, + body: SmartRefresher( + enablePullDown: false, + controller: controller, + enablePullUp: true, + onLoading: () async { + setState(() { + ++pageIndex; + }); + await model.getParentProducts( + pageIndex: pageIndex, + i: id, + isLoading: true, + context: context); + if (model.state != ViewState.BusyLocal && + pageIndex < 5) { + controller.loadComplete(); + } else { + controller.loadFailed(); + } + }, + child: SingleChildScrollView( + child: 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: Container( - child: Texts( - TranslationBase.of(context).viewCategorise, + InkWell( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Container( + child: Texts( + TranslationBase.of(context) + .viewCategorise, // 'View All Categories', - fontWeight: FontWeight.w300, + fontWeight: FontWeight.w300, + ), + ), + ), + Icon(Icons.arrow_forward) + ], ), - ), + onTap: () { + Navigator.push( + context, + FadePage( + page: SubCategoriseModalsheet( +// id: model.categorise[0].id, +// titleName: model.categorise[0].name, + )), + ); + }), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, ), - Icon(Icons.arrow_forward) ], ), - onTap: () { - Navigator.push( - context, - FadePage( - page: SubCategoriseModalsheet( -// id: model.categorise[0].id, -// titleName: model.categorise[0].name, - )), - ); - }), - 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, + ), + ), + ), + ], ), + onTap: () { + Navigator.push( + context, + FadePage( + page: SubCategorisePage( + title: projectViewModel + .isArabic + ? model + .categoriseParent[ + index] + .namen + : 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, ), - 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, - ), - ), + SizedBox( + width: 10.0, + ), + Texts( + TranslationBase.of(context).refine, + fontWeight: FontWeight.w600, ), ], ), onTap: () { - Navigator.push( - context, - FadePage( - page: SubCategorisePage( - title: projectViewModel.isArabic ? model.categoriseParent[index].namen : 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( - TranslationBase.of(context).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( - color: Colors.white, - 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( - TranslationBase.of(context).refine, + 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( + color: Colors.white, + 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( + TranslationBase.of( + context) + .refine, // 'Refine', - fontWeight: FontWeight.w600, - ), - SizedBox( - width: 250.0, - ), - InkWell( - child: Texts( + fontWeight: + FontWeight + .w600, + ), + SizedBox( + width: 250.0, + ), + InkWell( + child: Texts( // 'Close', - TranslationBase.of(context).closeIt, - color: Colors.red, - fontWeight: FontWeight.w600, - fontSize: 15.0, + TranslationBase.of( + context) + .closeIt, + color: Colors + .red, + fontWeight: + FontWeight + .w600, + fontSize: + 15.0, + ), + onTap: () { + Navigator.pop( + context); + }, + ), + ], + ), ), - onTap: () { - Navigator.pop(context); - }, - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - Column( - children: [ - ExpansionTile( - title: Texts(TranslationBase.of(context).categorise), - children: [ - ProcedureListWidget( - model: model, - masterList: model.categoriseParent, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => isEntityListSelected(master), - ) - ], - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - ExpansionTile( - title: Texts(TranslationBase.of(context).brands), - children: [ - ProcedureListWidget( - model: model, - masterList: model.brandsList, - removeHistory: (item) { - setState(() { - entityListBrands.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityListBrands.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityListSelected: (master) => isEntityListSelectedBrands(master), - ) - ], - ), - Divider( - thickness: 1.0, - color: Colors.black12, - ), - ExpansionTile( - title: Texts(TranslationBase.of(context).price), - children: [ - Container( - color: Color(0xffEEEEEE), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Texts(TranslationBase.of(context).min), - Container( - color: Colors.white, - width: 200, - height: 40, - child: TextFormField( - decoration: InputDecoration( - border: OutlineInputBorder(), + Divider( + thickness: 1.0, + color: + Colors.black12, + ), + Column( + children: [ + ExpansionTile( + title: Texts( + TranslationBase.of( + context) + .categorise), + children: [ + ProcedureListWidget( + model: + model, + masterList: + model + .categoriseParent, + removeHistory: + (item) { + setState( + () { + entityList + .remove(item); + }); + }, + addHistory: + (history) { + setState( + () { + entityList + .add(history); + }); + }, + addSelectedHistories: + () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelected(master), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors + .black12, + ), + ExpansionTile( + title: Texts( + TranslationBase.of( + context) + .brands), + children: [ + ProcedureListWidget( + model: + model, + masterList: + model + .brandsList, + removeHistory: + (item) { + setState( + () { + entityListBrands + .remove(item); + }); + }, + addHistory: + (history) { + setState( + () { + entityListBrands + .add(history); + }); + }, + addSelectedHistories: + () { + //TODO build your fun herr + // widget.addSelectedHistories(); + }, + isEntityListSelected: + (master) => + isEntityListSelectedBrands(master), + ) + ], + ), + Divider( + thickness: 1.0, + color: Colors + .black12, + ), + ExpansionTile( + title: Texts( + TranslationBase.of( + context) + .price), + children: [ + Container( + color: Color( + 0xffEEEEEE), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).min), + Container( + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), + ), + controller: minField, + ), + ), + ], ), - controller: minField, - ), + Column( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Texts(TranslationBase.of(context).max), + Container( + color: Colors.white, + width: 200, + height: 40, + child: TextFormField( + decoration: InputDecoration( + border: OutlineInputBorder(), + ), + controller: maxField, + ), + ), + ], + ), + ], ), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.start, + ) + ], + ), + 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: [ - Texts(TranslationBase.of(context).max), Container( - color: Colors.white, - width: 200, - height: 40, - child: TextFormField( - decoration: InputDecoration( - border: OutlineInputBorder(), - ), - controller: maxField, + width: + 150, + child: + Button( + label: TranslationBase.of(context) + .reset, + backgroundColor: + Colors.red, + onTap: + () { + setState( + () { + entityList.clear(); + entityListBrands.clear(); + }); + minField + .clear(); + maxField + .clear(); + }, ), ), - ], - ), - ], - ), - ) - ], - ), - 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: 150, - child: Button( - label: TranslationBase.of(context).reset, - backgroundColor: Colors.red, - ), - ), - SizedBox( - width: 10, - ), - Container( - width: 150, - child: Button( - onTap: () async { - String categoriesId = ""; - for (CategoriseParentModel category in entityList) { - if (categoriesId == "") { - categoriesId = category.id; - } else { - categoriesId = "$categoriesId,${category.id}"; - } - } - String brandIds = ""; - for (CategoriseParentModel brand in entityListBrands) { - if (brandIds == "") { - brandIds = brand.id; - } else { - brandIds = "$brandIds,${brand.id}"; - } - } + SizedBox( + width: 10, + ), + Container( + width: + 150, + child: + Button( + onTap: + () async { + String + categoriesId = + ""; + for (CategoriseParentModel category + in entityList) { + if (categoriesId == + "") { + categoriesId = category.id; + } else { + categoriesId = "$categoriesId,${category.id}"; + } + } + String + brandIds = + ""; + for (CategoriseParentModel brand + in entityListBrands) { + if (brandIds == + "") { + brandIds = brand.id; + } else { + brandIds = "$brandIds,${brand.id}"; + } + } - GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog( + context); - await model.getFilteredProducts( - min: minField.text.isEmpty ? "" : "&price_min=" + minField.text.toString(), max: maxField.text.isEmpty ? "" : "&price_max=" + maxField.text.toString(), categoryId: categoriesId, brandId: brandIds.isEmpty ? "" : "&manufacturerids=" + brandIds); - GifLoaderDialogUtils.hideDialog(context); + await model.getFilteredProducts( + min: minField.text.isEmpty ? "" : "&price_min=" + minField.text.toString(), + max: maxField.text.isEmpty ? "" : "&price_max=" + maxField.text.toString(), + categoryId: categoriesId, + brandId: brandIds.isEmpty ? "" : "&manufacturerids=" + brandIds); + GifLoaderDialogUtils.hideDialog( + context); - Navigator.pop(context); - }, - label: TranslationBase.of(context).apply, - backgroundColor: Colors.green, + Navigator.pop( + context); + }, + label: TranslationBase.of(context) + .apply, + backgroundColor: + Colors.green, + ), + ), + ], + ), ), - ), - ], - ), + ], + ), + ], ), - ], - ), - ], - ), - ), - ); - }); - }, - ); - }, - ), - Row( - children: [ - Container( - height: 44.0, - child: VerticalDivider( - color: Colors.black45, - thickness: 1.0, + ), + ); + }); + }, + ); + }, + ), + 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: CustomColors.green, - size: 29.0, - ); - } else { - styleOne = true; - styleTwo = false; - styleIcon = Icon( - Icons.widgets_sharp, - color: CustomColors.green, - size: 29.0, - ); - } - }); - }, - ), - ), - ], - ), - ], - ), - ), - Divider( - thickness: 1.0, - color: Colors.grey.shade400, - ), - model.parentProducts.isNotEmpty - ? styleOne == true - ? Container( - height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.15, - 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, + ), + ), + Padding( + padding: EdgeInsets.all(8.0), child: InkWell( - 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( - TranslationBase.of(context).offers.toUpperCase(), - color: Colors.red, - fontSize: 13.0, - fontWeight: FontWeight.w900, - ), - ), - 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, + child: styleIcon, + onTap: () { + setState(() { + if (styleOne == true) { + styleOne = false; + styleTwo = true; + styleIcon = Icon( + Icons.auto_awesome_mosaic, + color: CustomColors.green, + size: 29.0, + ); + } else { + styleOne = true; + styleTwo = false; + styleIcon = Icon( + Icons.widgets_sharp, + color: CustomColors.green, + size: 29.0, + ); + } + }); + }, + ), + ), + ], + ), + ], + ), + ), + Divider( + thickness: 1.0, + color: Colors.grey.shade400, + ), + model.parentProducts.isNotEmpty + ? styleOne == true + ? Container( + height: model.parentProducts.length * + MediaQuery.of(context) + .size + .height * + 0.15, + 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: InkWell( + 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( + TranslationBase.of(context) + .offers + .toUpperCase(), + color: + Colors.red, + fontSize: + 13.0, + fontWeight: + FontWeight.w900, + ), + ), + 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 @@ -677,144 +902,251 @@ class _ParentCategorisePageState extends State { // .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), + margin: EdgeInsets + .symmetric( + horizontal: 6, + vertical: 0, ), - child: Center( - child: Texts( - model.parentProducts[index].discountName, - regular: true, - color: Colors.white, - fontSize: 10.4, - ), - ), - ), - Texts( - projectViewModel.isArabic ? model.parentProducts[index].namen : 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: [ + child: Column( + 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, + ), + ), + ), + Texts( + projectViewModel + .isArabic + ? model + .parentProducts[ + index] + .namen + : 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), - RatingBar.readOnly( - initialRating: model.parentProducts[index].approvedRatingSum.toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + RatingBar + .readOnly( + initialRating: model + .parentProducts[index] + .approvedRatingSum + .toDouble(), + size: + 15.0, + filledColor: + Colors.yellow[700], + emptyColor: + Colors.grey[500], + isHalfAllowed: + true, + halfFilledIcon: + Icons.star_half, + filledIcon: + Icons.star, + emptyIcon: + Icons.star, + ), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight.w400, + ) + ], + ), + ], ), - Texts( - "(${model.parentProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ) - ], - ), - ], + ), + ], + ), ), ), - ], - ), - ), - ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage(model.parentProducts[index]), - )), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.parentProducts[ + index]), + )), + }, + )); }, - )); - }, - ), - ) - : Container( - height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.122, - child: ListView.builder( - physics: NeverScrollableScrollPhysics(), - itemCount: model.parentProducts.length, - itemBuilder: (BuildContext context, int index) { - return InkWell( - child: Card( - child: Row( - children: [ - Stack( - children: [ - Column( + ), + ) + : Container( + height: model.parentProducts.length * + MediaQuery.of(context) + .size + .height * + 0.122, + child: ListView.builder( + physics: + NeverScrollableScrollPhysics(), + itemCount: + model.parentProducts.length, + itemBuilder: + (BuildContext context, + int index) { + return InkWell( + child: Card( + child: Row( children: [ - Container( - decoration: BoxDecoration(), - child: Padding( - padding: EdgeInsets.only( - left: 9.0, - top: 8.0, - right: 10.0, + 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: model + .parentProducts[ + index] + .images + .isNotEmpty + ? Image + .network( + model + .parentProducts[index] + .images[0] + .thumb, + fit: BoxFit + .contain, + height: + 70, + ) + : Text(TranslationBase.of( + context) + .noImage), + ), + ], ), - ), - ), - Container( - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), - alignment: Alignment.center, - child: model.parentProducts[index].images.isNotEmpty - ? Image.network( - model.parentProducts[index].images[0].thumb, - fit: BoxFit.contain, - height: 70, - ) - : Text(TranslationBase.of(context).noImage), - ), - ], - ), - Column( - children: [ - Container( - width: model.parentProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 5.3 : 0, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Color(0xffb23838), - borderRadius: BorderRadius.only(topLeft: Radius.circular(6)), - ), - child: model.parentProducts[index].rxMessage != null - ? Texts( - projectProvider.isArabic ? model.parentProducts[index].rxMessagen : model.parentProducts[index].rxMessage, - color: Colors.white, - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ) - : Texts(""), + Column( + children: [ + Container( + width: model.parentProducts[index].rxMessage != + null + ? MediaQuery.of(context) + .size + .width / + 5.3 + : 0, + padding: + EdgeInsets + .all( + 4), + decoration: + BoxDecoration( + color: Color( + 0xffb23838), + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular(6)), + ), + child: model.parentProducts[index] + .rxMessage != + null + ? Texts( + projectProvider.isArabic + ? model.parentProducts[index].rxMessagen + : model.parentProducts[index].rxMessage, + color: + Colors.white, + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight.w400, + ) + : Texts(""), // Texts( // model.parentProducts[index].rxMessage != null ? model.parentProducts[index].rxMessage : "", // color: Colors.white, @@ -822,139 +1154,201 @@ class _ParentCategorisePageState extends State { // fontSize: 10, // fontWeight: FontWeight.w400, // ), + ), + ], + ), + ], ), - ], - ), - ], - ), - Container( - margin: EdgeInsets.symmetric( - horizontal: 0, - vertical: 0, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 4.0, - ), - Container( - width: MediaQuery.of(context).size.width * 0.635, - child: Texts( - projectViewModel.isArabic ? model.parentProducts[index].namen : 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: [ + Container( + margin: EdgeInsets + .symmetric( + horizontal: 0, + vertical: 0, + ), + child: Column( + mainAxisAlignment: + MainAxisAlignment + .spaceAround, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + SizedBox( + height: 4.0, + ), + Container( + width: MediaQuery.of( + context) + .size + .width * + 0.635, + child: Texts( + projectViewModel + .isArabic + ? model + .parentProducts[ + index] + .namen + : 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), - RatingBar.readOnly( - initialRating: model.parentProducts[index].approvedRatingSum.toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + RatingBar + .readOnly( + initialRating: model + .parentProducts[ + index] + .approvedRatingSum + .toDouble(), + size: 15.0, + filledColor: + Colors.yellow[ + 700], + emptyColor: + Colors.grey[ + 500], + isHalfAllowed: + true, + halfFilledIcon: + Icons + .star_half, + filledIcon: + Icons + .star, + emptyIcon: + Icons + .star, + ), + Texts( + "(${model.parentProducts[index].approvedTotalReviews})", + regular: + true, + fontSize: + 10, + fontWeight: + FontWeight + .w400, + ) + ], + ), + ], ), - Texts( - "(${model.parentProducts[index].approvedTotalReviews})", - regular: true, - fontSize: 10, - fontWeight: FontWeight.w400, - ) - ], - ), - ], + ), + widget.authenticatedUserObject + .isLogin + ? Container( + child: + IconButton( + icon: + Icon( + Icons + .shopping_cart, + size: + 18, + color: + CustomColors.green, + ), + onPressed: + () async { + if (model.parentProducts[index].isRx == + false) { + GifLoaderDialogUtils.showMyDialog(context); + await addToCartFunction(1, + model.parentProducts[index].id); + GifLoaderDialogUtils.hideDialog(context); + Utils.navigateToCartPage(); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); + } + }), + ) + : Container(), + ], + ), ), + onTap: () => { + Navigator.push( + context, + FadePage( + page: ProductDetailPage( + model.parentProducts[ + index]), + )), + }, + ); + }), + ) + : Padding( + padding: const EdgeInsets.all(12.0), + child: Container( + child: Center( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Padding( + padding: + const EdgeInsets.all(8.0), + child: Image.asset( + 'assets/images/new-design/empty_box.png', + width: 100, + height: 100, + fit: BoxFit.cover, ), - widget.authenticatedUserObject.isLogin - ? Container( - child: IconButton( - icon: Icon( - Icons.shopping_cart, - size: 18, - color: CustomColors.green, - ), - onPressed: () async { - if (model.parentProducts[index].isRx == false) { - GifLoaderDialogUtils.showMyDialog(context); - await addToCartFunction(1, model.parentProducts[index].id); - GifLoaderDialogUtils.hideDialog(context); - Utils.navigateToCartPage(); - } else { - AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); - } - }), - ) - : Container(), - ], - ), + ), + Padding( + padding: + const EdgeInsets.all(8.0), + child: Text( + TranslationBase.of(context) + .noData, + // 'There is no data', + style: + TextStyle(fontSize: 30), + ), + ) + ], ), - onTap: () => { - Navigator.push( - context, - FadePage( - page: ProductDetailPage(model.parentProducts[index]), - )), - }, - ); - }), - ) - : Padding( - padding: const EdgeInsets.all(12.0), - child: Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Image.asset( - 'assets/images/new-design/empty_box.png', - width: 100, - height: 100, - fit: BoxFit.cover, ), ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - TranslationBase.of(context).noData, - // 'There is no data', - style: TextStyle(fontSize: 30), - ), - ) - ], - ), - ), - ), - ) - ], - ), - ), - ), - ))); + ) + ], + ), + ), + ), + ))); } addToCartFunction(quantity, itemID) async { @@ -963,7 +1357,8 @@ class _ParentCategorisePageState extends State { } bool isEntityListSelected(CategoriseParentModel masterKey) { - Iterable history = entityList.where((element) => masterKey.id == element.id); + Iterable history = + entityList.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } @@ -971,7 +1366,8 @@ class _ParentCategorisePageState extends State { } bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { - Iterable history = entityListBrands.where((element) => masterKey.id == element.id); + Iterable history = + entityListBrands.where((element) => masterKey.id == element.id); if (history.length > 0) { return true; } diff --git a/lib/pages/pharmacies/widgets/ProductTileItem.dart b/lib/pages/pharmacies/widgets/ProductTileItem.dart index a4988695..2c0582b7 100644 --- a/lib/pages/pharmacies/widgets/ProductTileItem.dart +++ b/lib/pages/pharmacies/widgets/ProductTileItem.dart @@ -276,7 +276,7 @@ class ProductTileItem extends StatelessWidget { // Expanded( RatingBar.readOnly( initialRating: item.approvedRatingSum.toDouble(), - size: 15.0, + size: 13.0, filledColor: Color(0XFFD02127), emptyColor: Color(0XFFD02127), isHalfAllowed: true, @@ -292,7 +292,7 @@ class ProductTileItem extends StatelessWidget { ), SizedBox( - width: 10.0, + width: 9.0, ), Icon( Icons.arrow_forward, From cf556c66b0e5ebcac97d71afb41555464f114dbc Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 6 Dec 2021 10:46:31 +0200 Subject: [PATCH 21/39] add quantity filed fixed --- .../product-details/footor/footer-widget.dart | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index 5d974cc4..ba6fbfa4 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -45,10 +45,19 @@ class FooterWidget extends StatefulWidget { class _FooterWidgetState extends State { double quantityUI = 80; bool showUI = false; + + static final GlobalKey _key = GlobalKey(); AuthenticatedUserObject authenticatedUserObject = locator(); AppSharedPreferences sharedPref = new AppSharedPreferences(); + @override + void initState() { + super.initState(); + quantityUI = 160; + showUI = true; + } + @override Widget build(BuildContext context) { return Container( @@ -71,8 +80,11 @@ class _FooterWidgetState extends State { height: quantityUI, child: Column( children: [ - showUI + !showUI ? Container( + height: 10, + ) + : Container( width: double.infinity, height: 100, color: Colors.white, @@ -89,11 +101,10 @@ class _FooterWidgetState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Texts( - TranslationBase.of(context).productQuantity, + TranslationBase.of(context).productQuantity, fontSize: 15, fontWeight: FontWeight.bold, - color: Color(0xFF575757) - ), + color: Color(0xFF575757)), ), InkWell( child: Icon(Icons.close, color: Colors.black), @@ -127,8 +138,11 @@ class _FooterWidgetState extends State { color: Colors.white, ), child: TextField( - decoration: InputDecoration( - labelText: ' Quantity # '), + key: _key, + keyboardType: TextInputType.number, + textAlign: TextAlign.center, + decoration: + InputDecoration(hintText: ' Quantity # '), onChanged: (text) { if (int.tryParse(text) == null) { text = ''; @@ -152,9 +166,6 @@ class _FooterWidgetState extends State { ], ), ), - ) - : Container( - height: 10, ), Container( height: 58, @@ -227,8 +238,7 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, - margin: EdgeInsets.symmetric( vertical: 5.0), - + margin: EdgeInsets.symmetric(vertical: 5.0), child: SecondaryButton( label: TranslationBase.of(context).addToCart, disabled: isAddToCartDisable(), @@ -244,8 +254,9 @@ class _FooterWidgetState extends State { }, fontWeight: FontWeight.w600, borderRadius: 6, - disableColor:Color(0xFFD6D6D6), - textColor: isAddToCartDisable()?Color(0xFFACACAC):Colors.white, + disableColor: Color(0xFFD6D6D6), + textColor: + isAddToCartDisable() ? Color(0xFFACACAC) : Colors.white, color: Color(0xFF535353), ), ), @@ -254,13 +265,11 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, - margin: EdgeInsets.symmetric( vertical: 5.0), - + margin: EdgeInsets.symmetric(vertical: 5.0), child: SecondaryButton( label: TranslationBase.of(context).buyNow, fontSize: 15, disabled: isBuyNowDisable(), - onTap: () async { if (!authenticatedUserObject.isLogin) { login(); @@ -271,7 +280,8 @@ class _FooterWidgetState extends State { model: widget.model); } }, - textColor: isBuyNowDisable()?Color(0xFFACACAC):Colors.white, + textColor: + isBuyNowDisable() ? Color(0xFFACACAC) : Colors.white, fontWeight: FontWeight.w600, borderRadius: 6, disableColor: Color(0xFFD6D6D6), @@ -286,20 +296,16 @@ class _FooterWidgetState extends State { ); } - bool isBuyNowDisable(){ + bool isBuyNowDisable() { return (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx; - - } - bool isAddToCartDisable(){ + bool isAddToCartDisable() { return (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx; - - } void setUserValues(value) async { From a60e878fefb9bb5c0c0b0a81fbad0c604de28e18 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 6 Dec 2021 12:19:47 +0300 Subject: [PATCH 22/39] Updates & fixes --- .../product-details/footor/footer-widget.dart | 64 ++++++------------- .../product-details/product-detail.dart | 52 ++++++++------- 2 files changed, 46 insertions(+), 70 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index ba6fbfa4..59c42343 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -30,13 +30,8 @@ class FooterWidget extends StatefulWidget { int quantity; bool isOverQuantity; - FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, - this.quantityLimit, this.item, - {this.quantity, - this.isOverQuantity = false, - this.addToCartFunction, - this.addToShoppingCartFunction, - this.model}); + FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity, this.quantityLimit, this.item, + {this.quantity, this.isOverQuantity = false, this.addToCartFunction, this.addToShoppingCartFunction, this.model}); @override _FooterWidgetState createState() => _FooterWidgetState(); @@ -47,15 +42,16 @@ class _FooterWidgetState extends State { bool showUI = false; static final GlobalKey _key = GlobalKey(); - AuthenticatedUserObject authenticatedUserObject = - locator(); + AuthenticatedUserObject authenticatedUserObject = locator(); AppSharedPreferences sharedPref = new AppSharedPreferences(); @override void initState() { super.initState(); - quantityUI = 160; - showUI = true; + if (!isBuyNowDisable() || !isAddToCartDisable()) { + quantityUI = 160; + showUI = true; + } } @override @@ -100,11 +96,7 @@ class _FooterWidgetState extends State { children: [ Padding( padding: const EdgeInsets.all(8.0), - child: Texts( - TranslationBase.of(context).productQuantity, - fontSize: 15, - fontWeight: FontWeight.bold, - color: Color(0xFF575757)), + child: Texts(TranslationBase.of(context).productQuantity, fontSize: 15, fontWeight: FontWeight.bold, color: Color(0xFF575757)), ), InkWell( child: Icon(Icons.close, color: Colors.black), @@ -126,11 +118,7 @@ class _FooterWidgetState extends State { SizedBox( width: 5, ), - for (int i = 1; i <= 10; i++) - QuantityBox( - label: i, - onTapFunc: onChangeValue, - isSelected: widget.quantity == i), + for (int i = 1; i <= 10; i++) QuantityBox(label: i, onTapFunc: onChangeValue, isSelected: widget.quantity == i), Container( width: 100, decoration: BoxDecoration( @@ -141,16 +129,14 @@ class _FooterWidgetState extends State { key: _key, keyboardType: TextInputType.number, textAlign: TextAlign.center, - decoration: - InputDecoration(hintText: ' Quantity # '), + decoration: InputDecoration(hintText: ' Quantity # '), onChanged: (text) { if (int.tryParse(text) == null) { text = ''; } else { setState(() { widget.quantity = int.parse(text); - if (widget.quantity >= - widget.quantityLimit) { + if (widget.quantity >= widget.quantityLimit) { widget.isOverQuantity = true; } else { widget.isOverQuantity = false; @@ -247,16 +233,12 @@ class _FooterWidgetState extends State { if (!authenticatedUserObject.isLogin) { login(); } else - await widget.addToCartFunction( - quantity: widget.quantity, - itemID: widget.item.id, - model: widget.model); + await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); }, fontWeight: FontWeight.w600, borderRadius: 6, disableColor: Color(0xFFD6D6D6), - textColor: - isAddToCartDisable() ? Color(0xFFACACAC) : Colors.white, + textColor: isAddToCartDisable() ? Color(0xFFACACAC) : Colors.white, color: Color(0xFF535353), ), ), @@ -274,14 +256,10 @@ class _FooterWidgetState extends State { if (!authenticatedUserObject.isLogin) { login(); } else { - await widget.addToShoppingCartFunction( - quantity: widget.quantity, - itemID: widget.item.id, - model: widget.model); + await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); } }, - textColor: - isBuyNowDisable() ? Color(0xFFACACAC) : Colors.white, + textColor: isBuyNowDisable() ? Color(0xFFACACAC) : Colors.white, fontWeight: FontWeight.w600, borderRadius: 6, disableColor: Color(0xFFD6D6D6), @@ -297,15 +275,11 @@ class _FooterWidgetState extends State { } bool isBuyNowDisable() { - return (!widget.isAvailable && widget.quantity > 0) || - (widget.quantity > widget.quantityLimit) || - widget.item.isRx; + return (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx; } bool isAddToCartDisable() { - return (!widget.isAvailable && widget.quantity > 0) || - widget.quantity > widget.quantityLimit || - widget.item.isRx; + return (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx; } void setUserValues(value) async { @@ -320,9 +294,7 @@ class _FooterWidgetState extends State { Navigator.of(context).pushNamed(CONFIRM_LOGIN); } else { GifLoaderDialogUtils.showMyDialog(context); - authService - .selectDeviceImei(DEVICE_TOKEN) - .then((SelectDeviceIMEIRES value) { + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { GifLoaderDialogUtils.hideDialog(context); if (value != null) { setUserValues(value); diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 52c1d64d..6799f30e 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -11,7 +11,6 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/material.dart'; @@ -133,27 +132,32 @@ class __ProductDetailPageState extends State { ), ), ), - if(model.isStockAvailable!= null && !model.isStockAvailable) - Container( - height: MediaQuery.of(context).size.height * .40, - color: Colors.white.withOpacity(0.6), - // child: AppText("Out of Stock"), - ), - if(model.isStockAvailable!= null && !model.isStockAvailable) - Positioned( - // bottom: 10, - top: MediaQuery.of(context).size.height *.088, - left: MediaQuery.of(context).size.width *.32, - child: Center( - child: Container( - height: MediaQuery.of(context).size.height * .40, - // color: Colors.white.withOpacity(0.75), - child: RotationTransition( - turns: new AlwaysStoppedAnimation(310 / 360), - child: AppText(TranslationBase.of(context).productOutOfStock ,color:Color(0xFF000000).withOpacity(0.19),fontSize: projectViewModel.isArabic?40: 50, fontWeight: FontWeight.bold ,)), + if (model.isStockAvailable != null && !model.isStockAvailable) + Container( + height: MediaQuery.of(context).size.height * .40, + color: Colors.white.withOpacity(0.6), + // child: AppText("Out of Stock"), + ), + if (model.isStockAvailable != null && !model.isStockAvailable) + Positioned( + // bottom: 10, + top: MediaQuery.of(context).size.height * .088, + left: MediaQuery.of(context).size.width * .32, + child: Center( + child: Container( + height: MediaQuery.of(context).size.height * .40, + // color: Colors.white.withOpacity(0.75), + child: RotationTransition( + turns: new AlwaysStoppedAnimation(310 / 360), + child: AppText( + TranslationBase.of(context).productOutOfStock, + color: Color(0xFF000000).withOpacity(0.19), + fontSize: projectViewModel.isArabic ? 40 : 50, + fontWeight: FontWeight.bold, + )), + ), ), ), - ), ], ), if (widget.product.discountDescription != null) DiscountDescription(product: widget.product) @@ -233,7 +237,7 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).details, - style: TextStyle( fontWeight: FontWeight.w600, fontSize: 14, letterSpacing:-0.84), + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: -0.84), ), color: Colors.white, ), @@ -264,7 +268,7 @@ class __ProductDetailPageState extends State { }, child: Text( TranslationBase.of(context).reviews, - style: TextStyle( fontWeight: FontWeight.w600, fontSize: 14, letterSpacing:-0.84), + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: -0.84), ), color: Colors.white, ), @@ -279,7 +283,7 @@ class __ProductDetailPageState extends State { Column( children: [ FlatButton( - onPressed: model.isStockAvailable !=null && model.isStockAvailable + onPressed: model.isStockAvailable != null && model.isStockAvailable ? () async { GifLoaderDialogUtils.showMyDialog(context); await model.getProductLocationData(widget.product.sku); @@ -294,7 +298,7 @@ class __ProductDetailPageState extends State { : null, child: Text( TranslationBase.of(context).availability, - style: TextStyle( fontWeight: FontWeight.w600, fontSize: 14, letterSpacing:-0.84), + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing: -0.84), ), color: Colors.white, ), From d5b58c07caefa0f52e3d27be80b93683fbf8b7d0 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 6 Dec 2021 17:52:20 +0300 Subject: [PATCH 23/39] Smartwatch fixes --- .../prescriptions_home_page.dart | 4 +- .../distance/distanceTracker.dart | 42 +++++++++++-------- .../heartrate/heartrateTracker.dart | 8 +++- .../steps/stepsTracker.dart | 12 ++++-- .../syncHealthData.dart | 4 -- lib/widgets/in_app_browser/InAppBrowser.dart | 12 +++--- 6 files changed, 47 insertions(+), 35 deletions(-) diff --git a/lib/pages/medical/prescriptions/prescriptions_home_page.dart b/lib/pages/medical/prescriptions/prescriptions_home_page.dart index d5efa38b..4cb1e890 100644 --- a/lib/pages/medical/prescriptions/prescriptions_home_page.dart +++ b/lib/pages/medical/prescriptions/prescriptions_home_page.dart @@ -65,12 +65,12 @@ class _HomePrescriptionsPageState extends State with Sing unselectedLabelColor: Color(0xff575757), labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), labelStyle: TextStyle( - fontSize: 16, + fontSize: 15, fontWeight: FontWeight.w600, letterSpacing: -0.48, ), unselectedLabelStyle: TextStyle( - fontSize: 16, + fontSize: 15, fontWeight: FontWeight.w600, letterSpacing: -0.48, ), diff --git a/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart b/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart index cceb8b1e..02e69481 100644 --- a/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart +++ b/lib/pages/medical/smart_watch_health_data/distance/distanceTracker.dart @@ -137,8 +137,10 @@ class _DistanceTrackerState extends State with SingleTickerProv }); generateWeekData(); setState(() { - weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; - weeklyStatsAvgValue = weeklyStatsAvgValue / 1000; + if (avgWeeklyStepsValue != 0) { + weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + weeklyStatsAvgValue = weeklyStatsAvgValue / 1000; + } isWeeklyDataLoaded = true; }); }).catchError((err) { @@ -165,8 +167,10 @@ class _DistanceTrackerState extends State with SingleTickerProv }); generateMonthData(); setState(() { - monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; - monthlyStatsAvgValue = monthlyStatsAvgValue / 1000; + if (avgMonthlyStepsValue != 0) { + monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + monthlyStatsAvgValue = monthlyStatsAvgValue / 1000; + } isMonthlyDataLoaded = true; }); }).catchError((err) { @@ -193,8 +197,10 @@ class _DistanceTrackerState extends State with SingleTickerProv }); generateYearData(); setState(() { - yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; - yearlyStatsAvgValue = yearlyStatsAvgValue / 1000; + if (avgYearlyStepsValue != 0) { + yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + yearlyStatsAvgValue = yearlyStatsAvgValue / 1000; + } isYearlyDataLoaded = true; }); }).catchError((err) { @@ -457,16 +463,16 @@ class _DistanceTrackerState extends State with SingleTickerProv children: [ yearlyStepsList.isEmpty ? Container( - child: Center( - child: Text(TranslationBase.of(context).noDataAvailable), - ), - ) + child: Center( + child: Text(TranslationBase.of(context).noDataAvailable), + ), + ) : Table( - columnWidths: { - 0: FlexColumnWidth(2.5), - }, - children: fullData(context), - ), + columnWidths: { + 0: FlexColumnWidth(2.5), + }, + children: fullData(context), + ), ], ), ) @@ -549,7 +555,7 @@ class _DistanceTrackerState extends State with SingleTickerProv ), ); yearlyStepsList.forEach( - (step) { + (step) { tableRow.add( TableRow( children: [ @@ -559,7 +565,8 @@ class _DistanceTrackerState extends State with SingleTickerProv )} ', isCapitable: false, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(step.valueSum != null ? (step.valueSum / 1000).toString() + " " + TranslationBase.of(context).km_ : "0.0 " + TranslationBase.of(context).km_ , isCapitable: false, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(step.valueSum != null ? (step.valueSum / 1000).toString() + " " + TranslationBase.of(context).km_ : "0.0 " + TranslationBase.of(context).km_, + isCapitable: false, mProjectViewModel: projectViewModel), ], ), ); @@ -567,5 +574,4 @@ class _DistanceTrackerState extends State with SingleTickerProv ); return tableRow; } - } diff --git a/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart b/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart index 077ed4bf..5d4b8e4a 100644 --- a/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart +++ b/lib/pages/medical/smart_watch_health_data/heartrate/heartrateTracker.dart @@ -171,7 +171,9 @@ class _HeartRateTrackerState extends State with SingleTickerPr }); generateMonthData(); setState(() { - monthlyStatsAvgValue = avgMonthlyHearRateValue ~/ monthlyDataLength; + if (avgMonthlyHearRateValue != 0) { + monthlyStatsAvgValue = avgMonthlyHearRateValue ~/ monthlyDataLength; + } isMonthlyDataLoaded = true; }); }).catchError((err) { @@ -198,7 +200,9 @@ class _HeartRateTrackerState extends State with SingleTickerPr }); generateYearData(); setState(() { - yearlyStatsAvgValue = avgYearlyHearRateValue ~/ yearlyDataLength; + if (avgYearlyHearRateValue != 0) { + yearlyStatsAvgValue = avgYearlyHearRateValue ~/ yearlyDataLength; + } isYearlyDataLoaded = true; }); }).catchError((err) { diff --git a/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart b/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart index 5f63c2ad..3832d799 100644 --- a/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart +++ b/lib/pages/medical/smart_watch_health_data/steps/stepsTracker.dart @@ -136,7 +136,9 @@ class _StepsTrackerState extends State with SingleTickerProviderSt }); generateWeekData(); setState(() { - weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + if (avgWeeklyStepsValue != 0) { + weeklyStatsAvgValue = avgWeeklyStepsValue ~/ weeklyDataLength; + } isWeeklyDataLoaded = true; }); }).catchError((err) { @@ -163,7 +165,9 @@ class _StepsTrackerState extends State with SingleTickerProviderSt }); generateMonthData(); setState(() { - monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + if (avgMonthlyStepsValue != 0) { + monthlyStatsAvgValue = avgMonthlyStepsValue ~/ monthlyDataLength; + } isMonthlyDataLoaded = true; }); }).catchError((err) { @@ -190,7 +194,9 @@ class _StepsTrackerState extends State with SingleTickerProviderSt }); generateYearData(); setState(() { - yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + if (avgYearlyStepsValue != 0) { + yearlyStatsAvgValue = avgYearlyStepsValue ~/ yearlyDataLength; + } isYearlyDataLoaded = true; }); }).catchError((err) { diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart index 7b089935..f6ad1ce7 100644 --- a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart +++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart @@ -209,10 +209,6 @@ class _syncHealthDataButtonState extends State { Med_InsertTransactionsInputsList2.add(new healthData( MedCategoryID: 4, MedSubCategoryID: element['MedSubCategoryID'], MachineDate: DateUtil.convertDateToString(date), Value: element['Value'], TransactionsListID: TransactionsListID++)); } - // else if(element['MedCategoryID'] == 8){ - // - // totalCalories += element['Value'] ; - // } }); if (counter == 0) { diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 158de780..5ae0d119 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -28,15 +28,15 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE paymentType; - static String SERVICE_URL = - 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + // static String SERVICE_URL = + // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE - static String PREAUTH_SERVICE_URL = - 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT + // static String PREAUTH_SERVICE_URL = + // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT - // static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store + static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store // static String PRESCRIPTION_PAYMENT_WITH_ORDERID = // 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; From de86cffb8c7e1bbf291985c80c867ac23761af8d Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 8 Dec 2021 09:45:11 +0300 Subject: [PATCH 24/39] fix lakum issues --- lib/config/localized_values.dart | 2 + .../screens/cart-page/cart-order-preview.dart | 130 +++++++++++++++++- .../screens/cart-page/lakum_widget.dart | 32 +++++ .../cart-page/payment_bottom_widget.dart | 7 + .../screens/lacum-transfer-page.dart | 7 +- .../pharmacies/screens/lakum-main-page.dart | 2 + .../product-details/footor/footer-widget.dart | 5 +- .../screens/product-details/reviews_info.dart | 58 +++++--- lib/pages/pharmacy/order/OrderDetails.dart | 2 +- lib/pages/pharmacy/pharmacyContacts.dart | 7 +- lib/uitl/translations_delegate_base.dart | 4 + 11 files changed, 229 insertions(+), 27 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 7e0f8166..70f2e056 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -277,6 +277,8 @@ const Map localizedValues = { "viewAll": {"en": "View All", 'ar': 'عرض الكل'}, "view": {"en": "View", 'ar': 'عرض'}, "ContactUs": {"en": "Contact Us", 'ar': 'الوصول إلينا'}, + "contactUsLocation": {"en": "P.O.Box: 91877 - Riyadh 11643, King Fahad Road - Olaya - Kingdom of Saudi Arabia", 'ar': 'صندوق بريد: 91877 - الرياض 11643 ، طريق الملك فهد - العليا - المملكة العربية السعودية'}, + "contactUsTime": {"en": "Saturday - Wednesday 8:00 AM - 10 PM, Thursday 8:00 AM- 8:00 PM, Friday 2:00 PM - 8:00 PM", 'ar': " السبت – الأربعاء 08:00 ص – 10:00 م , الخميس 08:00 ص – 08:00 م, الجمعة 02:00 م - 08:00 م"}, "ViewAllWaysReachUs": {"en": "View All Ways Reach Us", 'ar': 'جميع طرق الاتصال بنا'}, "medicalProfile": {"en": "Medical Profile", 'ar': 'الملف الطبي'}, "consultation": {"en": "Consultation", "ar": "استشارة"}, diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart index 0110984c..559817c1 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_ import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_address_widget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; @@ -17,8 +18,11 @@ class OrderPreviewPage extends StatefulWidget { final List addresses; final OrderPreviewViewModel model; + + OrderPreviewPage({this.addresses, this.model}); + @override _OrderPreviewPageState createState() => _OrderPreviewPageState(); } @@ -26,6 +30,10 @@ class OrderPreviewPage extends StatefulWidget { class _OrderPreviewPageState extends State { MyInAppBrowser browser; bool isLoading = true; + bool isChecked = false; + + + @override void initState() { @@ -40,6 +48,7 @@ class _OrderPreviewPageState extends State { }); } + @override Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); @@ -74,7 +83,79 @@ class _OrderPreviewPageState extends State { ? Container( child: Column( children: [ - LakumWidget(widget.model), + // LakumWidget(widget.model), + Container( + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Row( + children: [ + SizedBox( + height: 24.0, + width: 24.0, + child: Checkbox( + activeColor: CustomColors.green, + value: isChecked, + onChanged: (bool value) { + setState(() { + isChecked = value; + print(isChecked); + if (value){ + // isChecked; + PaymentBottomWidget.isChecked = true; + print(value); + }else{ + PaymentBottomWidget.isChecked = false; + } + setState(() { + }); + }); + }, + ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + TranslationBase.of(context).useLakumPoints + + " (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)), + ), + ], + ), + Expanded( + child: Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "${TranslationBase.of(context).availableBalance}", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Text( + "${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56) + ), + ], + ), + ), + ], + ), + + ), + ), + + ], + ), + ), SizedBox( height: 10, ), @@ -190,7 +271,32 @@ class _OrderPreviewPageState extends State { indent: 0, endIndent: 0, ), + isChecked ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).lakum}", + fontSize: 14, + color: Colors.green, + fontWeight: FontWeight.w500, + ), + Texts( + "- ${TranslationBase.of(context).sar} ${(widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.green, + fontWeight: FontWeight.w500, + ), + ], + ) : Container(), + isChecked ? const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ): Container(), + isChecked ? Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Texts( @@ -200,7 +306,24 @@ class _OrderPreviewPageState extends State { fontWeight: FontWeight.bold, ), Texts( - "${TranslationBase.of(context).sar} ${(widget.model.cartResponse.totalAmount).toStringAsFixed(2)}", + " ${TranslationBase.of(context).sar}""${(widget.model.cartResponse.totalAmount - widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ) + : Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + " ${TranslationBase.of(context).sar} ${(widget.model.cartResponse.totalAmount).toStringAsFixed(2)}", fontSize: 14, color: Colors.black, fontWeight: FontWeight.bold, @@ -228,9 +351,12 @@ class _OrderPreviewPageState extends State { child: PaymentBottomWidget(widget.model), ), ); + } changeMainState() { setState(() {}); } + + } diff --git a/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart b/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart index 5d48fe1f..77c3d587 100644 --- a/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart @@ -1,5 +1,8 @@ +import 'dart:ui'; + import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-preview.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -9,6 +12,7 @@ import 'package:provider/provider.dart'; class LakumWidget extends StatefulWidget { final OrderPreviewViewModel model; + LakumWidget(this.model); @override @@ -41,6 +45,15 @@ class _LakumWidgetState extends State { setState(() { useLakumWidgets = value; print(useLakumWidgets); +// if (value){ +// // isChecked; +// OrderPreviewPage.isChecked = true; +// print(value); +// }else{ +// OrderPreviewPage.isChecked = false; +// } + setState(() { + }); }); }, ), @@ -150,6 +163,25 @@ class _LakumWidgetState extends State { // ), ), ), +// useLakumWidgets ? +// Row( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: [ +// Texts( +// "${TranslationBase.of(context).lakum}", +// fontSize: 14, +// color: Colors.black, +// fontWeight: FontWeight.w500, +// ), +// Texts( +// "${TranslationBase.of(context).sar} ${(widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance).toStringAsFixed(2)}", +// fontSize: 14, +// color: Colors.black, +// fontWeight: FontWeight.w500, +// ), +// ], +// ) +// :Container() ], ), ); diff --git a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart index 1931f3fa..00595711 100644 --- a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart @@ -16,6 +16,7 @@ import 'package:provider/provider.dart'; class PaymentBottomWidget extends StatelessWidget { final OrderPreviewViewModel model; + static bool isChecked = true; BuildContext context; MyInAppBrowser browser; @@ -42,6 +43,12 @@ class PaymentBottomWidget extends StatelessWidget { margin: EdgeInsets.symmetric(horizontal: 0, vertical: 4), child: Row( children: [ + isChecked ? Texts( + "${TranslationBase.of(context).sar} ${(model.cartResponse.totalAmount - model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", + fontSize: 14, + fontWeight: FontWeight.bold, + color: Color(0xff929295), + ): Texts( "${TranslationBase.of(context).sar} ${(model.cartResponse.totalAmount).toStringAsFixed(2)}", fontSize: 14, diff --git a/lib/pages/pharmacies/screens/lacum-transfer-page.dart b/lib/pages/pharmacies/screens/lacum-transfer-page.dart index b3995aca..057b444c 100644 --- a/lib/pages/pharmacies/screens/lacum-transfer-page.dart +++ b/lib/pages/pharmacies/screens/lacum-transfer-page.dart @@ -41,6 +41,9 @@ class _LacumTransferPageState extends State { isShowAppBar: true, isPharmacy: true, isShowDecPage: false, + showHomeAppBarIcon: false, + isBottomBar: true, + showPharmacyCart: false, backgroundColor: Colors.white, baseViewModel: model, body: Container( @@ -105,7 +108,7 @@ class _LacumTransferPageState extends State { CrossAxisAlignment.end, children: [ Texts( - "0", + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalance}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.white, @@ -165,7 +168,7 @@ class _LacumTransferPageState extends State { CrossAxisAlignment.end, children: [ Texts( - "0", + "${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}", fontSize: 14, fontWeight: FontWeight.bold, color: Colors.white, diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index 681be5a5..db441433 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -44,6 +44,8 @@ class LakumMainPage extends StatelessWidget { isPharmacy: true, showPharmacyCart: false, isShowDecPage: false, + showHomeAppBarIcon: false, + isBottomBar: true, backgroundColor: Colors.white, baseViewModel: model, appBarIcons: _buildAppBarICons(context, model), diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index 5d974cc4..44d9b2d7 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -227,7 +227,7 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, - margin: EdgeInsets.symmetric( vertical: 5.0), + margin: EdgeInsets.symmetric( vertical: 4.0), child: SecondaryButton( label: TranslationBase.of(context).addToCart, @@ -254,7 +254,8 @@ class _FooterWidgetState extends State { ), Container( width: MediaQuery.of(context).size.width * 0.35, - margin: EdgeInsets.symmetric( vertical: 5.0), + margin: EdgeInsets.symmetric( vertical: 4.0), + child: SecondaryButton( label: TranslationBase.of(context).buyNow, diff --git a/lib/pages/pharmacies/screens/product-details/reviews_info.dart b/lib/pages/pharmacies/screens/product-details/reviews_info.dart index c4526790..52efd3e9 100644 --- a/lib/pages/pharmacies/screens/product-details/reviews_info.dart +++ b/lib/pages/pharmacies/screens/product-details/reviews_info.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class ReviewsInfo extends StatelessWidget { @@ -13,6 +15,7 @@ class ReviewsInfo extends StatelessWidget { @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return previousModel.productDetailService.length != 0 && previousModel.productDetailService[0].reviews.length != 0 ? ListView.builder( @@ -48,18 +51,36 @@ class ReviewsInfo extends StatelessWidget { ), ), Container( - margin: EdgeInsets.only(left: 210), - child: RatingBar.readOnly( - initialRating: previousModel - .productDetailService[0].reviews[index].rating - .toDouble(), - size: 15.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + // margin: EdgeInsets.only(left: 210), + child: projectViewModel.isArabic? + Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: previousModel + .productDetailService[0].reviews[index].rating + .toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ): Align( + alignment: Alignment.topRight, + child: RatingBar.readOnly( + initialRating: previousModel + .productDetailService[0].reviews[index].rating + .toDouble(), + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), ), ), ], @@ -68,11 +89,14 @@ class ReviewsInfo extends StatelessWidget { SizedBox( height: 10, ), - Container( - child: Text( - previousModel - .productDetailService[0].reviews[index].reviewText, - style: TextStyle(fontSize: 20), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Text( + previousModel + .productDetailService[0].reviews[index].reviewText, + style: TextStyle(fontSize: 20), + ), ), ), SizedBox( diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index 6b7c957e..6ffe7131 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -715,7 +715,7 @@ class _OrderDetailsPageState extends State { Navigator.pop(context); Navigator.pop(context); } else { - AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration"); + AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration\فشلت العملية حاول مره اخرى"); } } } diff --git a/lib/pages/pharmacy/pharmacyContacts.dart b/lib/pages/pharmacy/pharmacyContacts.dart index 03a6c29d..61fbd61a 100644 --- a/lib/pages/pharmacy/pharmacyContacts.dart +++ b/lib/pages/pharmacy/pharmacyContacts.dart @@ -39,6 +39,7 @@ class _pharmacyContactsPageState extends State { showPharmacyCart: false, showHomeAppBarIcon: false, isMainPharmacyPages: true, + isBottomBar: true, body:Column( children: [ Card( @@ -64,7 +65,7 @@ class _pharmacyContactsPageState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Container( - child: Text("Saturday - Wednesday 8:00 AM - 10 PM, Thursday 8:00 AM- 8:00 PM, Friday 2:00 PM - -8:00 PM", + child: Text(TranslationBase.of(context).contactUsTime, style: TextStyle( color: Colors.grey[700], fontSize: 16, @@ -179,7 +180,7 @@ class _pharmacyContactsPageState extends State { ), Expanded( child: Text( - "P.O.BOX: 91877 - Riyadh 11643, King Fahad Road - Olaya - Kingdom of Saudi Arabia", + TranslationBase.of(context).contactUsLocation, style: TextStyle( color: Colors.grey[700], fontSize: 16, @@ -245,7 +246,7 @@ class _pharmacyContactsPageState extends State { openWhatsApp() async{ // bool Platform.isIOS = Theme.of(context).platform == TargetPlatform.iOS; - var whatsapp ="+699558434444"; + var whatsapp ="+966558434444"; var whatsappURL_android = "whatsapp://send?phone="+whatsapp; var whatappURL_ios ="https://wa.me/$whatsapp"; if(Platform.isIOS){ diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index cfe30e91..e69e36fb 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -591,6 +591,10 @@ class TranslationBase { String get contactUs => localizedValues['ContactUs'][locale.languageCode]; + String get contactUsLocation => localizedValues['contactUsLocation'][locale.languageCode]; + + String get contactUsTime => localizedValues['contactUsTime'][locale.languageCode]; + String get viewAllWaysReachUs => localizedValues['ViewAllWaysReachUs'][locale.languageCode]; String get medicalProfile => localizedValues['medicalProfile'][locale.languageCode]; From cf7dd13a8330a8499cc3e3216b3065c9063bda22 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 8 Dec 2021 11:45:36 +0300 Subject: [PATCH 25/39] fix issue --- .../screens/cart-page/cart-order-preview.dart | 149 +++++++++--------- 1 file changed, 76 insertions(+), 73 deletions(-) diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart index 559817c1..89b2725c 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart @@ -80,88 +80,91 @@ class _OrderPreviewPageState extends State { height: 10, ), widget.model.paymentCheckoutData.lacumInformation != null - ? Container( - child: Column( - children: [ - // LakumWidget(widget.model), - Container( - color: Colors.white, - padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), - child: Row( - children: [ - Row( - children: [ - SizedBox( - height: 24.0, - width: 24.0, - child: Checkbox( - activeColor: CustomColors.green, - value: isChecked, - onChanged: (bool value) { - setState(() { - isChecked = value; - print(isChecked); - if (value){ - // isChecked; - PaymentBottomWidget.isChecked = true; - print(value); - }else{ - PaymentBottomWidget.isChecked = false; - } + ? AbsorbPointer( + absorbing: true, + child: Container( + child: Column( + children: [ + // LakumWidget(widget.model), + Container( + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Row( + children: [ + SizedBox( + height: 24.0, + width: 24.0, + child: Checkbox( + activeColor: CustomColors.green, + value: isChecked, + onChanged: (bool value) { setState(() { + isChecked = value; + print(isChecked); + if (value){ + // isChecked; + PaymentBottomWidget.isChecked = true; + print(value); + }else{ + PaymentBottomWidget.isChecked = false; + } + setState(() { + }); }); - }); - }, + }, + ), ), - ), - Padding( - padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: Text( - TranslationBase.of(context).useLakumPoints + - " (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})", - style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)), - ), - ], - ), - Expanded( - child: Container( - decoration: BoxDecoration(color: Color(0x99ffffff)), - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - decoration: BoxDecoration(color: Color(0x99ffffff)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - "${TranslationBase.of(context).availableBalance}", - fontSize: 12, - fontWeight: FontWeight.bold, - ), - Text( - "${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}", - style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56) - ), - ], + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + TranslationBase.of(context).useLakumPoints + + " (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)), + ), + ], + ), + Expanded( + child: Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "${TranslationBase.of(context).availableBalance}", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Text( + "${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56) + ), + ], + ), ), - ), - ], - ), + ], + ), + ), ), - ), - ], + ], + ), ), - ), - SizedBox( - height: 10, - ), - ], + SizedBox( + height: 10, + ), + ], + ), ), - ) + ) : Container(), Container( color: Colors.white, From f9d1bbe2eeedec4723313c0873bae89d3eb58356 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 8 Dec 2021 14:34:09 +0300 Subject: [PATCH 26/39] disable lakum on check out page --- .../screens/cart-page/cart-order-preview.dart | 156 ++++++++++-------- 1 file changed, 83 insertions(+), 73 deletions(-) diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart index 89b2725c..dc8dc0d7 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart @@ -1,3 +1,5 @@ +import 'dart:ui'; + import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; @@ -82,88 +84,96 @@ class _OrderPreviewPageState extends State { widget.model.paymentCheckoutData.lacumInformation != null ? AbsorbPointer( absorbing: true, - child: Container( - child: Column( - children: [ - // LakumWidget(widget.model), - Container( - color: Colors.white, - padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), - child: Row( - children: [ - Row( + child: Stack( + children: [ + Container( + child: Column( + children: [ + // LakumWidget(widget.model), + Container( + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( children: [ - SizedBox( - height: 24.0, - width: 24.0, - child: Checkbox( - activeColor: CustomColors.green, - value: isChecked, - onChanged: (bool value) { - setState(() { - isChecked = value; - print(isChecked); - if (value){ - // isChecked; - PaymentBottomWidget.isChecked = true; - print(value); - }else{ - PaymentBottomWidget.isChecked = false; - } - setState(() { - }); - }); - }, - ), - ), - Padding( - padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: Text( - TranslationBase.of(context).useLakumPoints + - " (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})", - style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)), - ), - ], - ), - Expanded( - child: Container( - decoration: BoxDecoration(color: Color(0x99ffffff)), - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, + Row( children: [ - Container( - decoration: BoxDecoration(color: Color(0x99ffffff)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - "${TranslationBase.of(context).availableBalance}", - fontSize: 12, - fontWeight: FontWeight.bold, - ), - Text( - "${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}", - style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56) - ), - ], + SizedBox( + height: 24.0, + width: 24.0, + child: Checkbox( + activeColor: CustomColors.green, + value: isChecked, + onChanged: (bool value) { + setState(() { + isChecked = value; + print(isChecked); + if (value){ + // isChecked; + PaymentBottomWidget.isChecked = true; + print(value); + }else{ + PaymentBottomWidget.isChecked = false; + } + setState(() { + }); + }); + }, ), ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + TranslationBase.of(context).useLakumPoints + + " (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)), + ), ], ), + Expanded( + child: Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "${TranslationBase.of(context).availableBalance}", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Text( + "${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56) + ), + ], + ), + ), + ], + ), + + ), + ), - ), + ], ), - - ], - ), - ), - SizedBox( - height: 10, + ), + SizedBox( + height: 10, + ), + ], ), - ], - ), - ), + ), + Container( + height: MediaQuery.of(context).size.height * .10, + color: Colors.white.withOpacity(0.6), + ) + ], + ), ) : Container(), Container( From b09b1e4732b48c712e75957e7a15511d76618b34 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Thu, 9 Dec 2021 09:58:17 +0300 Subject: [PATCH 27/39] six issues --- lib/config/localized_values.dart | 3 +- lib/pages/pharmacies/search_brands_page.dart | 2 +- lib/pages/pharmacy/pharmacyContacts.dart | 32 +++++++++++++++----- lib/pages/pharmacy/profile/profile.dart | 4 +-- lib/pages/search_products_page.dart | 2 +- lib/uitl/translations_delegate_base.dart | 2 ++ 6 files changed, 33 insertions(+), 12 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 814ebe4b..83fedc90 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -50,7 +50,8 @@ const Map localizedValues = { 'searchByDocText': {'en': 'Type the name of the doctor to help you find him', 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه'}, 'enterDocName': {'en': 'Enter Doctor name', 'ar': 'أدخل إسم الطبيب'}, 'search': {'en': 'Search', 'ar': 'بحث'}, - 'noResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج الرجاء تغيير لغة البحث'}, + 'noResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج '}, + 'noSearchResultFound': {'en': 'No Result Found', 'ar': 'لم يتم العثور على نتائج الرجاء تغيير لغة البحث'}, 'pleaseEnterProductName': {'en': 'Please Enter Product Name', 'ar': 'ادخل اسم المنتج'}, 'bookNow': {'en': 'BOOK NOW', 'ar': 'احجز الآن'}, 'docInfo': {'en': 'Doctor Information', 'ar': 'معلومات الطبيب'}, diff --git a/lib/pages/pharmacies/search_brands_page.dart b/lib/pages/pharmacies/search_brands_page.dart index c452f82f..72dc3907 100644 --- a/lib/pages/pharmacies/search_brands_page.dart +++ b/lib/pages/pharmacies/search_brands_page.dart @@ -59,7 +59,7 @@ class _SearchBrandsPageState extends State { }, onSubmit: (value) { searchMedicine(model, context); - msg = TranslationBase.of(context).noResultFound; + msg = TranslationBase.of(context).noSearchResultFound; }, controller: textController, // validator: (value) { diff --git a/lib/pages/pharmacy/pharmacyContacts.dart b/lib/pages/pharmacy/pharmacyContacts.dart index 99af50f3..a4ce3a56 100644 --- a/lib/pages/pharmacy/pharmacyContacts.dart +++ b/lib/pages/pharmacy/pharmacyContacts.dart @@ -6,6 +6,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; +import 'dart:io' show Platform; class pharmacyContactsPage extends StatefulWidget { @override @@ -21,6 +23,7 @@ class _pharmacyContactsPageState extends State { final whatsApp = "+966558434444"; final whatappURL_android = "whatsapp://send?phone=" + whatsApp; final whatappURL_ios = "https://wa.me/$whatsApp"; + final locationDescription = "Main Pharmacy OLAYA"; return AppScaffold( appBarTitle: TranslationBase.of(context).contactUs, @@ -30,6 +33,7 @@ class _pharmacyContactsPageState extends State { showPharmacyCart: false, showHomeAppBarIcon: false, isMainPharmacyPages: true, + isBottomBar: true, body: Column( children: [ Card( @@ -143,10 +147,24 @@ class _pharmacyContactsPageState extends State { children: [ InkWell( onTap: () { - MapsLauncher.launchCoordinates( - double.parse(latitude), - double.parse(longitude)); - }, + if (Platform.isIOS) { MapLauncher.showMarker( + mapType: MapType.apple, + coords: Coords(double.parse(latitude), + double.parse(longitude)), + title: locationDescription,); + } else { MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(latitude), + double.parse(longitude)), + title: locationDescription, + // description: location.locationName, + ); } + // MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription); + }, +// MapsLauncher.launchCoordinates( +// double.parse(latitude), +// double.parse(longitude)); +// }, child: SvgPicture.asset( 'assets/images/pharmacy/location.svg', width: 20, @@ -182,7 +200,7 @@ class _pharmacyContactsPageState extends State { iconSize: 48, onPressed: () { setState(() { - launch("https://facebook.com/HMG"); + launch("https://facebook.com/HMG.pharmacy"); // launch("https://www.facebook.com/DrSulaimanAlHabib?ref=tn_tnmn"); }); }, @@ -194,7 +212,7 @@ class _pharmacyContactsPageState extends State { iconSize: 48, onPressed: () { setState(() { - launch("https://twitter.com/HMG"); + launch("https://twitter.com/HMG_pharmacy"); }); }, ), @@ -205,7 +223,7 @@ class _pharmacyContactsPageState extends State { iconSize: 48, onPressed: () { setState(() { - launch("https://instagram.com/HMG"); + launch("https://instagram.com/HMG_pharmacy"); }); }, ), diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 25c6e7d2..c92493dc 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -474,8 +474,8 @@ class _ProfilePageState extends State { SizedBox( width: 10, ), - Text( - TranslationBase.of(context).conditionsHMG, + Text( TranslationBase.of(context).termOfService, + // TranslationBase.of(context).conditionsHMG, style: TextStyle( fontSize: 13.0, ), diff --git a/lib/pages/search_products_page.dart b/lib/pages/search_products_page.dart index 79b3025e..d40d490f 100644 --- a/lib/pages/search_products_page.dart +++ b/lib/pages/search_products_page.dart @@ -71,7 +71,7 @@ class _SearchProductsPageState extends State { onSubmit: (value) { searchMedicine(model, context); // msg = 'No Result Found'; - msg = TranslationBase.of(context).noResultFound; + msg = TranslationBase.of(context).noSearchResultFound; }, controller: textController, ), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index e69e36fb..5fdcbb01 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -71,6 +71,8 @@ class TranslationBase { String get noResultFound => localizedValues['noResultFound'][locale.languageCode]; + String get noSearchResultFound => localizedValues['noSearchResultFound'][locale.languageCode]; + String get pleaseEnterProductName => localizedValues['pleaseEnterProductName'][locale.languageCode]; String get bookNow => localizedValues['bookNow'][locale.languageCode]; From 330f2d6c86d204a0ab58fb90aa767a16da93bb1a Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 9 Dec 2021 12:05:25 +0300 Subject: [PATCH 28/39] Fixes & updates --- lib/config/config.dart | 9 +++- lib/core/model/pharmacies/orders_model.dart | 3 ++ .../order_model_view_model.dart | 4 +- .../syncHealthData.dart | 50 +++++++++++++++++-- .../product-details/availability_info.dart | 35 ++++++------- .../pharmacies/widgets/home/BannerPager.dart | 3 +- lib/pages/pharmacy/order/OrderDetails.dart | 11 +--- .../orderDetails_service.dart | 4 +- .../pharmacy_services/order_service.dart | 2 +- .../pharmacy_services/wishList_service.dart | 25 +++++----- lib/widgets/hospital_location.dart | 32 +++++------- lib/widgets/in_app_browser/InAppBrowser.dart | 17 ++++--- 12 files changed, 114 insertions(+), 81 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 42861cce..f68ce30e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -68,7 +68,9 @@ const GET_DOCTOR_RATING_DETAILS = const GET_DOCTOR_RATING = 'Services/Doctors.svc/REST/dr_GetAvgDoctorRating'; ///Prescriptions -const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +// const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +const PRESCRIPTIONS = 'Services/Patients.svc/REST/GetPrescriptionApptList_Async'; + const GET_PRESCRIPTIONS_ALL_ORDERS = 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders'; const GET_PRESCRIPTION_REPORT = @@ -570,7 +572,10 @@ const TRANSFER_YAHALA_LOYALITY_POINTS = "Services/Patients.svc/REST/TransferYaHalaLoyaltyPoints"; const LAKUM_GET_USER_TERMS_AND_CONDITIONS = "Services/ERP.svc/REST/GetUserTermsAndConditionsForEPharmcy"; -const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; + +// const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList'; +const PRESCRIPTION = 'Services/Patients.svc/REST/GetPrescriptionApptList_Async'; + const GET_RECOMMENDED_PRODUCT = 'alsoProduct/'; const GET_MOST_VIEWED_PRODUCTS = "mostview"; const GET_NEW_PRODUCTS = "newproducts"; diff --git a/lib/core/model/pharmacies/orders_model.dart b/lib/core/model/pharmacies/orders_model.dart index cef20c30..ad2c533a 100644 --- a/lib/core/model/pharmacies/orders_model.dart +++ b/lib/core/model/pharmacies/orders_model.dart @@ -31,6 +31,7 @@ class Orders { String orderStatusn; bool canCancel; bool canRefund; + String orderGuid; dynamic customerId; dynamic orderSubtotalExclTax; dynamic orderShippingExclTax; @@ -47,6 +48,7 @@ class Orders { this.orderStatusn, this.canCancel, this.canRefund, + this.orderGuid, this.customerId, this.orderShippingExclTax, this.orderSubtotalExclTax, @@ -63,6 +65,7 @@ class Orders { orderStatusn = json['order_statusn']; canCancel = json['can_cancel']; canRefund = json['can_refund']; + orderGuid = json['order_guid']; customerId = json['customer_id']; orderSubtotalExclTax= json["order_subtotal_excl_tax"]; orderShippingExclTax= json["order_shipping_excl_tax"]; diff --git a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart index 7d6979cc..0ea53363 100644 --- a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart @@ -49,9 +49,9 @@ class OrderModelViewModel extends BaseViewModel { } } - Future getOrderDetails(OrderId) async { + Future getOrderDetails(OrderId, orderGUID) async { setState(ViewState.Busy); - await _orderDetailsService.getOrderDetails(OrderId); + await _orderDetailsService.getOrderDetails(OrderId, orderGUID); if (_orderDetailsService.hasError) { error = _orderDetailsService.error; setState(ViewState.Error); diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart index f6ad1ce7..5a0b95b5 100644 --- a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart +++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:collection/collection.dart'; import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart'; import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; @@ -8,6 +10,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:fit_kit/fit_kit.dart'; import 'package:flutter/material.dart'; +import 'package:health/health.dart'; import 'package:intl/intl.dart'; class syncHealthDataButton extends StatefulWidget { @@ -26,6 +29,8 @@ class syncHealthDataButton extends StatefulWidget { class _syncHealthDataButtonState extends State { List dataTypes = List(); + List _healthDataList = []; + List Med_InsertTransactionsInputsList = new List(); List Med_InsertTransactionsInputsList2 = new List(); @@ -56,12 +61,53 @@ class _syncHealthDataButtonState extends State { padding: const EdgeInsets.all(20.0), child: DefaultButton(TranslationBase.of(context).syncHealthData, () { print("ReadAll"); - readAll(); + fetchData(); + // readAll(); }), ), ); } + Future fetchData() async { + // get everything from midnight until now + DateTime startDate = DateTime(2021, 11, 01, 0, 0, 0); + DateTime endDate = DateTime(2021, 12, 06, 23, 59, 59); + + HealthFactory health = HealthFactory(); + + // define the types to get + List types = [ + HealthDataType.STEPS, + HealthDataType.HEART_RATE, + Platform.isAndroid ? HealthDataType.DISTANCE_DELTA : HealthDataType.DISTANCE_WALKING_RUNNING + ]; + + // you MUST request access to the data types before reading them + // bool accessWasGranted = await health.requestAuthorization(types); + await health.requestAuthorization(types); + + int steps = 0; + try { + List healthData = await health.getHealthDataFromTypes(startDate, endDate, types); + _healthDataList.addAll(healthData); + } catch (e) { + print("Caught exception in getHealthDataFromTypes: $e"); + } + + // filter out duplicates + _healthDataList = HealthFactory.removeDuplicates(_healthDataList); + + // print the results + _healthDataList.forEach((x) { + if(x.type == HealthDataType.STEPS) { + print("Data point: $x"); + steps += x.value.round(); + } + }); + + print("Steps: $steps"); + } + void readAll() async { TransactionsListID = 1; var MedSubCategoryID = 0; @@ -160,7 +206,6 @@ class _syncHealthDataButtonState extends State { void getAllHealthDataLists() { var totalSteps = 0.0; var totalDistance = 0.0; - // double totalCalories = 0.0 ; double totalHeartRate = 0.0; double avgTotalHeartRate = 0.0; var counter = 0; @@ -190,7 +235,6 @@ class _syncHealthDataButtonState extends State { value.forEach((element) { if (element['MedCategoryID'] == 6) { MedCategoryID = 6; - totalSteps += element['Value']; } else if (element['MedCategoryID'] == 7) { MedCategoryID = 7; diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index 5cacf64d..9264cac6 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -1,15 +1,16 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; -import 'package:maps_launcher/maps_launcher.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; import 'package:map_launcher/map_launcher.dart'; -import 'dart:io' show Platform; +import 'package:url_launcher/url_launcher.dart'; class AvailabilityInfo extends StatelessWidget { final ProductDetailViewModel previousModel; - const AvailabilityInfo({Key key, this.previousModel}) : super(key: key); + final InAppBrowser browser = new InAppBrowser(); + + AvailabilityInfo({Key key, this.previousModel}) : super(key: key); @override Widget build(BuildContext context) { @@ -22,8 +23,8 @@ class AvailabilityInfo extends StatelessWidget { ), ) : Container( - margin: EdgeInsets.only(bottom: 40), - child: ListView.builder( + margin: EdgeInsets.only(bottom: 40), + child: ListView.builder( physics: ScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, @@ -55,20 +56,14 @@ class AvailabilityInfo extends StatelessWidget { child: IconButton( icon: Icon(Icons.location_on), color: Colors.red, - onPressed: () { - if (Platform.isIOS) { MapLauncher.showMarker( - mapType: MapType.apple, - coords: Coords(double.parse(previousModel.productLocationService[index].latitude), - double.parse(previousModel.productLocationService[index].longitude)), - title: previousModel.productLocationService[index].locationDescription,); - } else { MapLauncher.showMarker( - mapType: MapType.google, - coords: Coords(double.parse(previousModel.productLocationService[index].latitude), - double.parse(previousModel.productLocationService[index].longitude)), + onPressed: () async { + // if (await MapLauncher.isMapAvailable(MapType.apple)) { + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude)), title: previousModel.productLocationService[index].locationDescription, - // description: location.locationName, - ); } - // MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription); + ); + // } }, ), ), @@ -90,7 +85,7 @@ class AvailabilityInfo extends StatelessWidget { ); }, ), - ); + ); } convertCityName(txt) { diff --git a/lib/pages/pharmacies/widgets/home/BannerPager.dart b/lib/pages/pharmacies/widgets/home/BannerPager.dart index 8c62f458..bf7ca715 100644 --- a/lib/pages/pharmacies/widgets/home/BannerPager.dart +++ b/lib/pages/pharmacies/widgets/home/BannerPager.dart @@ -104,7 +104,8 @@ class _BannerPagerState extends State { } break; case 2: { - Navigator.push(context, FadePage(page: LakumActivationVidaPage())); + // Navigator.push(context, FadePage(page: LakumActivationVidaPage())); + Navigator.push(context, FadePage(page: LakumMainPage())); } break; case 5: { diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index 6b7c957e..0a735d8c 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -74,7 +74,7 @@ class _OrderDetailsPageState extends State { this.context = context; return BaseView( onModelReady: (model) { - model.getOrderDetails(widget.orderModel.id).then((value) { + model.getOrderDetails(widget.orderModel.id, widget.orderModel.orderGuid).then((value) { setState(() { isActiveDelivery = (value.orderStatusId == 995 && (value.driverID != null && value.driverID.isNotEmpty)); }); @@ -533,10 +533,6 @@ class _OrderDetailsPageState extends State { model.orderListModel[0].orderStatusId == 10 ? InkWell( onTap: () { - print(widget.orderModel.toString()); - print(model.orderListModel.toString()); - print("calc = ${5.9 * 3}"); - // TODO MOSA openPayment(model.orderListModel[0], model.user); }, child: Container( @@ -672,11 +668,6 @@ class _OrderDetailsPageState extends State { } } - /*** - * - * Online payment methods - */ - openPayment( OrderDetailModel order, AuthenticatedUser authenticatedUser, diff --git a/lib/services/pharmacy_services/orderDetails_service.dart b/lib/services/pharmacy_services/orderDetails_service.dart index 2f4a1d56..3b03dabc 100644 --- a/lib/services/pharmacy_services/orderDetails_service.dart +++ b/lib/services/pharmacy_services/orderDetails_service.dart @@ -20,10 +20,10 @@ class OrderDetailsService extends BaseService{ List get orderList => _orderList; - Future getOrderDetails(OrderId) async { + Future getOrderDetails(OrderId, orderGUID) async { var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); hasError = false; - await baseAppClient.getPharmacy(GET_ORDER_DETAILS+OrderId + "/$customerGUID", + await baseAppClient.getPharmacy(GET_ORDER_DETAILS+OrderId + "/$orderGUID", onSuccess: (dynamic response, int statusCode) { _orderList.clear(); response['orders'].forEach((item) { diff --git a/lib/services/pharmacy_services/order_service.dart b/lib/services/pharmacy_services/order_service.dart index 373f2819..ed2391d8 100644 --- a/lib/services/pharmacy_services/order_service.dart +++ b/lib/services/pharmacy_services/order_service.dart @@ -20,7 +20,7 @@ class OrderService extends BaseService { hasError = false; // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId"; - url = GET_ORDER + "customer=1&fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc,product_count,can_cancel,can_refund&page=$pageId&limit=200&customer_id=$customerId&CustomerguId=$customerGUID"; + url = GET_ORDER + "customer=1&fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc,product_count,can_cancel,can_refund,order_guid&page=$pageId&limit=200&customer_id=$customerId&CustomerguId=$customerGUID"; print(url); await baseAppClient.getPharmacy(url, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/services/pharmacy_services/wishList_service.dart b/lib/services/pharmacy_services/wishList_service.dart index ce55a40b..ab347307 100644 --- a/lib/services/pharmacy_services/wishList_service.dart +++ b/lib/services/pharmacy_services/wishList_service.dart @@ -4,11 +4,11 @@ import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/pharmacy/Wishlist.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; - class WishListService extends BaseService { AppSharedPreferences sharedPref = AppSharedPreferences(); bool isLogin = false; List _wishListProducts = List(); + List get wishListProducts => _wishListProducts; // Future getWishlist() async { @@ -52,18 +52,17 @@ class WishListService extends BaseService { Future getWishlist() async { //TODO we need to check why the customer id comes null - String customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID)?? "0"; + String customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID) ?? "0"; + var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); hasError = false; - await baseAppClient.getPharmacy(GET_WISHLIST+customerId +"?shopping_cart_type=2", - onSuccess: (dynamic response, int statusCode) { - _wishListProducts.clear(); - response['shopping_carts'].forEach((item) { - _wishListProducts.add(Wishlist.fromJson(item)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }); + await baseAppClient.getPharmacy(GET_WISHLIST + customerId + "/$customerGUID/" + "?shopping_cart_type=2", onSuccess: (dynamic response, int statusCode) { + _wishListProducts.clear(); + response['shopping_carts'].forEach((item) { + _wishListProducts.add(Wishlist.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }); } - } diff --git a/lib/widgets/hospital_location.dart b/lib/widgets/hospital_location.dart index edd7f473..0e898ee1 100644 --- a/lib/widgets/hospital_location.dart +++ b/lib/widgets/hospital_location.dart @@ -2,21 +2,18 @@ import 'package:diplomaticquarterapp/core/model/contactus/get_hmg_locations.dart import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; -import 'package:maps_launcher/maps_launcher.dart'; +import 'package:map_launcher/map_launcher.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'package:map_launcher/map_launcher.dart'; import 'avatar/large_avatar.dart'; import 'my_rich_text.dart'; -import 'dart:io' show Platform; class HospitalLocation extends StatelessWidget { final GetHMGLocationsModel location; final bool showCity; final String waitingTime; - HospitalLocation(this.location, {Key key, this.showCity = false, this.waitingTime}) : super(key: key); @override @@ -76,20 +73,17 @@ class HospitalLocation extends StatelessWidget { ), Column( children: [ - contactButton(Icons.location_on, TranslationBase.of(context).locationa, () { - // MapsLauncher.launchCoordinates(double.parse(location.latitude), double.parse(location.longitude), location.locationName); - if (Platform.isIOS) { MapLauncher.showMarker( -// mapType: MapType.google, - mapType: MapType.apple, - coords: Coords(double.parse(location.latitude), double.parse(location.longitude)), - title: location.locationName,); - } else { MapLauncher.showMarker( - mapType: MapType.google, - coords: Coords(double.parse(location.latitude), double.parse(location.longitude)), - title: location.locationName, - // description: location.locationName, - ); }} - ), + contactButton( + Icons.location_on, + TranslationBase.of(context).locationa, + () async { + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(location.latitude), double.parse(location.longitude)), + title: location.locationName, + ); + }, + ), SizedBox(height: 10), contactButton(Icons.call, TranslationBase.of(context).callNow, () { launch("tel://" + location.phoneNumber); @@ -121,6 +115,4 @@ class HospitalLocation extends StatelessWidget { ), ); } - - } diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 5ae0d119..49e23271 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -28,15 +28,13 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE paymentType; - // static String SERVICE_URL = - // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE - // static String PREAUTH_SERVICE_URL = - // 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT + static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT - static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store + // static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store // static String PRESCRIPTION_PAYMENT_WITH_ORDERID = // 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; @@ -204,9 +202,14 @@ class MyInAppBrowser extends InAppBrowser { openPharmacyPaymentBrowser(OrderDetailModel order, double amount, String orderDesc, String transactionID, String emailId, String paymentMethod, String patientName, dynamic patientID, AuthenticatedUser authenticatedUser, InAppBrowser browser) { this.browser = browser; + MyChromeSafariBrowser safariBrowser = new MyChromeSafariBrowser(new MyInAppBrowser(), onExitCallback: browser.onExit, onLoadStartCallback: this.browser.onLoadStart, appo: this.appo); getPatientData(); generatePharmacyURL(order, amount, orderDesc, transactionID, emailId, paymentMethod, patientName, patientID, authenticatedUser).then((value) { - this.browser.openUrl(url: value); + if (order.customValuesXml.contains("ApplePay")) { + safariBrowser.open(url: value); + } else { + this.browser.openUrl(url: value); + } }); } From 9c0337aa01229459c4cab0e45d7c7b09655ff137 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 9 Dec 2021 15:14:27 +0300 Subject: [PATCH 29/39] updates & fixes --- .../pharmacies/PointsAmountPerMonth.dart | 6 ++--- lib/pages/BookAppointment/BookConfirm.dart | 7 +++--- .../widgets/AppointmentActions.dart | 22 ++++++++++++++++--- .../screens/lakum-points-year-page.dart | 2 +- .../product-details/availability_info.dart | 12 +++++----- lib/pages/settings/profile_setting.dart | 2 +- .../medical/LabResult/LabResultWidget.dart | 4 ++-- 7 files changed, 34 insertions(+), 21 deletions(-) diff --git a/lib/core/model/pharmacies/PointsAmountPerMonth.dart b/lib/core/model/pharmacies/PointsAmountPerMonth.dart index 71cf3498..c5b96bd8 100644 --- a/lib/core/model/pharmacies/PointsAmountPerMonth.dart +++ b/lib/core/model/pharmacies/PointsAmountPerMonth.dart @@ -1,11 +1,11 @@ import 'PointsAmountPerday.dart'; class PointsAmountPerMonth { - double amountPerMonth; - String month; + dynamic amountPerMonth; + dynamic month; int monthNumber; List pointsAmountPerday; - double pointsPerMonth; + dynamic pointsPerMonth; PointsAmountPerMonth( {this.amountPerMonth, diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index eb14805c..63e711e5 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -201,9 +201,9 @@ class _BookConfirmState extends State { disabledColor: new Color(0xFFbcc2c4), onPressed: () async { if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && !await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { - insertAppointment(context, widget.doctor); - } else { insertLiveCareScheduledAppointment(context, widget.doctor); + } else { + insertAppointment(context, widget.doctor); } }, child: Text(TranslationBase.of(context).bookAppo, style: TextStyle(fontSize: 16.0, letterSpacing: -0.48)), @@ -249,7 +249,7 @@ class _BookConfirmState extends State { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { Future.delayed(new Duration(milliseconds: 1500), () async { - if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && !await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertAppointment(context, widget.doctor); } else { insertLiveCareScheduledAppointment(context, widget.doctor); @@ -376,7 +376,6 @@ class _BookConfirmState extends State { getLiveCareAppointmentPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { widget.service.getLiveCareAppointmentPatientShare(appointmentNo, clinicID, projectID, context).then((res) { - print(res); widget.patientShareResponse = new PatientShareResponse.fromJson(res); GifLoaderDialogUtils.hideDialog(context); navigateToBookSuccess(context, docObject, widget.patientShareResponse); diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index acfe444f..fcf1b6f0 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_mode import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart'; +import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/AppointmentType.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ArrivedButtons.dart'; @@ -14,6 +15,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/models/BookedButtonsAl import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtons.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/ConfirmedButtonsAllowCheckIn.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/labs/laboratory_result_page.dart'; @@ -57,6 +59,7 @@ class _AppointmentActionsState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); + ToDoCountProviderModel model = Provider.of(context); var size = MediaQuery.of(context).size; final double itemHeight = projectViewModel.isArabic ? ((size.height - kToolbarHeight - 24) * 0.5) / 2 : ((size.height - kToolbarHeight - 24) * 0.45) / 2; final double itemWidth = size.width / 2; @@ -72,7 +75,7 @@ class _AppointmentActionsState extends State { onTap: shouldEnable ? null : () { - _handleButtonClicks(appoButtonsList[index]); + _handleButtonClicks(appoButtonsList[index], model); }, child: MedicalProfileItem( title: appoButtonsList[index].title, @@ -88,7 +91,7 @@ class _AppointmentActionsState extends State { ); } - _handleButtonClicks(AppoDetailsButton) { + _handleButtonClicks(AppoDetailsButton, ToDoCountProviderModel model) { switch (AppoDetailsButton.caller) { case "openReschedule": widget.tabController.animateTo((widget.tabController.index + 1) % 2); @@ -113,7 +116,8 @@ class _AppointmentActionsState extends State { ); break; case "goToTodoList": - Navigator.of(context).pop(); + // Navigator.of(context).pop(); + navigateToToDoPage(context, model); break; case "askDoc": askYourDoc(); @@ -556,6 +560,18 @@ class _AppointmentActionsState extends State { ))); } + navigateToToDoPage(BuildContext context, ToDoCountProviderModel model) { + if (widget.projectViewModel.isLogin) { + if (model.count != 0) { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).upcomingEmpty); + } + } else { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true))); + } + } + rateAppointment() { widget.browser = new MyInAppBrowser(); var url = 'http://hmg.com/SitePages/pso.aspx?p=' + widget.appo.projectID.toString() + '.' + widget.appo.appointmentNo.toString() + '&c=1'; diff --git a/lib/pages/pharmacies/screens/lakum-points-year-page.dart b/lib/pages/pharmacies/screens/lakum-points-year-page.dart index df333cdf..ba6e4537 100644 --- a/lib/pages/pharmacies/screens/lakum-points-year-page.dart +++ b/lib/pages/pharmacies/screens/lakum-points-year-page.dart @@ -66,7 +66,7 @@ class _LakumPointsYearPageState extends State { (index) => LakumPointTableRowWidget( false, widget.pointsAmountPerYear[widget.selectedIndexYear] - .pointsAmountPerMonth[index].month, + .pointsAmountPerMonth[index].month.toString(), widget.pointsAmountPerYear[widget.selectedIndexYear] .pointsAmountPerMonth[index].pointsPerMonth, widget.pointsAmountPerYear[widget.selectedIndexYear] diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index 9264cac6..209a97bf 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -57,13 +57,11 @@ class AvailabilityInfo extends StatelessWidget { icon: Icon(Icons.location_on), color: Colors.red, onPressed: () async { - // if (await MapLauncher.isMapAvailable(MapType.apple)) { - await MapLauncher.showMarker( - mapType: MapType.google, - coords: Coords(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude)), - title: previousModel.productLocationService[index].locationDescription, - ); - // } + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude)), + title: previousModel.productLocationService[index].locationDescription, + ); }, ), ), diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index 7f1f6a93..efb4ecae 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -280,7 +280,7 @@ class _ProfileSettings extends State with TickerProviderStateMi TextField( enabled: isEnable, scrollPadding: EdgeInsets.zero, - keyboardType: TextInputType.number, + keyboardType: TextInputType.emailAddress, controller: _controller, // onChanged: (value) => {validateForm()}, style: TextStyle( diff --git a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart index f4081c21..1d8972cc 100644 --- a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart +++ b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart @@ -187,7 +187,7 @@ class LabResultWidget extends StatelessWidget { ), Utils.tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: true), Utils.tableColumnValue(labResultList[i].referanceRange, isLast: true, isCapitable: false), - InkWell( + !checkIfCovidLab(patientLabResultList) ? InkWell( onTap: () { Navigator.push( context, @@ -203,7 +203,7 @@ class LabResultWidget extends StatelessWidget { padding: EdgeInsets.only(left: !projectViewModel.isArabic ? 0 : 12, right: !projectViewModel.isArabic ? 12 : 0), child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).viewFlowChart, isLast: true, isCapitable: false), ), - ), + ) : Container(), ], ), ); From 7bc8f69dfbbe467b70b5be30c428d4eb88f79c60 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 9 Dec 2021 16:10:09 +0300 Subject: [PATCH 30/39] JIRA bug fixes --- lib/models/Appointments/DoctorListResponse.dart | 3 +++ .../BookAppointment/widgets/DoctorView.dart | 17 +++++++++++++---- lib/pages/medical/doctor/doctor_home_page.dart | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 0da1a273..d43dceb3 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -9,6 +9,7 @@ class DoctorList { int actualDoctorRate; int clinicRoomNo; dynamic date; + dynamic appointmentDate; dynamic dayName; int doctorID; String doctorImageURL; @@ -53,6 +54,7 @@ class DoctorList { this.actualDoctorRate, this.clinicRoomNo, this.date, + this.appointmentDate, this.dayName, this.doctorID, this.doctorImageURL, @@ -97,6 +99,7 @@ class DoctorList { actualDoctorRate = json['ActualDoctorRate']; clinicRoomNo = json['ClinicRoomNo']; date = json['Date']; + appointmentDate = json['AppointmentDate']; dayName = json['DayName']; doctorID = json['DoctorID']; doctorImageURL = json['DoctorImageURL']; diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 1e2e48df..7ebc26ca 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -7,7 +7,6 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -54,9 +53,19 @@ class DoctorView extends StatelessWidget { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - doctor.name, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + Row( + children: [ + Expanded( + child: Text( + doctor.name, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Text( + DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctor.date)), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + ), + ], ), if (doctor.doctorTitle != null) SizedBox(height: 6), Row( diff --git a/lib/pages/medical/doctor/doctor_home_page.dart b/lib/pages/medical/doctor/doctor_home_page.dart index 28e1c1a9..ebf32924 100644 --- a/lib/pages/medical/doctor/doctor_home_page.dart +++ b/lib/pages/medical/doctor/doctor_home_page.dart @@ -72,6 +72,7 @@ class DoctorHomePage extends StatelessWidget { clinicName: _doctorList.clinicName, actualDoctorRate: _doctorList.actualDoctorRate, doctorID: _doctorList.doctorID, + date: _doctorList.appointmentDate, doctorRate: _doctorList.doctorRate, gender: _doctorList.gender, doctorTitle: _doctorList.doctorTitle, From d767febcd07d358ab62b433f070890f8fab98834 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Mon, 13 Dec 2021 10:43:37 +0300 Subject: [PATCH 31/39] fix search issue --- lib/core/service/pharmacy_categorise_service.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/core/service/pharmacy_categorise_service.dart b/lib/core/service/pharmacy_categorise_service.dart index 280022e0..ef8650c8 100644 --- a/lib/core/service/pharmacy_categorise_service.dart +++ b/lib/core/service/pharmacy_categorise_service.dart @@ -91,8 +91,11 @@ class PharmacyCategoriseService extends BaseService { Future searchProducts({String productName}) async { hasError = false; _searchList.clear(); + // the language ID in pharmacy is different not same in patient app, en == 1 , ar == 2 + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + var languageId = languageID == 'ar' ? 2 : 1; String endPoint = productName != null - ? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=1' + ? GET_SEARCH_PRODUCTS + "$productName" + '&language_id=' + "$languageId" : GET_SEARCH_PRODUCTS + ""; await baseAppClient.getPharmacy( endPoint, From 4c2410cfd590d320eb15d7b7eafb6f57b8c3cd7d Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 13 Dec 2021 11:11:22 +0300 Subject: [PATCH 32/39] Health plugin updated --- lib/config/config.dart | 6 +- .../parmacyModule/order-preview-service.dart | 2 +- .../components/LiveCareBookAppointment.dart | 2 + .../syncHealthData.dart | 168 ++++-------------- lib/widgets/in_app_browser/InAppBrowser.dart | 8 +- pubspec.yaml | 2 +- 6 files changed, 42 insertions(+), 146 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index f68ce30e..3ed8d764 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,8 +15,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; + const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -257,7 +257,7 @@ const GET_PATIENT_SHARE = //URL to get patient appointment history const GET_PATIENT_APPOINTMENT_HISTORY = - "Services/Doctors.svc/REST/PateintHasAppoimentHistory"; + "Services/Doctors.svc/REST/PateintHasAppoimentHistory_Async"; const DOCTOR_SCHEDULE_URL = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart index 52892641..b9368180 100644 --- a/lib/core/service/parmacyModule/order-preview-service.dart +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -201,7 +201,7 @@ class OrderPreviewService extends BaseService { orderBody['custom_values_xml'] = "PaymentOption:${getPaymentOptionName(paymentCheckoutData.paymentOption)}"; orderBody['shippingOption'] = paymentCheckoutData.shippingOption; orderBody['shipping_address'] = paymentCheckoutData.address; - orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints; + // orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints; List> itemsList = List(); shoppingCarts.forEach((item) { diff --git a/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart b/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart index ee3e7b4a..7901d7b6 100644 --- a/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart +++ b/lib/pages/BookAppointment/components/LiveCareBookAppointment.dart @@ -24,6 +24,8 @@ class _LiveCareBookAppointmentState extends State { @override Widget build(BuildContext context) { return AppScaffold( + showNewAppBarTitle: true, + showNewAppBar: true, appBarTitle: TranslationBase.of(context).bookAppo, isShowAppBar: true, isShowDecPage: false, diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart index 5a0b95b5..a81dce6a 100644 --- a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart +++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart @@ -8,10 +8,8 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:fit_kit/fit_kit.dart'; import 'package:flutter/material.dart'; import 'package:health/health.dart'; -import 'package:intl/intl.dart'; class syncHealthDataButton extends StatefulWidget { double marginTop; @@ -27,8 +25,6 @@ class syncHealthDataButton extends StatefulWidget { } class _syncHealthDataButtonState extends State { - List dataTypes = List(); - List _healthDataList = []; List Med_InsertTransactionsInputsList = new List(); @@ -44,12 +40,6 @@ class _syncHealthDataButtonState extends State { @override void initState() { - dataTypes.add(DataType.DISTANCE); - dataTypes.add(DataType.STEP_COUNT); - dataTypes.add(DataType.HEART_RATE); - // dataTypes.add(DataType.SLEEP); - // dataTypes.add(DataType.ENERGY); - super.initState(); } @@ -61,53 +51,13 @@ class _syncHealthDataButtonState extends State { padding: const EdgeInsets.all(20.0), child: DefaultButton(TranslationBase.of(context).syncHealthData, () { print("ReadAll"); - fetchData(); - // readAll(); + // fetchData(); + readAll(); }), ), ); } - Future fetchData() async { - // get everything from midnight until now - DateTime startDate = DateTime(2021, 11, 01, 0, 0, 0); - DateTime endDate = DateTime(2021, 12, 06, 23, 59, 59); - - HealthFactory health = HealthFactory(); - - // define the types to get - List types = [ - HealthDataType.STEPS, - HealthDataType.HEART_RATE, - Platform.isAndroid ? HealthDataType.DISTANCE_DELTA : HealthDataType.DISTANCE_WALKING_RUNNING - ]; - - // you MUST request access to the data types before reading them - // bool accessWasGranted = await health.requestAuthorization(types); - await health.requestAuthorization(types); - - int steps = 0; - try { - List healthData = await health.getHealthDataFromTypes(startDate, endDate, types); - _healthDataList.addAll(healthData); - } catch (e) { - print("Caught exception in getHealthDataFromTypes: $e"); - } - - // filter out duplicates - _healthDataList = HealthFactory.removeDuplicates(_healthDataList); - - // print the results - _healthDataList.forEach((x) { - if(x.type == HealthDataType.STEPS) { - print("Data point: $x"); - steps += x.value.round(); - } - }); - - print("Steps: $steps"); - } - void readAll() async { TransactionsListID = 1; var MedSubCategoryID = 0; @@ -115,91 +65,37 @@ class _syncHealthDataButtonState extends State { GifLoaderDialogUtils.showMyDialog(context); Med_InsertTransactionsInputsList.clear(); - var date; - var differenceInHours; - String strDifferenceInHours; - var differenceInMinutes; - String strDifferenceInMinutes; - var today = DateTime.now(); - var yearNum = DateFormat('y').format(today).toString(); - - var firstDayOfTheYear = DateTime.parse(yearNum + "-" + "01" + "-" + "01"); - - if (await FitKit.requestPermissions(dataTypes)) { - for (DataType type in dataTypes) { - final results = await FitKit.read( - type, - dateFrom: firstDayOfTheYear, - dateTo: DateTime.now(), - limit: 1000, - ); - - if (type == DataType.DISTANCE) { - MedCategoryID = 7; - } else if (type == DataType.STEP_COUNT) { - MedCategoryID = 6; - } else if (type == DataType.HEART_RATE) { - MedCategoryID = 3; - } + DateTime startDate = DateTime.now().subtract(new Duration(days: 30)); - results.forEach((result) { - // print("in forEach"); - date = result.dateTo; - if (result.value.runtimeType.toString() == "int") { - value = double.parse(result.value.toString()); - } else { - value = result.value; - } - - MedSubCategoryID = 0; - - if (MedCategoryID == 4) { - differenceInHours = null; - var sleepDate = result.dateFrom.toString().substring(0, 10); - - DateTime dateFrom = result.dateFrom; - DateTime dateTo = result.dateTo; - - differenceInMinutes = dateTo.difference(dateFrom).inMinutes; - differenceInMinutes > 59 ? differenceInHours = differenceInMinutes / 60 : differenceInMinutes = differenceInMinutes; - - if (differenceInHours != null && differenceInHours != 0) { - differenceInHours = differenceInHours.toInt(); - differenceInMinutes = differenceInMinutes % 60; - - differenceInHours < 10 ? strDifferenceInHours = "0" + differenceInHours.toString() : strDifferenceInHours = differenceInHours.toString(); - } else { - strDifferenceInHours = "00"; - differenceInHours = 00; - } - differenceInMinutes < 10 ? strDifferenceInMinutes = "0" + differenceInMinutes.toString() : strDifferenceInMinutes = differenceInMinutes.toString(); - - sleepDate = DateTime.parse(sleepDate + " " + strDifferenceInHours + ":" + strDifferenceInMinutes + ":" + "00.00").toString(); - String hours = sleepDate.substring(11, sleepDate.indexOf(":")); - print(hours); - - String minutes = sleepDate.substring(sleepDate.indexOf(":") + 1, sleepDate.indexOf(":") + 3); - print(minutes); - - if (value == 0 || value == 109) { - print("in Bed"); - MedSubCategoryID = 1; - value = double.parse(hours + "." + minutes); - print("value"); - print(value); - } else if (value == 1 || value == 110) { - print("Sleep"); - MedSubCategoryID = 2; - value = double.parse(hours + "." + minutes); - print("value"); - print(value); - } - } - date = DateUtil.convertDateToString(date); - Med_InsertTransactionsInputsList.add(healthData(MedCategoryID: MedCategoryID, MedSubCategoryID: MedSubCategoryID, MachineDate: date, Value: value, TransactionsListID: TransactionsListID++)); - }); - } + HealthFactory health = HealthFactory(); + List types = [HealthDataType.STEPS, HealthDataType.HEART_RATE, Platform.isAndroid ? HealthDataType.DISTANCE_DELTA : HealthDataType.DISTANCE_WALKING_RUNNING]; + + await health.requestAuthorization(types); + + try { + List healthData = await health.getHealthDataFromTypes(startDate, DateTime.now(), types); + _healthDataList.addAll(healthData); + } catch (e) { + print("Caught exception in getHealthDataFromTypes: $e"); } + + _healthDataList = HealthFactory.removeDuplicates(_healthDataList); + + _healthDataList.forEach((x) { + if (x.type == HealthDataType.STEPS) { + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: 6, MedSubCategoryID: MedSubCategoryID, MachineDate: DateUtil.convertDateToString(x.dateFrom), Value: x.value, TransactionsListID: TransactionsListID++)); + } + if (x.type == HealthDataType.HEART_RATE) { + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: 3, MedSubCategoryID: MedSubCategoryID, MachineDate: DateUtil.convertDateToString(x.dateFrom), Value: x.value, TransactionsListID: TransactionsListID++)); + } + if (x.type == HealthDataType.DISTANCE_DELTA || x.type == HealthDataType.DISTANCE_WALKING_RUNNING) { + Med_InsertTransactionsInputsList.add( + healthData(MedCategoryID: 7, MedSubCategoryID: MedSubCategoryID, MachineDate: DateUtil.convertDateToString(x.dateFrom), Value: x.value, TransactionsListID: TransactionsListID++)); + } + }); + getAllHealthDataLists(); } @@ -238,10 +134,8 @@ class _syncHealthDataButtonState extends State { totalSteps += element['Value']; } else if (element['MedCategoryID'] == 7) { MedCategoryID = 7; - // to convert from meter to km totalDistance += (element['Value'] * 0.001); } else if (element['MedCategoryID'] == 3) { - // print("HeartRate"); MedCategoryID = 3; counter++; totalHeartRate += element['Value']; diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 49e23271..6e0e6c51 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -28,13 +28,13 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE paymentType; - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE - static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT + // static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT - // static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store + static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store // static String PRESCRIPTION_PAYMENT_WITH_ORDERID = // 'https://uat.hmgwebservices.com/epharmacy/checkout/OpcCompleteRedirectionPaymentClientbyOrder?orderID='; diff --git a/pubspec.yaml b/pubspec.yaml index 5b1b0a1f..8dd0f73f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,7 +30,7 @@ dependencies: get_it: ^4.0.2 #Google Fit & Apple HealthKit - fit_kit: ^1.1.2 + health: ^3.0.3 #chart fl_chart: ^0.12.3 From 684add0090a765a40e0c6b28ff794272e38d1037 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 13 Dec 2021 14:32:18 +0300 Subject: [PATCH 33/39] merge improvements --- lib/widgets/in_app_browser/InAppBrowser.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index a1fe551f..9e363e4d 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -206,7 +206,7 @@ class MyInAppBrowser extends InAppBrowser { getPatientData(); generatePharmacyURL(order, amount, orderDesc, transactionID, emailId, paymentMethod, patientName, patientID, authenticatedUser).then((value) { if (order.customValuesXml.contains("ApplePay")) { - safariBrowser.open(url: value); + safariBrowser.open(url: Uri.parse(value)); } else { this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(value))); } From 63ffabcc864a4ca82b1784a2463a872e857ae738 Mon Sep 17 00:00:00 2001 From: Zohaib Iqbal Kambrani <> Date: Tue, 14 Dec 2021 10:20:21 +0300 Subject: [PATCH 34/39] no message --- android/app/agconnect-services.json | 66 +- android/app/build.gradle | 12 +- android/app/proguard-rules.pro | 25 +- android/app/src/main/AndroidManifest.xml | 31 + .../CustomFlutterHmsMessageService.java | 56 ++ android/build.gradle | 5 +- .../gradle/wrapper/gradle-wrapper.properties | 6 +- ios/Podfile | 87 +- ios/Podfile.lock | 824 +++++------------- .../contents.xcworkspacedata | 2 +- ios/Runner/AppDelegate.swift | 4 +- ios/Runner/Helper/OpenTokPlatformBridge.swift | 85 +- ios/Runner/OpenTok/OpenTok.swift | 317 +++---- lib/main.dart | 8 +- .../conference/web_rtc/call_home_page.dart | 277 ++---- .../conference/web_rtc/call_home_page_.dart | 186 ++++ .../web_rtc/widgets/cam_view_widget.dart | 34 +- lib/pages/landing/landing_page.dart | 236 +---- lib/pages/livecare/incoming_call.dart | 116 +-- lib/uitl/app_shared_preferences.dart | 2 +- lib/uitl/navigation_service.dart | 13 +- lib/uitl/push-notification-handler.dart | 279 ++++++ pubspec.yaml | 7 +- 23 files changed, 1191 insertions(+), 1487 deletions(-) create mode 100644 android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/bkp_files/CustomFlutterHmsMessageService.java create mode 100644 lib/pages/conference/web_rtc/call_home_page_.dart create mode 100644 lib/uitl/push-notification-handler.dart diff --git a/android/app/agconnect-services.json b/android/app/agconnect-services.json index cfdaf83b..91aad2c7 100644 --- a/android/app/agconnect-services.json +++ b/android/app/agconnect-services.json @@ -1,6 +1,21 @@ { + "agcgw":{ + "backurl":"connect-drcn.hispace.hicloud.com", + "url":"connect-drcn.dbankcloud.cn", + "websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com", + "websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn" + }, + "agcgw_all":{ + "CN":"connect-drcn.dbankcloud.cn", + "CN_back":"connect-drcn.hispace.hicloud.com", + "DE":"connect-dre.dbankcloud.cn", + "DE_back":"connect-dre.hispace.hicloud.com", + "RU":"connect-drru.dbankcloud.cn", + "RU_back":"connect-drru.hispace.hicloud.com", + "SG":"connect-dra.dbankcloud.cn", + "SG_back":"connect-dra.hispace.hicloud.com" + }, "client":{ - "appType":"1", "cp_id":"2640966000002322881", "product_id":"736430079244816567", "client_id":"563735388191982656", @@ -10,5 +25,50 @@ "api_key":"CgB6e3x9DJzMgRCmnT6dyUEkp6UsIfddb6l3w0ZEXzeiRMHEFi3400Z5fJ5qaHneU0OrAI/JRpk+DMGVs3QpUxlI", "package_name":"com.ejada.hmg" }, - "configuration_version":"1.0" -} \ No newline at end of file + "oauth_client":{ + "client_id":"102857389", + "client_type":1 + }, + "app_info":{ + "app_id":"102857389", + "package_name":"com.ejada.hmg" + }, + "service":{ + "analytics":{ + "collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn", + "collector_url_ru":"datacollector-drru.dt.hicloud.com,datacollector-drru.dt.dbankcloud.cn", + "collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn", + "collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn", + "collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn", + "resource_id":"p1", + "channel_id":"" + }, + "search":{ + "url":"https://search-drcn.cloud.huawei.com" + }, + "cloudstorage":{ + "storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn" + }, + "ml":{ + "mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn" + } + }, + "region":"CN", + "configuration_version":"3.0", + "appInfos":[ + { + "package_name":"com.ejada.hmg", + "client":{ + "app_id":"102857389" + }, + "app_info":{ + "package_name":"com.ejada.hmg", + "app_id":"102857389" + }, + "oauth_client":{ + "client_type":1, + "client_id":"102857389" + } + } + ] +} diff --git a/android/app/build.gradle b/android/app/build.gradle index 25230849..79a27897 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -67,6 +67,7 @@ android { } release { signingConfig signingConfigs.config + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } staging { // Specifies a sorted list of fallback build types that the @@ -77,6 +78,15 @@ android { matchingFallbacks = ['debug', 'qa', 'release'] } } + + packagingOptions { + exclude 'META-INF/proguard/androidx-annotations.pro' + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } } flutter { @@ -112,7 +122,7 @@ dependencies { implementation "com.opentok.android:opentok-android-sdk:2.19.1" - compile 'com.facebook.stetho:stetho:1.5.1' + implementation 'com.facebook.stetho:stetho:1.5.1' implementation 'com.facebook.stetho:stetho-urlconnection:1.5.1' diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index 4ace459d..cfab1fd6 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -1,4 +1,27 @@ -keep class tvi.webrtc.** { *; } -keep class com.twilio.video.** { *; } -keep class com.twilio.common.** { *; } --keepattributes InnerClasses \ No newline at end of file +-keepattributes InnerClasses + +-keep class com.ejada.** { *; } +-keep class org.webrtc.** { *; } + +-ignorewarnings +-keepattributes *Annotation* +-keepattributes Exceptions +-keepattributes InnerClasses +-keepattributes Signature +-keep class com.hianalytics.android.**{*;} +-keep class com.huawei.updatesdk.**{*;} +-keep class com.huawei.hms.**{*;} + +## Flutter wrapper +-keep class io.flutter.app.** { *; } +-keep class io.flutter.plugin.** { *; } +-keep class io.flutter.util.** { *; } +-keep class io.flutter.view.** { *; } +-keep class io.flutter.** { *; } +-keep class io.flutter.plugins.** { *; } +-dontwarn io.flutter.embedding.** +-keep class com.huawei.hms.flutter.** { *; } +-repackageclasses \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 8aa7ad73..07242edb 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -46,6 +46,8 @@ android:showOnLockScreen="true" android:screenOrientation="sensorPortrait" android:label="Dr. Alhabib"> + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/bkp_files/CustomFlutterHmsMessageService.java b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/bkp_files/CustomFlutterHmsMessageService.java new file mode 100644 index 00000000..c96a60af --- /dev/null +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/bkp_files/CustomFlutterHmsMessageService.java @@ -0,0 +1,56 @@ +/* +* --------------- +* Note: Todo +* --------------- +* Need to be place in huawei_push (package com.huawei.hms.flutter.push.hms) and define in huawei_push manifest.xml +* */ + +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.util.Log; + +import com.huawei.hms.flutter.push.hms.FlutterHmsMessageService; +import com.huawei.hms.flutter.push.utils.ApplicationUtils; + +import org.json.JSONObject; + +//package com.huawei.hms.flutter.push.hms +// +// +//import android.content.Context; +//import android.content.Intent; +//import android.content.SharedPreferences; +// +//import com.huawei.hms.flutter.push.hms.FlutterHmsMessageService; +//import com.huawei.hms.flutter.push.utils.ApplicationUtils; +//import com.huawei.hms.push.RemoteMessage; +// +//import org.json.JSONObject; +// +//public class CustomFlutterHmsMessageService extends FlutterHmsMessageService { +// @Override +// public void onMessageReceived(RemoteMessage remoteMessage) { +// super.onMessageReceived(remoteMessage); +// try { +// String jsonStr = remoteMessage.getData(); +// JSONObject json_data = new JSONObject(jsonStr); +// JSONObject json_data_data = new JSONObject(json_data.getString("data")); +// if(json_data_data.getString("is_call").equalsIgnoreCase("true")){ +// boolean isApplicationInForeground = ApplicationUtils.isApplicationInForeground(this); +// if(!isApplicationInForeground){ +// SharedPreferences preferences = getSharedPreferences("FlutterSharedPreferences", Context.MODE_PRIVATE); +// preferences.edit().putString("flutter.call_data", json_data.getString("data")).apply(); +// +// Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName()); +// intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); +// startActivity(intent); +// Log.v("onMessageReceived", "startActivity(intent) called"); +// } +// } +// +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +//} diff --git a/android/build.gradle b/android/build.gradle index ecb1ed70..b33d5f1b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -11,10 +11,11 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.5.4' + classpath 'com.android.tools.build:gradle:7.0.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.3.8' - classpath 'com.huawei.agconnect:agcp:1.4.2.301' +// classpath 'com.huawei.agconnect:agcp:1.4.2.301' + classpath 'com.huawei.agconnect:agcp:1.5.2.300' } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 6fdb0e44..09db0fed 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Jul 14 15:55:18 AST 2021 +#Sun Dec 12 12:44:08 AST 2021 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/ios/Podfile b/ios/Podfile index 46c98373..1e8c3c90 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,9 +1,8 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '10.0' +# platform :ios, '9.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' -$FirebaseAnalyticsWithoutAdIdSupport = true project 'Runner', { 'Debug' => :debug, @@ -11,86 +10,32 @@ project 'Runner', { 'Release' => :release, } -# pod 'FBSDKCoreKit' -# pod 'FBSDKLoginKit' - -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end - generated_key_values = {} - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) do |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - generated_key_values[podname] = podpath - else - puts "Invalid plugin specification: #{line}" - end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches end - generated_key_values + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + target 'Runner' do use_frameworks! use_modular_headers! - # Native Pods - pod 'NVActivityIndicatorView' - pod 'OpenTok' - - - # Flutter Pod - copied_flutter_dir = File.join(__dir__, 'Flutter') - copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') - copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') - unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) - # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. - # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. - # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. - - generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') - unless File.exist?(generated_xcode_build_settings_path) - raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) - cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; - - unless File.exist?(copied_framework_path) - FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) - end - unless File.exist?(copied_podspec_path) - FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) - end - end - - # Keep pod path relative so it can be checked into Podfile.lock. - pod 'Flutter', :path => 'Flutter' - - # Plugin Pods - - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.each do |name, path| - symlink = File.join('.symlinks', 'plugins', name) - File.symlink(path, symlink) - pod name, :path => File.join(symlink, 'ios') - end + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end post_install do |installer| installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end + flutter_additional_ios_build_settings(target) end end - diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 565b2db9..169a7b58 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,246 +1,16 @@ PODS: - - abseil/algorithm (0.20200225.0): - - abseil/algorithm/algorithm (= 0.20200225.0) - - abseil/algorithm/container (= 0.20200225.0) - - abseil/algorithm/algorithm (0.20200225.0): - - abseil/base/config - - abseil/algorithm/container (0.20200225.0): - - abseil/algorithm/algorithm - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/base (0.20200225.0): - - abseil/base/atomic_hook (= 0.20200225.0) - - abseil/base/base (= 0.20200225.0) - - abseil/base/base_internal (= 0.20200225.0) - - abseil/base/bits (= 0.20200225.0) - - abseil/base/config (= 0.20200225.0) - - abseil/base/core_headers (= 0.20200225.0) - - abseil/base/dynamic_annotations (= 0.20200225.0) - - abseil/base/endian (= 0.20200225.0) - - abseil/base/errno_saver (= 0.20200225.0) - - abseil/base/exponential_biased (= 0.20200225.0) - - abseil/base/log_severity (= 0.20200225.0) - - abseil/base/malloc_internal (= 0.20200225.0) - - abseil/base/periodic_sampler (= 0.20200225.0) - - abseil/base/pretty_function (= 0.20200225.0) - - abseil/base/raw_logging_internal (= 0.20200225.0) - - abseil/base/spinlock_wait (= 0.20200225.0) - - abseil/base/throw_delegate (= 0.20200225.0) - - abseil/base/atomic_hook (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/base (0.20200225.0): - - abseil/base/atomic_hook - - abseil/base/base_internal - - abseil/base/config - - abseil/base/core_headers - - abseil/base/dynamic_annotations - - abseil/base/log_severity - - abseil/base/raw_logging_internal - - abseil/base/spinlock_wait - - abseil/meta/type_traits - - abseil/base/base_internal (0.20200225.0): - - abseil/base/config - - abseil/meta/type_traits - - abseil/base/bits (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/config (0.20200225.0) - - abseil/base/core_headers (0.20200225.0): - - abseil/base/config - - abseil/base/dynamic_annotations (0.20200225.0) - - abseil/base/endian (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/errno_saver (0.20200225.0): - - abseil/base/config - - abseil/base/exponential_biased (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/log_severity (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/malloc_internal (0.20200225.0): - - abseil/base/base - - abseil/base/base_internal - - abseil/base/config - - abseil/base/core_headers - - abseil/base/dynamic_annotations - - abseil/base/raw_logging_internal - - abseil/base/periodic_sampler (0.20200225.0): - - abseil/base/core_headers - - abseil/base/exponential_biased - - abseil/base/pretty_function (0.20200225.0) - - abseil/base/raw_logging_internal (0.20200225.0): - - abseil/base/atomic_hook - - abseil/base/config - - abseil/base/core_headers - - abseil/base/log_severity - - abseil/base/spinlock_wait (0.20200225.0): - - abseil/base/base_internal - - abseil/base/core_headers - - abseil/base/errno_saver - - abseil/base/throw_delegate (0.20200225.0): - - abseil/base/config - - abseil/base/raw_logging_internal - - abseil/container/compressed_tuple (0.20200225.0): - - abseil/utility/utility - - abseil/container/inlined_vector (0.20200225.0): - - abseil/algorithm/algorithm - - abseil/base/core_headers - - abseil/base/throw_delegate - - abseil/container/inlined_vector_internal - - abseil/memory/memory - - abseil/container/inlined_vector_internal (0.20200225.0): - - abseil/base/core_headers - - abseil/container/compressed_tuple - - abseil/memory/memory - - abseil/meta/type_traits - - abseil/types/span - - abseil/memory (0.20200225.0): - - abseil/memory/memory (= 0.20200225.0) - - abseil/memory/memory (0.20200225.0): - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/meta (0.20200225.0): - - abseil/meta/type_traits (= 0.20200225.0) - - abseil/meta/type_traits (0.20200225.0): - - abseil/base/config - - abseil/numeric/int128 (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/strings/internal (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/base/endian - - abseil/base/raw_logging_internal - - abseil/meta/type_traits - - abseil/strings/str_format (0.20200225.0): - - abseil/strings/str_format_internal - - abseil/strings/str_format_internal (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/numeric/int128 - - abseil/strings/strings - - abseil/types/span - - abseil/strings/strings (0.20200225.0): - - abseil/base/base - - abseil/base/bits - - abseil/base/config - - abseil/base/core_headers - - abseil/base/endian - - abseil/base/raw_logging_internal - - abseil/base/throw_delegate - - abseil/memory/memory - - abseil/meta/type_traits - - abseil/numeric/int128 - - abseil/strings/internal - - abseil/time (0.20200225.0): - - abseil/time/internal (= 0.20200225.0) - - abseil/time/time (= 0.20200225.0) - - abseil/time/internal (0.20200225.0): - - abseil/time/internal/cctz (= 0.20200225.0) - - abseil/time/internal/cctz (0.20200225.0): - - abseil/time/internal/cctz/civil_time (= 0.20200225.0) - - abseil/time/internal/cctz/time_zone (= 0.20200225.0) - - abseil/time/internal/cctz/civil_time (0.20200225.0): - - abseil/base/config - - abseil/time/internal/cctz/time_zone (0.20200225.0): - - abseil/base/config - - abseil/time/internal/cctz/civil_time - - abseil/time/time (0.20200225.0): - - abseil/base/base - - abseil/base/core_headers - - abseil/base/raw_logging_internal - - abseil/numeric/int128 - - abseil/strings/strings - - abseil/time/internal/cctz/civil_time - - abseil/time/internal/cctz/time_zone - - abseil/types (0.20200225.0): - - abseil/types/any (= 0.20200225.0) - - abseil/types/bad_any_cast (= 0.20200225.0) - - abseil/types/bad_any_cast_impl (= 0.20200225.0) - - abseil/types/bad_optional_access (= 0.20200225.0) - - abseil/types/bad_variant_access (= 0.20200225.0) - - abseil/types/compare (= 0.20200225.0) - - abseil/types/optional (= 0.20200225.0) - - abseil/types/span (= 0.20200225.0) - - abseil/types/variant (= 0.20200225.0) - - abseil/types/any (0.20200225.0): - - abseil/base/config - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/types/bad_any_cast - - abseil/utility/utility - - abseil/types/bad_any_cast (0.20200225.0): - - abseil/base/config - - abseil/types/bad_any_cast_impl - - abseil/types/bad_any_cast_impl (0.20200225.0): - - abseil/base/config - - abseil/base/raw_logging_internal - - abseil/types/bad_optional_access (0.20200225.0): - - abseil/base/config - - abseil/base/raw_logging_internal - - abseil/types/bad_variant_access (0.20200225.0): - - abseil/base/config - - abseil/base/raw_logging_internal - - abseil/types/compare (0.20200225.0): - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/types/optional (0.20200225.0): - - abseil/base/base_internal - - abseil/base/config - - abseil/base/core_headers - - abseil/memory/memory - - abseil/meta/type_traits - - abseil/types/bad_optional_access - - abseil/utility/utility - - abseil/types/span (0.20200225.0): - - abseil/algorithm/algorithm - - abseil/base/core_headers - - abseil/base/throw_delegate - - abseil/meta/type_traits - - abseil/types/variant (0.20200225.0): - - abseil/base/base_internal - - abseil/base/config - - abseil/base/core_headers - - abseil/meta/type_traits - - abseil/types/bad_variant_access - - abseil/utility/utility - - abseil/utility/utility (0.20200225.0): - - abseil/base/base_internal - - abseil/base/config - - abseil/meta/type_traits - - android_intent (0.0.1): + - audio_session (0.0.1): - Flutter - barcode_scan_fix (0.0.1): - Flutter - MTBBarcodeScanner - - BoringSSL-GRPC (0.0.7): - - BoringSSL-GRPC/Implementation (= 0.0.7) - - BoringSSL-GRPC/Interface (= 0.0.7) - - BoringSSL-GRPC/Implementation (0.0.7): - - BoringSSL-GRPC/Interface (= 0.0.7) - - BoringSSL-GRPC/Interface (0.0.7) - - cloud_firestore (0.14.4): - - Firebase/CoreOnly (~> 6.33.0) - - Firebase/Firestore (~> 6.33.0) - - firebase_core - - Flutter - - cloud_firestore_web (0.1.0): + - camera (0.0.1): - Flutter - connectivity (0.0.1): - Flutter - Reachability - - connectivity_for_web (0.1.0): - - Flutter - - connectivity_macos (0.0.1): - - Flutter - device_calendar (0.0.1): - Flutter - - device_info (0.0.1): - - Flutter - DKImagePickerController/Core (4.3.2): - DKImagePickerController/ImageDataManager - DKImagePickerController/Resource @@ -275,188 +45,152 @@ PODS: - file_picker (0.0.1): - DKImagePickerController/PhotoGallery - Flutter - - file_picker_web (0.0.1): - - Flutter - - Firebase/Analytics (6.33.0): + - Firebase/Analytics (8.9.0): - Firebase/Core - - Firebase/Core (6.33.0): + - Firebase/Core (8.9.0): - Firebase/CoreOnly - - FirebaseAnalytics (= 6.8.3) - - Firebase/CoreOnly (6.33.0): - - FirebaseCore (= 6.10.3) - - Firebase/Firestore (6.33.0): + - FirebaseAnalytics (~> 8.9.0) + - Firebase/CoreOnly (8.9.0): + - FirebaseCore (= 8.9.0) + - Firebase/Messaging (8.9.0): - Firebase/CoreOnly - - FirebaseFirestore (~> 1.18.0) - - Firebase/Messaging (6.33.0): - - Firebase/CoreOnly - - FirebaseMessaging (~> 4.7.0) - - firebase_analytics (6.3.0): - - Firebase/Analytics (~> 6.33.0) - - Firebase/CoreOnly (~> 6.33.0) + - FirebaseMessaging (~> 8.9.0) + - firebase_analytics (8.3.4): + - Firebase/Analytics (= 8.9.0) - firebase_core - Flutter - - firebase_analytics_web (0.1.0): - - Flutter - - firebase_core (0.5.3): - - Firebase/CoreOnly (~> 6.33.0) + - firebase_core (1.10.0): + - Firebase/CoreOnly (= 8.9.0) - Flutter - - firebase_core_web (0.1.0): - - Flutter - - firebase_messaging (7.0.3): - - Firebase/CoreOnly (~> 6.33.0) - - Firebase/Messaging (~> 6.33.0) + - firebase_messaging (11.1.0): + - Firebase/Messaging (= 8.9.0) - firebase_core - Flutter - - FirebaseAnalytics (6.8.3): - - FirebaseCore (~> 6.10) - - FirebaseInstallations (~> 1.6) - - GoogleAppMeasurement (= 6.8.3) - - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - - GoogleUtilities/MethodSwizzler (~> 6.7) - - GoogleUtilities/Network (~> 6.7) - - "GoogleUtilities/NSData+zlib (~> 6.7)" - - nanopb (~> 1.30906.0) - - FirebaseCore (6.10.3): - - FirebaseCoreDiagnostics (~> 1.6) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/Logger (~> 6.7) - - FirebaseCoreDiagnostics (1.7.0): - - GoogleDataTransport (~> 7.4) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/Logger (~> 6.7) - - nanopb (~> 1.30906.0) - - FirebaseFirestore (1.18.0): - - abseil/algorithm (= 0.20200225.0) - - abseil/base (= 0.20200225.0) - - abseil/memory (= 0.20200225.0) - - abseil/meta (= 0.20200225.0) - - abseil/strings/strings (= 0.20200225.0) - - abseil/time (= 0.20200225.0) - - abseil/types (= 0.20200225.0) - - FirebaseCore (~> 6.10) - - "gRPC-C++ (~> 1.28.0)" - - leveldb-library (~> 1.22) - - nanopb (~> 1.30906.0) - - FirebaseInstallations (1.7.0): - - FirebaseCore (~> 6.10) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/UserDefaults (~> 6.7) - - PromisesObjC (~> 1.2) - - FirebaseInstanceID (4.8.0): - - FirebaseCore (~> 6.10) - - FirebaseInstallations (~> 1.6) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/UserDefaults (~> 6.7) - - FirebaseMessaging (4.7.1): - - FirebaseCore (~> 6.10) - - FirebaseInstanceID (~> 4.7) - - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - - GoogleUtilities/Environment (~> 6.7) - - GoogleUtilities/Reachability (~> 6.7) - - GoogleUtilities/UserDefaults (~> 6.7) - - Protobuf (>= 3.9.2, ~> 3.9) - - Flutter (1.0.0) - - flutter_email_sender (0.0.1): + - FirebaseAnalytics (8.9.1): + - FirebaseAnalytics/AdIdSupport (= 8.9.1) + - FirebaseCore (~> 8.0) + - FirebaseInstallations (~> 8.0) + - GoogleUtilities/AppDelegateSwizzler (~> 7.6) + - GoogleUtilities/MethodSwizzler (~> 7.6) + - GoogleUtilities/Network (~> 7.6) + - "GoogleUtilities/NSData+zlib (~> 7.6)" + - nanopb (~> 2.30908.0) + - FirebaseAnalytics/AdIdSupport (8.9.1): + - FirebaseCore (~> 8.0) + - FirebaseInstallations (~> 8.0) + - GoogleAppMeasurement (= 8.9.1) + - GoogleUtilities/AppDelegateSwizzler (~> 7.6) + - GoogleUtilities/MethodSwizzler (~> 7.6) + - GoogleUtilities/Network (~> 7.6) + - "GoogleUtilities/NSData+zlib (~> 7.6)" + - nanopb (~> 2.30908.0) + - FirebaseCore (8.9.0): + - FirebaseCoreDiagnostics (~> 8.0) + - GoogleUtilities/Environment (~> 7.6) + - GoogleUtilities/Logger (~> 7.6) + - FirebaseCoreDiagnostics (8.10.0): + - GoogleDataTransport (~> 9.1) + - GoogleUtilities/Environment (~> 7.6) + - GoogleUtilities/Logger (~> 7.6) + - nanopb (~> 2.30908.0) + - FirebaseInstallations (8.10.0): + - FirebaseCore (~> 8.0) + - GoogleUtilities/Environment (~> 7.6) + - GoogleUtilities/UserDefaults (~> 7.6) + - PromisesObjC (< 3.0, >= 1.2) + - FirebaseMessaging (8.9.0): + - FirebaseCore (~> 8.0) + - FirebaseInstallations (~> 8.0) + - GoogleDataTransport (~> 9.1) + - GoogleUtilities/AppDelegateSwizzler (~> 7.6) + - GoogleUtilities/Environment (~> 7.6) + - GoogleUtilities/Reachability (~> 7.6) + - GoogleUtilities/UserDefaults (~> 7.6) + - nanopb (~> 2.30908.0) + - fit_kit (0.0.1): - Flutter + - Flutter (1.0.0) - flutter_flexible_toast (0.0.1): - Flutter - flutter_hms_gms_availability (0.0.1): - Flutter - flutter_inappwebview (0.0.1): - Flutter - - flutter_local_notifications (0.0.1): + - flutter_inappwebview/Core (= 0.0.1) + - OrderedSet (~> 5.0) + - flutter_inappwebview/Core (0.0.1): - Flutter - - flutter_plugin_android_lifecycle (0.0.1): + - OrderedSet (~> 5.0) + - flutter_local_notifications (0.0.1): - Flutter - flutter_tts (0.0.1): - Flutter - - flutter_webrtc (0.2.2): + - flutter_webrtc (0.7.1): - Flutter - - GoogleWebRTC (= 1.1.31999) - Libyuv (= 1703) + - WebRTC-SDK (= 92.4515.11) - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) - - geolocator (6.2.0): + - geolocator_apple (1.2.0): - Flutter - google_maps_flutter (0.0.1): - Flutter - - GoogleMaps (< 3.10) - - GoogleAppMeasurement (6.8.3): - - GoogleUtilities/AppDelegateSwizzler (~> 6.7) - - GoogleUtilities/MethodSwizzler (~> 6.7) - - GoogleUtilities/Network (~> 6.7) - - "GoogleUtilities/NSData+zlib (~> 6.7)" - - nanopb (~> 1.30906.0) - - GoogleDataTransport (7.5.1): - - nanopb (~> 1.30906.0) - - GoogleMaps (3.9.0): - - GoogleMaps/Maps (= 3.9.0) - - GoogleMaps/Base (3.9.0) - - GoogleMaps/Maps (3.9.0): + - GoogleMaps + - GoogleAppMeasurement (8.9.1): + - GoogleAppMeasurement/AdIdSupport (= 8.9.1) + - GoogleUtilities/AppDelegateSwizzler (~> 7.6) + - GoogleUtilities/MethodSwizzler (~> 7.6) + - GoogleUtilities/Network (~> 7.6) + - "GoogleUtilities/NSData+zlib (~> 7.6)" + - nanopb (~> 2.30908.0) + - GoogleAppMeasurement/AdIdSupport (8.9.1): + - GoogleAppMeasurement/WithoutAdIdSupport (= 8.9.1) + - GoogleUtilities/AppDelegateSwizzler (~> 7.6) + - GoogleUtilities/MethodSwizzler (~> 7.6) + - GoogleUtilities/Network (~> 7.6) + - "GoogleUtilities/NSData+zlib (~> 7.6)" + - nanopb (~> 2.30908.0) + - GoogleAppMeasurement/WithoutAdIdSupport (8.9.1): + - GoogleUtilities/AppDelegateSwizzler (~> 7.6) + - GoogleUtilities/MethodSwizzler (~> 7.6) + - GoogleUtilities/Network (~> 7.6) + - "GoogleUtilities/NSData+zlib (~> 7.6)" + - nanopb (~> 2.30908.0) + - GoogleDataTransport (9.1.2): + - GoogleUtilities/Environment (~> 7.2) + - nanopb (~> 2.30908.0) + - PromisesObjC (< 3.0, >= 1.2) + - GoogleMaps (5.2.0): + - GoogleMaps/Maps (= 5.2.0) + - GoogleMaps/Base (5.2.0) + - GoogleMaps/Maps (5.2.0): - GoogleMaps/Base - - GoogleUtilities/AppDelegateSwizzler (6.7.2): + - GoogleUtilities/AppDelegateSwizzler (7.6.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (6.7.2): - - PromisesObjC (~> 1.2) - - GoogleUtilities/Logger (6.7.2): + - GoogleUtilities/Environment (7.6.0): + - PromisesObjC (< 3.0, >= 1.2) + - GoogleUtilities/Logger (7.6.0): - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (6.7.2): + - GoogleUtilities/MethodSwizzler (7.6.0): - GoogleUtilities/Logger - - GoogleUtilities/Network (6.7.2): + - GoogleUtilities/Network (7.6.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (6.7.2)" - - GoogleUtilities/Reachability (6.7.2): + - "GoogleUtilities/NSData+zlib (7.6.0)" + - GoogleUtilities/Reachability (7.6.0): - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (6.7.2): + - GoogleUtilities/UserDefaults (7.6.0): - GoogleUtilities/Logger - - GoogleWebRTC (1.1.31999) - - "gRPC-C++ (1.28.2)": - - "gRPC-C++/Implementation (= 1.28.2)" - - "gRPC-C++/Interface (= 1.28.2)" - - "gRPC-C++/Implementation (1.28.2)": - - abseil/container/inlined_vector (= 0.20200225.0) - - abseil/memory/memory (= 0.20200225.0) - - abseil/strings/str_format (= 0.20200225.0) - - abseil/strings/strings (= 0.20200225.0) - - abseil/types/optional (= 0.20200225.0) - - "gRPC-C++/Interface (= 1.28.2)" - - gRPC-Core (= 1.28.2) - - "gRPC-C++/Interface (1.28.2)" - - gRPC-Core (1.28.2): - - gRPC-Core/Implementation (= 1.28.2) - - gRPC-Core/Interface (= 1.28.2) - - gRPC-Core/Implementation (1.28.2): - - abseil/container/inlined_vector (= 0.20200225.0) - - abseil/memory/memory (= 0.20200225.0) - - abseil/strings/str_format (= 0.20200225.0) - - abseil/strings/strings (= 0.20200225.0) - - abseil/types/optional (= 0.20200225.0) - - BoringSSL-GRPC (= 0.0.7) - - gRPC-Core/Interface (= 1.28.2) - - gRPC-Core/Interface (1.28.2) - - hexcolor (0.0.1): - - Flutter - - "huawei_location (5.0.0+301)": - - Flutter - - "huawei_map (5.0.3+303)": - - Flutter - - image_cropper (0.0.3): - - Flutter - - TOCropViewController (~> 2.5.4) - image_picker (0.0.1): - Flutter - in_app_review (0.2.0): - Flutter - - in_app_update (0.0.1): - - Flutter - just_audio (0.0.1): - Flutter - - leveldb-library (1.22) - Libyuv (1703) - local_auth (0.0.1): - Flutter @@ -464,53 +198,35 @@ PODS: - Flutter - manage_calendar_events (0.0.1): - Flutter - - map_launcher (0.0.1): - - Flutter - maps_launcher (0.0.1): - Flutter - MTBBarcodeScanner (5.0.11) - - nanopb (1.30906.0): - - nanopb/decode (= 1.30906.0) - - nanopb/encode (= 1.30906.0) - - nanopb/decode (1.30906.0) - - nanopb/encode (1.30906.0) + - nanopb (2.30908.0): + - nanopb/decode (= 2.30908.0) + - nanopb/encode (= 2.30908.0) + - nanopb/decode (2.30908.0) + - nanopb/encode (2.30908.0) - native_device_orientation (0.0.1): - Flutter - nfc_in_flutter (1.0.0): - Flutter - - NVActivityIndicatorView (5.1.1): - - NVActivityIndicatorView/Base (= 5.1.1) - - NVActivityIndicatorView/Base (5.1.1) - - OpenTok (2.20.0) - - path_provider (0.0.1): - - Flutter - - path_provider_linux (0.0.1): + - OrderedSet (5.0.0) + - package_info_plus (0.4.5): - Flutter - - path_provider_macos (0.0.1): - - Flutter - - path_provider_windows (0.0.1): + - path_provider_ios (0.0.1): - Flutter - "permission_handler (5.1.0+2)": - Flutter - - PromisesObjC (1.2.11) - - Protobuf (3.13.0) + - PromisesObjC (2.0.0) - Reachability (3.2) - screen (0.0.1): - Flutter - - SDWebImage (5.10.4): - - SDWebImage/Core (= 5.10.4) - - SDWebImage/Core (5.10.4) - - shared_preferences (0.0.1): - - Flutter - - shared_preferences_linux (0.0.1): - - Flutter - - shared_preferences_macos (0.0.1): - - Flutter - - shared_preferences_web (0.0.1): - - Flutter - - shared_preferences_windows (0.0.1): + - SDWebImage (5.12.1): + - SDWebImage/Core (= 5.12.1) + - SDWebImage/Core (5.12.1) + - searchable_dropdown (1.1.1): - Flutter - - sms_otp_auto_verify (0.0.1): + - shared_preferences_ios (0.0.1): - Flutter - speech_to_text (0.0.1): - Flutter @@ -518,185 +234,115 @@ PODS: - sqflite (0.0.2): - Flutter - FMDB (>= 2.7.5) - - SwiftyGif (5.4.0) - - TOCropViewController (2.5.5) + - SwiftyGif (5.4.1) - Try (2.1.1) - - "twilio_programmable_video (0.6.4+1)": - - Flutter - - TwilioVideo (~> 3.7) - - TwilioVideo (3.8.0) - - url_launcher (0.0.1): - - Flutter - - url_launcher_linux (0.0.1): - - Flutter - - url_launcher_macos (0.0.1): - - Flutter - - url_launcher_web (0.0.1): - - Flutter - - url_launcher_windows (0.0.1): + - url_launcher_ios (0.0.1): - Flutter - vibration (1.7.3): - Flutter - - vibration_web (1.6.2): - - Flutter - video_player (0.0.1): - Flutter - - video_player_web (0.0.1): - - Flutter - wakelock (0.0.1): - Flutter - - webview_flutter (0.0.1): + - WebRTC-SDK (92.4515.11) + - webview_flutter_wkwebview (0.0.1): - Flutter - wifi (0.0.1): - Flutter DEPENDENCIES: - - android_intent (from `.symlinks/plugins/android_intent/ios`) + - audio_session (from `.symlinks/plugins/audio_session/ios`) - barcode_scan_fix (from `.symlinks/plugins/barcode_scan_fix/ios`) - - cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) - - cloud_firestore_web (from `.symlinks/plugins/cloud_firestore_web/ios`) + - camera (from `.symlinks/plugins/camera/ios`) - connectivity (from `.symlinks/plugins/connectivity/ios`) - - connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`) - - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) - device_calendar (from `.symlinks/plugins/device_calendar/ios`) - - device_info (from `.symlinks/plugins/device_info/ios`) - file_picker (from `.symlinks/plugins/file_picker/ios`) - - file_picker_web (from `.symlinks/plugins/file_picker_web/ios`) - firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`) - - firebase_analytics_web (from `.symlinks/plugins/firebase_analytics_web/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`) - - firebase_core_web (from `.symlinks/plugins/firebase_core_web/ios`) - firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`) + - fit_kit (from `.symlinks/plugins/fit_kit/ios`) - Flutter (from `Flutter`) - - flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`) - flutter_flexible_toast (from `.symlinks/plugins/flutter_flexible_toast/ios`) - flutter_hms_gms_availability (from `.symlinks/plugins/flutter_hms_gms_availability/ios`) - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) - - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) - flutter_tts (from `.symlinks/plugins/flutter_tts/ios`) - flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`) - - geolocator (from `.symlinks/plugins/geolocator/ios`) + - geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`) - google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`) - - hexcolor (from `.symlinks/plugins/hexcolor/ios`) - - huawei_location (from `.symlinks/plugins/huawei_location/ios`) - - huawei_map (from `.symlinks/plugins/huawei_map/ios`) - - image_cropper (from `.symlinks/plugins/image_cropper/ios`) - image_picker (from `.symlinks/plugins/image_picker/ios`) - in_app_review (from `.symlinks/plugins/in_app_review/ios`) - - in_app_update (from `.symlinks/plugins/in_app_update/ios`) - just_audio (from `.symlinks/plugins/just_audio/ios`) - local_auth (from `.symlinks/plugins/local_auth/ios`) - location (from `.symlinks/plugins/location/ios`) - manage_calendar_events (from `.symlinks/plugins/manage_calendar_events/ios`) - - map_launcher (from `.symlinks/plugins/map_launcher/ios`) - maps_launcher (from `.symlinks/plugins/maps_launcher/ios`) - native_device_orientation (from `.symlinks/plugins/native_device_orientation/ios`) - nfc_in_flutter (from `.symlinks/plugins/nfc_in_flutter/ios`) - - NVActivityIndicatorView - - OpenTok - - path_provider (from `.symlinks/plugins/path_provider/ios`) - - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) - - path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`) - - path_provider_windows (from `.symlinks/plugins/path_provider_windows/ios`) + - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) + - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - screen (from `.symlinks/plugins/screen/ios`) - - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - - shared_preferences_linux (from `.symlinks/plugins/shared_preferences_linux/ios`) - - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) - - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) - - shared_preferences_windows (from `.symlinks/plugins/shared_preferences_windows/ios`) - - sms_otp_auto_verify (from `.symlinks/plugins/sms_otp_auto_verify/ios`) + - searchable_dropdown (from `.symlinks/plugins/searchable_dropdown/ios`) + - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`) - speech_to_text (from `.symlinks/plugins/speech_to_text/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - - twilio_programmable_video (from `.symlinks/plugins/twilio_programmable_video/ios`) - - url_launcher (from `.symlinks/plugins/url_launcher/ios`) - - url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`) - - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) - - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) - - url_launcher_windows (from `.symlinks/plugins/url_launcher_windows/ios`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - vibration (from `.symlinks/plugins/vibration/ios`) - - vibration_web (from `.symlinks/plugins/vibration_web/ios`) - video_player (from `.symlinks/plugins/video_player/ios`) - - video_player_web (from `.symlinks/plugins/video_player_web/ios`) - wakelock (from `.symlinks/plugins/wakelock/ios`) - - webview_flutter (from `.symlinks/plugins/webview_flutter/ios`) + - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`) - wifi (from `.symlinks/plugins/wifi/ios`) SPEC REPOS: trunk: - - abseil - - BoringSSL-GRPC - DKImagePickerController - DKPhotoGallery - Firebase - FirebaseAnalytics - FirebaseCore - FirebaseCoreDiagnostics - - FirebaseFirestore - FirebaseInstallations - - FirebaseInstanceID - FirebaseMessaging - FMDB - GoogleAppMeasurement - GoogleDataTransport - GoogleMaps - GoogleUtilities - - GoogleWebRTC - - "gRPC-C++" - - gRPC-Core - - leveldb-library - Libyuv - MTBBarcodeScanner - nanopb - - NVActivityIndicatorView - - OpenTok + - OrderedSet - PromisesObjC - - Protobuf - Reachability - SDWebImage - SwiftyGif - - TOCropViewController - Try - - TwilioVideo + - WebRTC-SDK EXTERNAL SOURCES: - android_intent: - :path: ".symlinks/plugins/android_intent/ios" + audio_session: + :path: ".symlinks/plugins/audio_session/ios" barcode_scan_fix: :path: ".symlinks/plugins/barcode_scan_fix/ios" - cloud_firestore: - :path: ".symlinks/plugins/cloud_firestore/ios" - cloud_firestore_web: - :path: ".symlinks/plugins/cloud_firestore_web/ios" + camera: + :path: ".symlinks/plugins/camera/ios" connectivity: :path: ".symlinks/plugins/connectivity/ios" - connectivity_for_web: - :path: ".symlinks/plugins/connectivity_for_web/ios" - connectivity_macos: - :path: ".symlinks/plugins/connectivity_macos/ios" device_calendar: :path: ".symlinks/plugins/device_calendar/ios" - device_info: - :path: ".symlinks/plugins/device_info/ios" file_picker: :path: ".symlinks/plugins/file_picker/ios" - file_picker_web: - :path: ".symlinks/plugins/file_picker_web/ios" firebase_analytics: :path: ".symlinks/plugins/firebase_analytics/ios" - firebase_analytics_web: - :path: ".symlinks/plugins/firebase_analytics_web/ios" firebase_core: :path: ".symlinks/plugins/firebase_core/ios" - firebase_core_web: - :path: ".symlinks/plugins/firebase_core_web/ios" firebase_messaging: :path: ".symlinks/plugins/firebase_messaging/ios" + fit_kit: + :path: ".symlinks/plugins/fit_kit/ios" Flutter: :path: Flutter - flutter_email_sender: - :path: ".symlinks/plugins/flutter_email_sender/ios" flutter_flexible_toast: :path: ".symlinks/plugins/flutter_flexible_toast/ios" flutter_hms_gms_availability: @@ -705,30 +351,18 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_inappwebview/ios" flutter_local_notifications: :path: ".symlinks/plugins/flutter_local_notifications/ios" - flutter_plugin_android_lifecycle: - :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" flutter_tts: :path: ".symlinks/plugins/flutter_tts/ios" flutter_webrtc: :path: ".symlinks/plugins/flutter_webrtc/ios" - geolocator: - :path: ".symlinks/plugins/geolocator/ios" + geolocator_apple: + :path: ".symlinks/plugins/geolocator_apple/ios" google_maps_flutter: :path: ".symlinks/plugins/google_maps_flutter/ios" - hexcolor: - :path: ".symlinks/plugins/hexcolor/ios" - huawei_location: - :path: ".symlinks/plugins/huawei_location/ios" - huawei_map: - :path: ".symlinks/plugins/huawei_map/ios" - image_cropper: - :path: ".symlinks/plugins/image_cropper/ios" image_picker: :path: ".symlinks/plugins/image_picker/ios" in_app_review: :path: ".symlinks/plugins/in_app_review/ios" - in_app_update: - :path: ".symlinks/plugins/in_app_update/ios" just_audio: :path: ".symlinks/plugins/just_audio/ios" local_auth: @@ -737,174 +371,108 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/location/ios" manage_calendar_events: :path: ".symlinks/plugins/manage_calendar_events/ios" - map_launcher: - :path: ".symlinks/plugins/map_launcher/ios" maps_launcher: :path: ".symlinks/plugins/maps_launcher/ios" native_device_orientation: :path: ".symlinks/plugins/native_device_orientation/ios" nfc_in_flutter: :path: ".symlinks/plugins/nfc_in_flutter/ios" - path_provider: - :path: ".symlinks/plugins/path_provider/ios" - path_provider_linux: - :path: ".symlinks/plugins/path_provider_linux/ios" - path_provider_macos: - :path: ".symlinks/plugins/path_provider_macos/ios" - path_provider_windows: - :path: ".symlinks/plugins/path_provider_windows/ios" + package_info_plus: + :path: ".symlinks/plugins/package_info_plus/ios" + path_provider_ios: + :path: ".symlinks/plugins/path_provider_ios/ios" permission_handler: :path: ".symlinks/plugins/permission_handler/ios" screen: :path: ".symlinks/plugins/screen/ios" - shared_preferences: - :path: ".symlinks/plugins/shared_preferences/ios" - shared_preferences_linux: - :path: ".symlinks/plugins/shared_preferences_linux/ios" - shared_preferences_macos: - :path: ".symlinks/plugins/shared_preferences_macos/ios" - shared_preferences_web: - :path: ".symlinks/plugins/shared_preferences_web/ios" - shared_preferences_windows: - :path: ".symlinks/plugins/shared_preferences_windows/ios" - sms_otp_auto_verify: - :path: ".symlinks/plugins/sms_otp_auto_verify/ios" + searchable_dropdown: + :path: ".symlinks/plugins/searchable_dropdown/ios" + shared_preferences_ios: + :path: ".symlinks/plugins/shared_preferences_ios/ios" speech_to_text: :path: ".symlinks/plugins/speech_to_text/ios" sqflite: :path: ".symlinks/plugins/sqflite/ios" - twilio_programmable_video: - :path: ".symlinks/plugins/twilio_programmable_video/ios" - url_launcher: - :path: ".symlinks/plugins/url_launcher/ios" - url_launcher_linux: - :path: ".symlinks/plugins/url_launcher_linux/ios" - url_launcher_macos: - :path: ".symlinks/plugins/url_launcher_macos/ios" - url_launcher_web: - :path: ".symlinks/plugins/url_launcher_web/ios" - url_launcher_windows: - :path: ".symlinks/plugins/url_launcher_windows/ios" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" vibration: :path: ".symlinks/plugins/vibration/ios" - vibration_web: - :path: ".symlinks/plugins/vibration_web/ios" video_player: :path: ".symlinks/plugins/video_player/ios" - video_player_web: - :path: ".symlinks/plugins/video_player_web/ios" wakelock: :path: ".symlinks/plugins/wakelock/ios" - webview_flutter: - :path: ".symlinks/plugins/webview_flutter/ios" + webview_flutter_wkwebview: + :path: ".symlinks/plugins/webview_flutter_wkwebview/ios" wifi: :path: ".symlinks/plugins/wifi/ios" SPEC CHECKSUMS: - abseil: 6c8eb7892aefa08d929b39f9bb108e5367e3228f - android_intent: 367df2f1277a74e4a90e14a8ab3df3112d087052 + audio_session: 4f3e461722055d21515cf3261b64c973c062f345 barcode_scan_fix: 80dd65de55f27eec6591dd077c8b85f2b79e31f1 - BoringSSL-GRPC: 8edf627ee524575e2f8d19d56f068b448eea3879 - cloud_firestore: b8c0e15fa49dfff87c2817d288b577e5dca2df13 - cloud_firestore_web: 9ec3dc7f5f98de5129339802d491c1204462bfec + camera: fe33292aff715a981eb34d7ce7b35b54337ff34c connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 - connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b - connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 device_calendar: 23b28a5f1ab3bf77e34542fb1167e1b8b29a98f5 - device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1 - file_picker_web: 37b10786e88885124fac99dc899866e78a132ef3 - Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 - firebase_analytics: 36a619088c46224900829f14f4daa71585693a6f - firebase_analytics_web: 7d539061ea4af07563a0e21044af89cab70efec0 - firebase_core: 5d6a02f3d85acd5f8321c2d6d62877626a670659 - firebase_core_web: d501d8b946b60c8af265428ce483b0fff5ad52d1 - firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75 - FirebaseAnalytics: 5dd088bd2e67bb9d13dbf792d1164ceaf3052193 - FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd - FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1 - FirebaseFirestore: adff4877869ca91a11250cc0989a6cd56bad163f - FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2 - FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1 - FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a - Flutter: 0e3d915762c693b495b44d77113d4970485de6ec - flutter_email_sender: f787522d0e82f50e5766c1213dbffff22fdcf009 + Firebase: 13d8d96499e2635428d5bf0ec675df21f95d9a95 + firebase_analytics: 7a7528bb2abf4ca22cff7a57bbf909dcab73e13d + firebase_core: f770e033e790657b3505f04be4cb24c482912f11 + firebase_messaging: 0c8d1a1732487db7f332fb65232053e93201e2fb + FirebaseAnalytics: 4ab446ce08a3fe52e8a4303dd997cf26276bf968 + FirebaseCore: 599ee609343eaf4941bd188f85e3aa077ffe325b + FirebaseCoreDiagnostics: 56fb7216d87e0e6ec2feddefa9d8a392fe8b2c18 + FirebaseInstallations: 830327b45345ffc859eaa9c17bcd5ae893fd5425 + FirebaseMessaging: 82c4a48638f53f7b184f3cc9f6cd2cbe533ab316 + fit_kit: 7643191161673bcd32863ae3f10baed6ce55c7c0 + Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a flutter_flexible_toast: 0547e740cae0c33bb7c51bcd931233f4584e1143 flutter_hms_gms_availability: babc50b18670e99780270bc18d9b17d0a07cd77e - flutter_inappwebview: 69dfbac46157b336ffbec19ca6dfd4638c7bf189 - flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186 - flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 + flutter_inappwebview: bfd58618f49dc62f2676de690fc6dcda1d6c3721 + flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743 flutter_tts: 0f492aab6accf87059b72354fcb4ba934304771d - flutter_webrtc: 39898454258b54ba51996850d5da8d5d53bf1524 + flutter_webrtc: a5a79904f0bca0ea23aff49c51ca765f70a0f703 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a - geolocator: f5e3de65e241caba7ce3e8a618803387bda73384 - google_maps_flutter: c7f9c73576de1fbe152a227bfd6e6c4ae8088619 - GoogleAppMeasurement: 966e88df9d19c15715137bb2ddaf52373f111436 - GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 - GoogleMaps: 4b5346bddfe6911bb89155d43c903020170523ac - GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 - GoogleWebRTC: b39a78c4f5cc6b0323415b9233db03a2faa7b0f0 - "gRPC-C++": 13d8ccef97d5c3c441b7e3c529ef28ebee86fad2 - gRPC-Core: 4afa11bfbedf7cdecd04de535a9e046893404ed5 - hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 - huawei_location: a1c3d2a029138b3d0b9a72ce910ffae3ff23c1aa - huawei_map: 34fbad9c274ea78a4151487c9ebe27f1887777e7 - image_cropper: c8f9b4157933c7bb965a66d1c5e6c8fd408c6eb4 - image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09 + geolocator_apple: b741765c55dc21950e3e106e8b3584e55cf81ce5 + google_maps_flutter: abdb8dee6c52d4be36ad131ee6ebfacd14417c5a + GoogleAppMeasurement: 837649ad3987936c232f6717c5680216f6243d24 + GoogleDataTransport: 629c20a4d363167143f30ea78320d5a7eb8bd940 + GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693 + GoogleUtilities: 684ee790a24f73ebb2d1d966e9711c203f2a4237 + image_picker: 9aa50e1d8cdacdbed739e925b7eea16d014367e6 in_app_review: 4a97249f7a2f539a0f294c2d9196b7fe35e49541 - in_app_update: 16e877e205f4360264cb536e3a6481f0d90299e1 just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa - leveldb-library: 55d93ee664b4007aac644a782d11da33fba316f7 Libyuv: 5f79ced0ee66e60a612ca97de1e6ccacd187a437 - local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd + local_auth: ef62030a2731330b95df7ef1331bd15f6a64b8a6 location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740 manage_calendar_events: 0338d505ea26cdfd20cd883279bc28afa11eca34 - map_launcher: e325db1261d029ff33e08e03baccffe09593ffea - maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92 + maps_launcher: 2e5b6a2d664ec6c27f82ffa81b74228d770ab203 MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb - nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc - native_device_orientation: e24d00be281de72996640885d80e706142707660 + nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96 + native_device_orientation: 3b4cfc9565a7b879cc4fde282b3e27745e852d0d nfc_in_flutter: c656fbfb1ec5b9d021da87b0c87629d62fd5264d - NVActivityIndicatorView: 1f6c5687f1171810aa27a3296814dc2d7dec3667 - OpenTok: 414c2c1dc6486f1897015e4d1703558d5eed48c3 - path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c - path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 - path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 - path_provider_windows: a2b81600c677ac1959367280991971cb9a1edb3b + OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c + package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e + path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 - PromisesObjC: 8c196f5a328c2cba3e74624585467a557dcb482f - Protobuf: 3dac39b34a08151c6d949560efe3f86134a3f748 + PromisesObjC: 68159ce6952d93e17b2dfe273b8c40907db5ba58 Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0 - SDWebImage: c666b97e1fa9c64b4909816a903322018f0a9c84 - shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d - shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78 - shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 - shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 - shared_preferences_windows: 36b76d6f54e76ead957e60b49e2f124b4cd3e6ae - sms_otp_auto_verify: 201803ac25e13feedaae96eda8b70b10c55b3338 + SDWebImage: 4dc3e42d9ec0c1028b960a33ac6b637bb432207b + searchable_dropdown: 5058be32fdc5e0481d300ff2087129072e71bd62 + shared_preferences_ios: aef470a42dc4675a1cdd50e3158b42e3d1232b32 speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 - SwiftyGif: 5d4af95df24caf1c570dbbcb32a3b8a0763bc6d7 - TOCropViewController: da59f531f8ac8a94ef6d6c0fc34009350f9e8bfe + SwiftyGif: 6895c887f5551618a3c5dd3ecb512419105bacca Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96 - twilio_programmable_video: ce33772ea8275b413c0ab5c5aa2e35f9da2d4066 - TwilioVideo: c13a51ceca375e91620eb7578d2573c90cf53b46 - url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef - url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0 - url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 - url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c - url_launcher_windows: 683d7c283894db8d1914d3ab2223b20cc1ad95d5 + url_launcher_ios: 02f1989d4e14e998335b02b67a7590fa34f971af vibration: b5a33e764c3f609a975b9dca73dce20fdde627dc - vibration_web: 0ba303d92469ba34d71c612a228b315908d7fcd9 - video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e - video_player_web: da8cadb8274ed4f8dbee8d7171b420dedd437ce7 - wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4 - webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 + video_player: ecd305f42e9044793efd34846e1ce64c31ea6fcb + wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f + WebRTC-SDK: 21dbc6028a68f3a89718057a2caa970a4da8ebb7 + webview_flutter_wkwebview: 005fbd90c888a42c5690919a1527ecc6649e1162 wifi: d7d77c94109e36c4175d845f0a5964eadba71060 -PODFILE CHECKSUM: df22e8ed6009dd48559053927dc365d6dad6c11f +PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.2 diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a16..919434a6 100644 --- a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 35a3c022..8826bbdd 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -29,12 +29,12 @@ var userNotificationCenterDelegate:UNUserNotificationCenterDelegate? = nil if let mainViewController = window.rootViewController as? MainFlutterVC{ // platform initialization suppose to be in foreground flutterViewController = mainViewController HMGPlatformBridge.initialize(flutterViewController: flutterViewController) - OpenTokPlatformBridge.initialize(flutterViewController: flutterViewController, registrar: self.registrar(forPlugin: "open-tok")) +// OpenTokPlatformBridge.initialize(flutterViewController: flutterViewController, registrar: self.registrar(forPlugin: "open-tok")) }else if let mainViewController = initialViewController(){ // platform initialization suppose to be in background flutterViewController = mainViewController HMGPlatformBridge.initialize(flutterViewController: flutterViewController) - OpenTokPlatformBridge.initialize(flutterViewController: flutterViewController, registrar: self.registrar(forPlugin: "open-tok")) +// OpenTokPlatformBridge.initialize(flutterViewController: flutterViewController, registrar: self.registrar(forPlugin: "open-tok")) } } diff --git a/ios/Runner/Helper/OpenTokPlatformBridge.swift b/ios/Runner/Helper/OpenTokPlatformBridge.swift index 38e826e1..132f1384 100644 --- a/ios/Runner/Helper/OpenTokPlatformBridge.swift +++ b/ios/Runner/Helper/OpenTokPlatformBridge.swift @@ -8,52 +8,51 @@ import UIKit import NetworkExtension import SystemConfiguration.CaptiveNetwork -import OpenTok fileprivate var openTok:OpenTok? class OpenTokPlatformBridge : NSObject{ - private var methodChannel:FlutterMethodChannel? = nil - private var mainViewController:MainFlutterVC! - private static var shared_:OpenTokPlatformBridge? - - class func initialize(flutterViewController:MainFlutterVC, registrar:FlutterPluginRegistrar?){ - shared_ = OpenTokPlatformBridge() - shared_?.mainViewController = flutterViewController - - shared_?.openChannel() - openTok = OpenTok(mainViewController: flutterViewController, registrar: registrar) - } - - func shared() -> OpenTokPlatformBridge{ - assert((OpenTokPlatformBridge.shared_ != nil), "OpenTokPlatformBridge is not initialized, call initialize(mainViewController:MainFlutterVC) function first.") - return OpenTokPlatformBridge.shared_! - } - - private func openChannel(){ - methodChannel = FlutterMethodChannel(name: "OpenTok-Platform-Bridge", binaryMessenger: mainViewController.binaryMessenger) - methodChannel?.setMethodCallHandler { (call, result) in - print("Called function \(call.method)") - - switch(call.method) { - case "initSession": - openTok?.initSession(call: call, result: result) - - case "swapCamera": - openTok?.swapCamera(call: call, result: result) - - case "toggleAudio": - openTok?.toggleAudio(call: call, result: result) - - case "toggleVideo": - openTok?.toggleVideo(call: call, result: result) - - default: - result(FlutterMethodNotImplemented) - } - - print("") - } - } +// private var methodChannel:FlutterMethodChannel? = nil +// private var mainViewController:MainFlutterVC! +// private static var shared_:OpenTokPlatformBridge? +// +// class func initialize(flutterViewController:MainFlutterVC, registrar:FlutterPluginRegistrar?){ +// shared_ = OpenTokPlatformBridge() +// shared_?.mainViewController = flutterViewController +// +// shared_?.openChannel() +// openTok = OpenTok(mainViewController: flutterViewController, registrar: registrar) +// } +// +// func shared() -> OpenTokPlatformBridge{ +// assert((OpenTokPlatformBridge.shared_ != nil), "OpenTokPlatformBridge is not initialized, call initialize(mainViewController:MainFlutterVC) function first.") +// return OpenTokPlatformBridge.shared_! +// } +// +// private func openChannel(){ +// methodChannel = FlutterMethodChannel(name: "OpenTok-Platform-Bridge", binaryMessenger: mainViewController.binaryMessenger) +// methodChannel?.setMethodCallHandler { (call, result) in +// print("Called function \(call.method)") +// +// switch(call.method) { +// case "initSession": +// openTok?.initSession(call: call, result: result) +// +// case "swapCamera": +// openTok?.swapCamera(call: call, result: result) +// +// case "toggleAudio": +// openTok?.toggleAudio(call: call, result: result) +// +// case "toggleVideo": +// openTok?.toggleVideo(call: call, result: result) +// +// default: +// result(FlutterMethodNotImplemented) +// } +// +// print("") +// } +// } } diff --git a/ios/Runner/OpenTok/OpenTok.swift b/ios/Runner/OpenTok/OpenTok.swift index 9cc0b79a..f91d83d5 100644 --- a/ios/Runner/OpenTok/OpenTok.swift +++ b/ios/Runner/OpenTok/OpenTok.swift @@ -6,7 +6,7 @@ // import Foundation -import OpenTok +//import OpenTok import UIKit enum SdkState: String { @@ -17,163 +17,164 @@ enum SdkState: String { } class OpenTok : NSObject{ - private var mainViewController:MainFlutterVC! - private var registrar:FlutterPluginRegistrar? - var methodChannel: FlutterMethodChannel? - init(mainViewController:MainFlutterVC, registrar:FlutterPluginRegistrar?){ - self.mainViewController = mainViewController - self.methodChannel = FlutterMethodChannel(name: "OpenTok-Platform-Bridge", binaryMessenger: mainViewController.binaryMessenger) - self.registrar = registrar - - let remoteVDOFactory = OpenTokRemoteVideoFactory(messenger: registrar!.messenger()) - registrar?.register(remoteVDOFactory, withId: "remote-video-container") - - let localVDOFactory = OpenTokLocalVideoFactory(messenger: registrar!.messenger()) - registrar?.register(localVDOFactory, withId: "local-video-container") - } - - var otSession: OTSession? - - var subscriber: OTSubscriber? - lazy var publisher: OTPublisher = { - let settings = OTPublisherSettings() - settings.name = UIDevice.current.name - return OTPublisher(delegate: self, settings: settings)! - }() - - func initSession(call:FlutterMethodCall, result: @escaping FlutterResult){ - if let arguments = call.arguments as? [String: String], - let apiKey = arguments["apiKey"], - let sessionId = arguments["sessionId"], - let token = arguments["token"]{ - - var error: OTError? - defer { - // todo - } - - notifyFlutter(state: SdkState.wait) - otSession = OTSession(apiKey: apiKey, sessionId: sessionId, delegate: self)! - otSession?.connect(withToken: token, error: &error) - - result("") - }else{ - - } - - } - - - func swapCamera(call:FlutterMethodCall, result: @escaping FlutterResult) { - if publisher.cameraPosition == .front { - publisher.cameraPosition = .back - } else { - publisher.cameraPosition = .front - } - result("") - } - - func toggleAudio(call:FlutterMethodCall, result: @escaping FlutterResult) { - if let arguments = call.arguments as? [String: Bool], - let publishAudio = arguments["publishAudio"] { - publisher.publishAudio = !publisher.publishAudio - } - result("") - } - - func toggleVideo(call:FlutterMethodCall, result: @escaping FlutterResult) { - if let arguments = call.arguments as? [String: Bool], - let publishVideo = arguments["publishVideo"] { - publisher.publishVideo = !publisher.publishVideo - } - result("") - } - - - func notifyFlutter(state: SdkState) { - methodChannel?.invokeMethod("updateState", arguments: state.rawValue) - } - -} - -extension OpenTok: OTSessionDelegate { - func sessionDidConnect(_ sessionDelegate: OTSession) { - print("The client connected to the session.") - notifyFlutter(state: SdkState.loggedIn) - - var error: OTError? - defer { - // todo - } - - self.otSession?.publish(self.publisher, error: &error) - - if let pubView = self.publisher.view { - pubView.frame = CGRect(x: 0, y: 0, width: 200, height: 300) - - if OpenTokLocalVideoFactory.view == nil { - OpenTokLocalVideoFactory.viewToAddPub = pubView - } else { - OpenTokLocalVideoFactory.view?.addPublisherView(pubView) - } - } - } - - func sessionDidDisconnect(_ session: OTSession) { - print("The client disconnected from the session.") - notifyFlutter(state: SdkState.loggedOut) - } - - func session(_ session: OTSession, didFailWithError error: OTError) { - print("The client failed to connect to the session: \(error).") - } - - func session(_ session: OTSession, streamCreated stream: OTStream) { - print("A stream was created in the session.") - var error: OTError? - defer { - // todo - } - subscriber = OTSubscriber(stream: stream, delegate: self) - - session.subscribe(subscriber!, error: &error) - } - - func session(_ session: OTSession, streamDestroyed stream: OTStream) { - print("A stream was destroyed in the session.") - } -} - -extension OpenTok: OTPublisherDelegate { - func publisher(_ publisher: OTPublisherKit, streamCreated stream: OTStream) { - } - - func publisher(_ publisher: OTPublisherKit, streamDestroyed stream: OTStream) { - } - - func publisher(_ publisher: OTPublisherKit, didFailWithError error: OTError) { - print("Publisher failed: \(error.localizedDescription)") - } -} - -extension OpenTok: OTSubscriberDelegate { - func subscriberDidConnect(toStream subscriberKit: OTSubscriberKit) { - print("Subscriber connected") - - if let subView = self.subscriber?.view { - subView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height) - - if OpenTokRemoteVideoFactory.view == nil { - OpenTokRemoteVideoFactory.viewToAddSub = subView - } else { - OpenTokRemoteVideoFactory.view?.addSubscriberView(subView) - } - } - } - - func subscriber(_ subscriber: OTSubscriberKit, didFailWithError error: OTError) { - print("Subscriber failed: \(error.localizedDescription)") - } +// private var mainViewController:MainFlutterVC! +// private var registrar:FlutterPluginRegistrar? +// var methodChannel: FlutterMethodChannel? +// +// init(mainViewController:MainFlutterVC, registrar:FlutterPluginRegistrar?){ +// self.mainViewController = mainViewController +// self.methodChannel = FlutterMethodChannel(name: "OpenTok-Platform-Bridge", binaryMessenger: mainViewController.binaryMessenger) +// self.registrar = registrar +// +// let remoteVDOFactory = OpenTokRemoteVideoFactory(messenger: registrar!.messenger()) +// registrar?.register(remoteVDOFactory, withId: "remote-video-container") +// +// let localVDOFactory = OpenTokLocalVideoFactory(messenger: registrar!.messenger()) +// registrar?.register(localVDOFactory, withId: "local-video-container") +// } +// +// var otSession: OTSession? +// +// var subscriber: OTSubscriber? +// lazy var publisher: OTPublisher = { +// let settings = OTPublisherSettings() +// settings.name = UIDevice.current.name +// return OTPublisher(delegate: self, settings: settings)! +// }() +// +// func initSession(call:FlutterMethodCall, result: @escaping FlutterResult){ +// if let arguments = call.arguments as? [String: String], +// let apiKey = arguments["apiKey"], +// let sessionId = arguments["sessionId"], +// let token = arguments["token"]{ +// +// var error: OTError? +// defer { +// // todo +// } +// +// notifyFlutter(state: SdkState.wait) +// otSession = OTSession(apiKey: apiKey, sessionId: sessionId, delegate: self)! +// otSession?.connect(withToken: token, error: &error) +// +// result("") +// }else{ +// +// } +// +// } +// +// +// func swapCamera(call:FlutterMethodCall, result: @escaping FlutterResult) { +// if publisher.cameraPosition == .front { +// publisher.cameraPosition = .back +// } else { +// publisher.cameraPosition = .front +// } +// result("") +// } +// +// func toggleAudio(call:FlutterMethodCall, result: @escaping FlutterResult) { +// if let arguments = call.arguments as? [String: Bool], +// let publishAudio = arguments["publishAudio"] { +// publisher.publishAudio = !publisher.publishAudio +// } +// result("") +// } +// +// func toggleVideo(call:FlutterMethodCall, result: @escaping FlutterResult) { +// if let arguments = call.arguments as? [String: Bool], +// let publishVideo = arguments["publishVideo"] { +// publisher.publishVideo = !publisher.publishVideo +// } +// result("") +// } +// +// +// func notifyFlutter(state: SdkState) { +// methodChannel?.invokeMethod("updateState", arguments: state.rawValue) +// } +// +//} +// +//extension OpenTok: OTSessionDelegate { +// func sessionDidConnect(_ sessionDelegate: OTSession) { +// print("The client connected to the session.") +// notifyFlutter(state: SdkState.loggedIn) +// +// var error: OTError? +// defer { +// // todo +// } +// +// self.otSession?.publish(self.publisher, error: &error) +// +// if let pubView = self.publisher.view { +// pubView.frame = CGRect(x: 0, y: 0, width: 200, height: 300) +// +// if OpenTokLocalVideoFactory.view == nil { +// OpenTokLocalVideoFactory.viewToAddPub = pubView +// } else { +// OpenTokLocalVideoFactory.view?.addPublisherView(pubView) +// } +// } +// } +// +// func sessionDidDisconnect(_ session: OTSession) { +// print("The client disconnected from the session.") +// notifyFlutter(state: SdkState.loggedOut) +// } +// +// func session(_ session: OTSession, didFailWithError error: OTError) { +// print("The client failed to connect to the session: \(error).") +// } +// +// func session(_ session: OTSession, streamCreated stream: OTStream) { +// print("A stream was created in the session.") +// var error: OTError? +// defer { +// // todo +// } +// subscriber = OTSubscriber(stream: stream, delegate: self) +// +// session.subscribe(subscriber!, error: &error) +// } +// +// func session(_ session: OTSession, streamDestroyed stream: OTStream) { +// print("A stream was destroyed in the session.") +// } +//} +// +//extension OpenTok: OTPublisherDelegate { +// func publisher(_ publisher: OTPublisherKit, streamCreated stream: OTStream) { +// } +// +// func publisher(_ publisher: OTPublisherKit, streamDestroyed stream: OTStream) { +// } +// +// func publisher(_ publisher: OTPublisherKit, didFailWithError error: OTError) { +// print("Publisher failed: \(error.localizedDescription)") +// } +//} +// +//extension OpenTok: OTSubscriberDelegate { +// func subscriberDidConnect(toStream subscriberKit: OTSubscriberKit) { +// print("Subscriber connected") +// +// if let subView = self.subscriber?.view { +// subView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height) +// +// if OpenTokRemoteVideoFactory.view == nil { +// OpenTokRemoteVideoFactory.viewToAddSub = subView +// } else { +// OpenTokRemoteVideoFactory.view?.addSubscriberView(subView) +// } +// } +// } +// +// func subscriber(_ subscriber: OTSubscriberKit, didFailWithError error: OTError) { +// print("Subscriber failed: \(error.localizedDescription)") +// } } diff --git a/lib/main.dart b/lib/main.dart index 9bb465f8..a3175350 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; +import 'package:diplomaticquarterapp/uitl/push-notification-handler.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; @@ -25,14 +26,10 @@ import 'locator.dart'; import 'pages/pharmacies/compare-list.dart'; -Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async { - await Firebase.initializeApp(); - print("Handling a background message: ${message.messageId}"); -} + void main() async { WidgetsFlutterBinding.ensureInitialized(); - // FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler); await Firebase.initializeApp(); setupLocator(); runApp(MyApp()); @@ -74,6 +71,7 @@ class _MyApp extends State { @override Widget build(BuildContext context) { PlatformBridge.init(context); + PushNotificationHandler(context).init(); // Asyncronously LocalNotification.init(onNotificationClick: (payload) { LocalNotification.getInstance().showNow(title: "Payload", subtitle: payload, payload: payload); diff --git a/lib/pages/conference/web_rtc/call_home_page.dart b/lib/pages/conference/web_rtc/call_home_page.dart index 4af7b1de..dd841a6c 100644 --- a/lib/pages/conference/web_rtc/call_home_page.dart +++ b/lib/pages/conference/web_rtc/call_home_page.dart @@ -1,216 +1,61 @@ -import 'dart:async'; - -import 'package:diplomaticquarterapp/pages/conference/web_rtc/widgets/cam_view_widget.dart'; -import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; -import 'package:diplomaticquarterapp/pages/webRTC/call_page.dart'; -import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; -import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart'; - -import '../conference_button_bar.dart'; - -class CallHomePage extends StatefulWidget { - final String receiverId; - final String callerId; - - const CallHomePage({Key key, this.receiverId, this.callerId}) : super(key: key); - - @override - _CallHomePageState createState() => _CallHomePageState(); -} - -class _CallHomePageState extends State { - bool showNoise = false; - RTCVideoRenderer _localRenderer = RTCVideoRenderer(); - RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); - - final StreamController _audioButton = StreamController.broadcast(); - final StreamController _videoButton = StreamController.broadcast(); - final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); - final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); - - //Stream to enable video - MediaStream localMediaStream; - MediaStream remoteMediaStream; - Signaling signaling = Signaling()..init(); - - @override - void initState() { - // TODO: implement initState - super.initState(); - startCall(); - } - - startCall() async{ - await _localRenderer.initialize(); - await _remoteRenderer.initialize(); - final connected = await receivedCall(); - } - - - Future receivedCall() async { - //Stream local media - localMediaStream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true}); - _localRenderer.srcObject = localMediaStream; - - final connected = await signaling.acceptCall(widget.callerId, widget.receiverId, localMediaStream: localMediaStream, onRemoteMediaStream: (remoteMediaStream){ - this.remoteMediaStream = remoteMediaStream; - _remoteRenderer.srcObject = remoteMediaStream; - }); - - if(connected){ - signaling.signalR.listen( - onAcceptCall: (arg0){ - print(arg0.toString()); - }, - onCandidate: (candidateJson){ - signaling.addCandidate(candidateJson); - }, - onDeclineCall: (arg0,arg1){ - // _onHangup(); - }, - onHangupCall: (arg0){ - // _onHangup(); - }, - - onOffer: (offerSdp, callerUser) async{ - print('${offerSdp.toString()} | ${callerUser.toString()}'); - await signaling.answerOffer(offerSdp); - } - ); - } - return connected; - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - _localRenderer?.dispose(); - _remoteRenderer?.dispose(); - _audioButton?.close(); - _videoButton?.close(); - localMediaStream?.dispose(); - remoteMediaStream?.dispose(); - _disposeStreamsAndSubscriptions(); - } - - Future _disposeStreamsAndSubscriptions() async { - if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); - if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); - } - - @override - Widget build(BuildContext context) { - // return WillPopScope( - // onWillPop: () async => false, - // child: Scaffold( - // backgroundColor: Colors.black, - // // body: , - // ), - // ); - - return Scaffold( - backgroundColor: Colors.white, - body: showNoise ? _buildNoiseBox() : buildLayout(), - ); - } - - LayoutBuilder buildLayout() { - return LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { - return Stack( - children: [ - CamViewWidget( - localRenderer: _localRenderer, - remoteRenderer: _remoteRenderer, - constraints: constraints, - onButtonBarVisibleStreamController: _onButtonBarVisibleStreamController, - onButtonBarHeightStreamController: _onButtonBarHeightStreamController, - ), - ConferenceButtonBar( - audioEnabled: _audioButton.stream, - videoEnabled: _videoButton.stream, - onAudioEnabled: _onAudioEnable, - onVideoEnabled: _onVideoEnabled, - onSwitchCamera: _onSwitchCamera, - onHangup: _onHangup, - onPersonAdd: () {}, - onPersonRemove: () {}, - onHeight: _onHeightBar, - onShow: _onShowBar, - onHide: _onHideBar, - ), - ], - ); - }, - ); - } - - NoiseBox _buildNoiseBox() { - return NoiseBox( - density: NoiseBoxDensity.xLow, - backgroundColor: Colors.grey.shade900, - child: Center( - child: Container( - color: Colors.black54, - width: double.infinity, - height: 40, - child: Center( - child: Text( - 'Waiting for another participant to connect to the call...', - key: Key('text-wait'), - textAlign: TextAlign.center, - style: TextStyle(color: Colors.white), - ), - ), - ), - ), - ); - } - - Function _onAudioEnable() { - final audioTrack = localMediaStream.getAudioTracks()[0]; - final mute = audioTrack.muted; - Helper.setMicrophoneMute(!mute, audioTrack); - _audioButton.add(mute); - } - - Function _onVideoEnabled() { - final videoTrack = localMediaStream.getVideoTracks()[0]; - bool videoEnabled = videoTrack.enabled; - localMediaStream.getVideoTracks()[0].enabled = !videoEnabled; - _videoButton.add(!videoEnabled); - } - - Function _onSwitchCamera() { - Helper.switchCamera(localMediaStream.getVideoTracks()[0]); - } - - void _onShowBar() { - setState(() { - }); - _onButtonBarVisibleStreamController.add(true); - } - - void _onHeightBar(double height) { - _onButtonBarHeightStreamController.add(height); - } - - void _onHideBar() { - setState(() { - SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); - }); - _onButtonBarVisibleStreamController.add(false); - } - - Future _onHangup() async { - signaling.hangupCall(widget.callerId, widget.receiverId); - print('onHangup'); - Navigator.of(context).pop(); - } - - -} +// import 'dart:async'; +// +// import 'package:diplomaticquarterapp/pages/conference/web_rtc/widgets/cam_view_widget.dart'; +// import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; +// import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter/services.dart'; +// // import 'package:flutter_webrtc/flutter_webrtc.dart'; +// +// import '../conference_button_bar.dart'; +// +// class CallHomePage extends StatefulWidget { +// final String receiverId; +// final String callerId; +// +// const CallHomePage({Key key, this.receiverId, this.callerId}) : super(key: key); +// +// @override +// _CallHomePageState createState() => _CallHomePageState(); +// } +// +// class _CallHomePageState extends State { +// bool showNoise = false; +// // RTCVideoRenderer _localRenderer = RTCVideoRenderer(); +// // RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); +// +// final StreamController _audioButton = StreamController.broadcast(); +// final StreamController _videoButton = StreamController.broadcast(); +// final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); +// final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); +// +// //Stream to enable video +// // MediaStream localMediaStream; +// // MediaStream remoteMediaStream; +// Signaling signaling = Signaling()..init(); +// +// @override +// void initState() { +// // TODO: implement initState +// super.initState(); +// startCall(); +// } +// +// startCall() async{ +// // await _localRenderer.initialize(); +// // await _remoteRenderer.initialize(); +// } +// +// Future _disposeStreamsAndSubscriptions() async { +// if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); +// if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); +// } +// +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// backgroundColor: Colors.white, +// body: Container() //showNoise ? _buildNoiseBox() : buildLayout(), +// ); +// } +// } diff --git a/lib/pages/conference/web_rtc/call_home_page_.dart b/lib/pages/conference/web_rtc/call_home_page_.dart new file mode 100644 index 00000000..27fb5919 --- /dev/null +++ b/lib/pages/conference/web_rtc/call_home_page_.dart @@ -0,0 +1,186 @@ +import 'dart:async'; + +import 'package:diplomaticquarterapp/pages/conference/web_rtc/widgets/cam_view_widget.dart'; +import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; +import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_webrtc/flutter_webrtc.dart'; + +import '../conference_button_bar.dart'; + +class CallHomePage extends StatefulWidget { + final String receiverId; + final String callerId; + + const CallHomePage({Key key, this.receiverId, this.callerId}) : super(key: key); + + @override + _CallHomePageState createState() => _CallHomePageState(); +} + +class _CallHomePageState extends State { + bool showNoise = true; + RTCVideoRenderer _localRenderer = RTCVideoRenderer(); + RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); + + final StreamController _audioButton = StreamController.broadcast(); + final StreamController _videoButton = StreamController.broadcast(); + final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); + final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); + + //Stream to enable video + MediaStream localMediaStream; + MediaStream remoteMediaStream; + Signaling signaling = Signaling()..init(); + + @override + void initState() { + // TODO: implement initState + super.initState(); + startCall(); + } + + startCall() async{ + await _localRenderer.initialize(); + await _remoteRenderer.initialize(); + final connected = await receivedCall(); + } + + + Future receivedCall() async { + //Stream local media + localMediaStream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true}); + _localRenderer.srcObject = localMediaStream; + + final connected = await signaling.acceptCall(widget.callerId, widget.receiverId, localMediaStream: localMediaStream, onRemoteMediaStream: (remoteMediaStream){ + setState(() { + this.remoteMediaStream = remoteMediaStream; + _remoteRenderer.srcObject = remoteMediaStream; + }); + }); + + if(connected){ + signaling.signalR.listen( + onAcceptCall: (arg0){ + print(arg0.toString()); + }, + onCandidate: (candidateJson){ + signaling.addCandidate(candidateJson); + }, + onDeclineCall: (arg0,arg1){ + // _onHangup(); + }, + onHangupCall: (arg0){ + // _onHangup(); + }, + + onOffer: (offerSdp, callerUser) async{ + print('${offerSdp.toString()} | ${callerUser.toString()}'); + await signaling.answerOffer(offerSdp); + } + ); + } + return connected; + } + + @override + void dispose() { + // TODO: implement dispose + super.dispose(); + _localRenderer?.dispose(); + _remoteRenderer?.dispose(); + _audioButton?.close(); + _videoButton?.close(); + localMediaStream?.dispose(); + remoteMediaStream?.dispose(); + _disposeStreamsAndSubscriptions(); + } + + Future _disposeStreamsAndSubscriptions() async { + if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); + if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + body: buildLayout(), + ); + } + + LayoutBuilder buildLayout() { + return LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + return Stack( + children: [ + CamViewWidget( + localRenderer: _localRenderer, + remoteRenderer: _remoteRenderer, + constraints: constraints, + onButtonBarVisibleStreamController: _onButtonBarVisibleStreamController, + onButtonBarHeightStreamController: _onButtonBarHeightStreamController, + ), + ConferenceButtonBar( + audioEnabled: _audioButton.stream, + videoEnabled: _videoButton.stream, + onAudioEnabled: _onAudioEnable, + onVideoEnabled: _onVideoEnabled, + onSwitchCamera: _onSwitchCamera, + onHangup: _onHangup, + onPersonAdd: () {}, + onPersonRemove: () {}, + onHeight: _onHeightBar, + onShow: _onShowBar, + onHide: _onHideBar, + ), + ], + ); + }, + ); + } + + Function _onAudioEnable() { + final audioTrack = localMediaStream.getAudioTracks()[0]; + final mute = audioTrack.muted; + Helper.setMicrophoneMute(!mute, audioTrack); + _audioButton.add(mute); + } + + Function _onVideoEnabled() { + final videoTrack = localMediaStream.getVideoTracks()[0]; + bool videoEnabled = videoTrack.enabled; + localMediaStream.getVideoTracks()[0].enabled = !videoEnabled; + _videoButton.add(!videoEnabled); + } + + Function _onSwitchCamera() { + Helper.switchCamera(localMediaStream.getVideoTracks()[0]); + } + + void _onShowBar() { + setState(() { + }); + _onButtonBarVisibleStreamController.add(true); + } + + void _onHeightBar(double height) { + _onButtonBarHeightStreamController.add(height); + } + + void _onHideBar() { + setState(() { + SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); + }); + _onButtonBarVisibleStreamController.add(false); + } + + Future _onHangup() async { + signaling.hangupCall(widget.callerId, widget.receiverId); + print('onHangup'); + Navigator.of(context).pop(); + } + + +} diff --git a/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart b/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart index d27dad55..c652cacc 100644 --- a/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart +++ b/lib/pages/conference/web_rtc/widgets/cam_view_widget.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:core'; +import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; import 'package:flutter/material.dart'; import 'package:flutter_webrtc/flutter_webrtc.dart'; @@ -36,19 +37,46 @@ class _CamViewWidgetState extends State { FractionallySizedBox( heightFactor: 1, widthFactor: 1, child: Container( - child: RTCVideoView(widget.remoteRenderer, mirror: true), + color: Colors.black87, + child: RTCVideoView(widget.remoteRenderer, mirror: true,filterQuality: FilterQuality.medium,), ), ), + + if(widget.remoteRenderer.srcObject == null) + Positioned.fill(child: _buildNoiseBox()), + + Positioned.fill( + child: RTCVideoView(widget.remoteRenderer) + ), + DraggableCam( key: Key('publisher'), onButtonBarHeight: widget.onButtonBarHeightStreamController.stream, onButtonBarVisible: widget.onButtonBarVisibleStreamController.stream, availableScreenSize: widget.constraints.biggest, - child: RTCVideoView(widget.localRenderer), + child: RTCVideoView(widget.localRenderer) ), - // Expanded(child: RTCVideoView(widget.remoteRenderer)), + + if(widget.remoteRenderer.srcObject == null) + Container( + margin: EdgeInsets.all(MediaQuery.of(context).size.width/8), + child: Text( + 'Waiting for another participant to connect to the call...', + key: Key('text-wait'), + textAlign: TextAlign.center, + style: TextStyle(color: Colors.white), + ) + ), ], ), ); } + + + Widget _buildNoiseBox() { + return NoiseBox( + density: NoiseBoxDensity.xHigh, + backgroundColor: Colors.grey.shade900, + ); + } } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index efe9f031..f73172b6 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -27,6 +27,7 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; +import 'package:diplomaticquarterapp/uitl/push-notification-handler.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; @@ -44,6 +45,7 @@ import 'package:provider/provider.dart'; import '../../locator.dart'; import '../../routes.dart'; + class LandingPage extends StatefulWidget { static LandingPage shared; _LandingPageState state; @@ -197,37 +199,11 @@ class _LandingPageState extends State with WidgetsBindingObserver { void didChangeAppLifecycleState(AppLifecycleState state) { super.didChangeAppLifecycleState(state); - var route = ModalRoute.of(context); - - if (route != null) {} - - //setState(() { AppGlobal.context = context; if (state == AppLifecycleState.resumed) { - if (LandingPage.isOpenCallPage) { - if (Platform.isAndroid) { - return; - } - if (!isPageNavigated) { - isPageNavigated = true; - Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { - Future.delayed(Duration(seconds: 5), () { - isPageNavigated = false; - }); - }); - } - } + PushNotificationHandler.getInstance().onResume(); sharedPref.remove(APPOINTMENT_HISTORY_MEDICAL); } - - if (state == AppLifecycleState.paused) { - isPageNavigated = false; - } - - if (state == AppLifecycleState.inactive) { - isPageNavigated = false; - } - //}); } @override @@ -239,6 +215,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { @override void initState() { super.initState(); + PushNotificationHandler.getInstance().onResume(); WidgetsBinding.instance.addObserver(this); AppGlobal.context = context; @@ -247,14 +224,11 @@ class _LandingPageState extends State with WidgetsBindingObserver { pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); - // signalRUtil = new SignalRUtil(hubName: "https://VCallApi.hmg.com/WebRTCHub?source=mobile&username=2001273", context: context); - locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context); WidgetsBinding.instance.addPostFrameCallback((_) { if (projectViewModel.isLogin && !projectViewModel.isLoginChild) { familyFileProvider.getSharedRecordByStatus(); } - // if (!signalRUtil.getConnectionState()) signalRUtil.startSignalRConnection(); }); // HMG (Guest/Internet) Wifi Access [Zohaib Kambrani] //for now commented to reduce this call will enable it when needed @@ -263,10 +237,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { // PlatformBridge().connectHMGGuestWifi().then((value) => {GifLoaderDialogUtils.hideDialog(context)}); // }).checkAndConnectIfNoInternet(); - if (Platform.isIOS) { - _firebaseMessaging.requestPermission(); - } - requestPermissions().then((results) { locationUtils.getCurrentLocation(); _firebaseMessaging.getToken().then((String token) { @@ -277,8 +247,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { if (!projectViewModel.isLoginChild) { checkUserStatus(token); } - - // if (projectViewModel.isLogin) this.getNotificationCount(DEVICE_TOKEN); } }); if (results[Permission.location].isGranted) {} @@ -288,180 +256,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { // if (results[Permission.accessMediaLocation].isGranted) ; // if (results[Permission.calendar].isGranted) ; }); - // }); - FirebaseMessaging.onMessage.listen((RemoteMessage message) async { - print("onMessage: $message"); - print(message); - print(message.data['name']); - print(message.data['appointmentdate']); - - if (Platform.isIOS) { - if (message.data['is_call'] == "true") { - var route = ModalRoute.of(context); - - if (route != null) { - print(route.settings.name); - } - Map myMap = new Map.from(message.data); - print(myMap); - LandingPage.isOpenCallPage = true; - LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - if (!isPageNavigated) { - isPageNavigated = true; - Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { - isPageNavigated = false; - }); - } - } else { - print("Is Call Not Found iOS"); - } - } else { - print("Is Call Not Found iOS"); - } - - if (Platform.isAndroid) { - print("messagedata:${message}"); - print("messagedata:${message.data}"); - if (message.data.containsKey("is_call")) { - var route = ModalRoute.of(context); - - if (route != null) { - print(route.settings.name); - } - - Map myMap = new Map.from(message.data); - print(myMap); - if (LandingPage.isOpenCallPage) { - return; - } - LandingPage.isOpenCallPage = true; - LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - if (!isPageNavigated) { - isPageNavigated = true; - Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { - Future.delayed(Duration(seconds: 5), () { - isPageNavigated = false; - }); - }); - } - } else { - print("Is Call Not Found Android"); - LocalNotification.getInstance().showNow(title: message.data['notification']['title'], subtitle: message.data['notification']['body']); - } - } else { - print("Is Call Not Found Android"); - } - }); - FirebaseMessaging.onBackgroundMessage((message) { - return Platform.isIOS ? null : myBackgroundMessageHandler(message.data); - }); - - // todo verify all functionality - - // _firebaseMessaging.configure( - // // onMessage: (Map message) async { - // // // showDialog("onMessage: $message"); - // // print("onMessage: $message"); - // // print(message); - // // print(message['name']); - // // print(message['appointmentdate']); - // // - // // if (Platform.isIOS) { - // // if (message['is_call'] == "true") { - // // var route = ModalRoute.of(context); - // // - // // if (route != null) { - // // print(route.settings.name); - // // } - // // - // // Map myMap = new Map.from(message); - // // print(myMap); - // // LandingPage.isOpenCallPage = true; - // // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // // if (!isPageNavigated) { - // // isPageNavigated = true; - // // Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { - // // isPageNavigated = false; - // // }); - // // } - // // } else { - // // print("Is Call Not Found iOS"); - // // } - // // } else { - // // print("Is Call Not Found iOS"); - // // } - // // - // // if (Platform.isAndroid) { - // // if (message['data'].containsKey("is_call")) { - // // var route = ModalRoute.of(context); - // // - // // if (route != null) { - // // print(route.settings.name); - // // } - // // - // // Map myMap = new Map.from(message['data']); - // // print(myMap); - // // if (LandingPage.isOpenCallPage) { - // // return; - // // } - // // LandingPage.isOpenCallPage = true; - // // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // // if (!isPageNavigated) { - // // isPageNavigated = true; - // // Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { - // // Future.delayed(Duration(seconds: 5), () { - // // isPageNavigated = false; - // // }); - // // }); - // // } - // // } else { - // // print("Is Call Not Found Android"); - // // LocalNotification.getInstance().showNow(title: message['notification']['title'], subtitle: message['notification']['body']); - // // } - // // } else { - // // print("Is Call Not Found Android"); - // // } - // // }, - // onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, - // onLaunch: (Map message) async { - // print("onLaunch: $message"); - // // showDialog("onLaunch: $message"); - // }, - // onResume: (Map message) async { - // print("onResume: $message"); - // print(message); - // print(message['name']); - // print(message['appointmentdate']); - // - // // showDialog("onResume: $message"); - // - // if (Platform.isIOS) { - // if (message['is_call'] == "true") { - // var route = ModalRoute.of(context); - // - // if (route != null) { - // print(route.settings.name); - // } - // - // Map myMap = new Map.from(message); - // print(myMap); - // LandingPage.isOpenCallPage = true; - // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - // if (!isPageNavigated) { - // isPageNavigated = true; - // Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { - // isPageNavigated = false; - // }); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // } else { - // print("Is Call Not Found iOS"); - // } - // }, - // ); } Future> requestPermissions() async { @@ -485,29 +280,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { return permissionResults; } - static Future myBackgroundMessageHandler(Map message) async { - Map myMap = new Map.from(message['data']); - if (message.containsKey('data')) { - LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); - LandingPage.isOpenCallPage = true; - // Future.delayed(Duration(seconds: 3), () { - // Navigator.push(locator().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))); - NavigationService.instance.navigateTo(INCOMING_CALL_PAGE); - // }); - // if (!isPageNavigated) { - // isPageNavigated = true; - // Navigator.push(locator().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))); - // .then((value) { - // isPageNavigated = false; - // }); - // } - } - - if (message.containsKey('notification')) { - final dynamic notification = message['notification']; - } - } - void setUserValues(value) async { if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); } diff --git a/lib/pages/livecare/incoming_call.dart b/lib/pages/livecare/incoming_call.dart index 09a13205..bd191afc 100644 --- a/lib/pages/livecare/incoming_call.dart +++ b/lib/pages/livecare/incoming_call.dart @@ -4,6 +4,7 @@ import 'package:camera/camera.dart'; import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; import 'package:diplomaticquarterapp/models/LiveCare/room_model.dart'; import 'package:diplomaticquarterapp/pages/conference/web_rtc/call_home_page.dart'; +import 'package:diplomaticquarterapp/pages/conference/web_rtc/call_home_page_.dart'; import 'package:diplomaticquarterapp/pages/conference/widgets/platform_exception_alert_dialog.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -197,119 +198,6 @@ class _IncomingCallState extends State with SingleTickerProviderSt } }, ), - // body: isCameraReady - // ? - // : Container( - // height: 200.0, - // width: 200.0, - // color: Colors.green, - // ), - // body: Container( - // decoration: BoxDecoration(color: Colors.grey[700]), - // child: Column( - // mainAxisAlignment: MainAxisAlignment.start, - // mainAxisSize: MainAxisSize.max, - // children: [ - // Container( - // margin: EdgeInsets.only(top: 30.0), - // alignment: Alignment.center, - // child: Text("Incoming Video Call", textAlign: TextAlign.center, style: TextStyle(fontSize: 26.0, color: Colors.white, letterSpacing: 1.0)), - // ), - // Container( - // alignment: Alignment.center, - // margin: EdgeInsets.fromLTRB(50.0, 30.0, 50.0, 20.0), - // child: Image.asset('assets/images/new-design/hmg_full_logo_hd_white.png'), - // ), - // Container( - // margin: EdgeInsets.fromLTRB(30.0, 10.0, 30.0, 0.0), - // child: Divider( - // color: Colors.white, - // thickness: 1.0, - // ), - // ), - // Container( - // margin: EdgeInsets.only(top: 20.0), - // alignment: Alignment.center, - // child: Text("Dr Eyad Ismail Abu Jayab", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.bold, letterSpacing: 0.8, color: Colors.white)), - // ), - // Container( - // margin: EdgeInsets.only(top: 10.0), - // alignment: Alignment.center, - // child: Text("ENT Clinic", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, letterSpacing: 0.8, color: Colors.white)), - // ), - // Container( - // margin: EdgeInsets.only(top: 10.0), - // alignment: Alignment.center, - // child: Text("Speciality", textAlign: TextAlign.center, style: TextStyle(fontSize: 22.0, letterSpacing: 0.8, color: Colors.white)), - // ), - // Container( - // decoration: BoxDecoration( - // color: Colors.grey[900].withOpacity(0.8), - // borderRadius: BorderRadius.all(Radius.circular(10.0)), - // ), - // padding: EdgeInsets.all(20.0), - // margin: EdgeInsets.only(top: 20.0), - // child: Column( - // children: [ - // Text("Appointment Information", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold, letterSpacing: 1.0, color: Colors.white)), - // Container( - // margin: EdgeInsets.only(top: 20.0), - // child: Text("Sun, 15th Dec, 2019, 09:00", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, letterSpacing: 1.0, color: Colors.white)), - // ), - // Container( - // margin: EdgeInsets.only(top: 20.0), - // child: Text("ENT Clinic", textAlign: TextAlign.center, style: TextStyle(fontSize: 20.0, letterSpacing: 1.0, color: Colors.white)), - // ), - // ], - // ), - // ), - // Container( - // margin: EdgeInsets.only(top: 100.0), - // alignment: Alignment.center, - // child: Row( - // mainAxisSize: MainAxisSize.max, - // mainAxisAlignment: MainAxisAlignment.spaceEvenly, - // children: [ - // RotationTransition( - // turns: Tween(begin: 0.0, end: -.1).chain(CurveTween(curve: Curves.elasticIn)).animate(_animationController), - // child: Container( - // child: RawMaterialButton( - // onPressed: () { - // _submit(); - // }, - // elevation: 2.0, - // fillColor: Colors.green, - // child: Icon( - // Icons.call, - // color: Colors.white, - // size: 35.0, - // ), - // padding: EdgeInsets.all(15.0), - // shape: CircleBorder(), - // ), - // )), - // Container( - // child: RawMaterialButton( - // onPressed: () { - // LandingPage.isOpenCallPage = false; - // backToHome(); - // }, - // elevation: 2.0, - // fillColor: Colors.red, - // child: Icon( - // Icons.call_end, - // color: Colors.white, - // size: 35.0, - // ), - // padding: EdgeInsets.all(15.0), - // shape: CircleBorder(), - // ), - // ), - // ], - // ), - // ), - // ], - // )), ); } @@ -339,6 +227,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt Future _submit() async { // backToHome(); try { + final roomModel = RoomModel(name: widget.incomingCallData.name, token: widget.incomingCallData.sessionId, identity: widget.incomingCallData.identity); // await Navigator.of(context).push( @@ -348,6 +237,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt // ConferencePage(roomModel: roomModel), // ), // ); + _controller.dispose(); await Navigator.of(context).pushReplacement( MaterialPageRoute( fullscreenDialog: true, diff --git a/lib/uitl/app_shared_preferences.dart b/lib/uitl/app_shared_preferences.dart index 3ea323df..f90a2f98 100644 --- a/lib/uitl/app_shared_preferences.dart +++ b/lib/uitl/app_shared_preferences.dart @@ -79,7 +79,7 @@ class AppSharedPreferences { } /// Get Object [key] the key was saved - getObject(String key) async { + Future getObject(String key) async { final SharedPreferences prefs = await _prefs; var string = prefs.getString(key); if (string == null) { diff --git a/lib/uitl/navigation_service.dart b/lib/uitl/navigation_service.dart index 3e720dea..7bc9af04 100644 --- a/lib/uitl/navigation_service.dart +++ b/lib/uitl/navigation_service.dart @@ -1,12 +1,19 @@ +import 'package:diplomaticquarterapp/locator.dart'; import 'package:flutter/material.dart'; class NavigationService { final GlobalKey navigatorKey = new GlobalKey(); - static NavigationService instance = NavigationService(); - Future navigateTo(String routeName) { - return navigatorKey.currentState.pushNamed(routeName); + static Future navigateTo(String routeName) { + final key = locator().navigatorKey; + return key.currentState.pushNamed(routeName); + } + + static Future navigateToPage(Widget page) { + final key = locator().navigatorKey; + final pageRoute = MaterialPageRoute(builder: (context) => page); + return Navigator.push(key.currentContext, pageRoute); } } diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart new file mode 100644 index 00000000..8c6ef5dc --- /dev/null +++ b/lib/uitl/push-notification-handler.dart @@ -0,0 +1,279 @@ + +import 'dart:convert'; +import 'dart:io'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:huawei_push/huawei_push.dart' as h_push; +import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:firebase_messaging/firebase_messaging.dart' as fir; +import 'package:flutter_hms_gms_availability/flutter_hms_gms_availability.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import 'app_shared_preferences.dart'; +import 'navigation_service.dart'; + + +// |--> Push Notification Background +Future backgroundMessageHandler(dynamic message) async{ + + fir.RemoteMessage message_; + if(message is h_push.RemoteMessage){ // if huawei remote message convert it to Firebase Remote Message + message_ = toFirebaseRemoteMessage(message); + } + + if (message_.data != null && message_.data['is_call'] == 'true') { + _incomingCall(message_.data); + return; + } + + + print("Background message is received, sending local notification."); + h_push.Push.localNotification({ + h_push.HMSLocalNotificationAttr.TITLE: 'Background Message', + h_push.HMSLocalNotificationAttr.MESSAGE: "By: BackgroundMessageHandler" + }); + +} +// Push Notification Background <--| + + + +RemoteMessage toFirebaseRemoteMessage(h_push.RemoteMessage message){ + final payload_data = jsonDecode(message.data); + final fire_message = RemoteMessage( + from: message.from, + collapseKey: message.collapseKey, + data: payload_data['data'], + messageId: message.messageId, + sentTime: DateTime.fromMillisecondsSinceEpoch(message.sentTime*1000), + ttl: message.ttl, + category: null, + messageType: message.type, + notification: RemoteNotification( + title: message.notification.title, + titleLocArgs: (message.notification.titleLocalizationArgs ?? []).map((e) => e.toString()).toList(), + titleLocKey: message.notification.titleLocalizationKey, + body: message.notification.body, + bodyLocArgs: (message.notification.bodyLocalizationArgs ?? []).map((e) => e.toString()).toList(), + bodyLocKey: message.notification.bodyLocalizationKey, + android: AndroidNotification( + channelId: message.notification.channelId, + clickAction: message.notification.clickAction, + color: message.notification.color, + count: null, + imageUrl: message.notification.imageUrl.path, + link: message.notification.link.path, + smallIcon: message.notification.icon, + sound: message.notification.sound, + ticker: message.notification.ticker, + tag: message.notification.tag, + ), + ) + ); + return fire_message; +} + +_incomingCall(Map data) async{ + LandingPage.incomingCallData = IncomingCallData.fromJson(data); + if(LandingPage.isOpenCallPage == false){ + LandingPage.isOpenCallPage = true; + await NavigationService.navigateToPage(IncomingCall(incomingCallData: LandingPage.incomingCallData)); + LandingPage.isOpenCallPage = false; + } + await Future.delayed(Duration(milliseconds: 500)); + await AppSharedPreferences().remove('call_data'); +} + +class PushNotificationHandler{ + final BuildContext context; + static PushNotificationHandler _instance; + + PushNotificationHandler(this.context){ + PushNotificationHandler._instance = this; + } + + static PushNotificationHandler getInstance() => _instance; + + init() async{ + if (Platform.isIOS) { + final permission = await FirebaseMessaging.instance.requestPermission(); + if(permission.authorizationStatus == AuthorizationStatus.denied) + return; + } + + if(Platform.isAndroid && (await FlutterHmsGmsAvailability.isHmsAvailable)) { // 'Android HMS' (Handle Huawei Push_Kit Streams) + + h_push.Push.enableLogger(); + final result = await h_push.Push.setAutoInitEnabled(true); + + h_push.Push.onNotificationOpenedApp.listen((message){ + newMessage(toFirebaseRemoteMessage(message)); + }, onError: (e) => print(e.toString())); + + h_push.Push.onMessageReceivedStream.listen((message){ + newMessage(toFirebaseRemoteMessage(message)); + }, onError: (e) => print(e.toString())); + + + h_push.Push.getTokenStream.listen((token){ + onToken(token); + }, onError: (e) => print(e.toString())); + await h_push.Push.getToken(''); + + + h_push.Push.registerBackgroundMessageHandler(backgroundMessageHandler); + + }else{ // 'Android GMS or iOS' (Handle Firebase Messaging Streams) + + FirebaseMessaging.onMessage.listen((RemoteMessage message) async { + newMessage(message); + }); + + FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) { + newMessage(message); + }); + + FirebaseMessaging.instance.onTokenRefresh.listen((fcm_token) { + onToken(fcm_token); + }); + + FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler); + + final fcmToken = await FirebaseMessaging.instance.getToken(); + if(fcmToken != null) + onToken(fcmToken); + } + } + + + newMessage(RemoteMessage remoteMessage){ + print('RemoteMessage.data:: ${remoteMessage.data}'); + if(remoteMessage.data['is_call'] == 'true' || remoteMessage.data['is_call'] == true) + _incomingCall(remoteMessage.data); + + } + + onToken(String token) async{ + print("Push Notification Token: " + token); + AppSharedPreferences().setString(PUSH_TOKEN, token); + DEVICE_TOKEN = token; + } + + onResume() async { + var call_data = await AppSharedPreferences().getObject('call_data'); + if(call_data != null){ + _incomingCall(call_data); + } + } + +} + +/* todo verify all functionality */ +// _firebaseMessaging.configure( +// // onMessage: (Map message) async { +// // // showDialog("onMessage: $message"); +// // print("onMessage: $message"); +// // print(message); +// // print(message['name']); +// // print(message['appointmentdate']); +// // +// // if (Platform.isIOS) { +// // if (message['is_call'] == "true") { +// // var route = ModalRoute.of(context); +// // +// // if (route != null) { +// // print(route.settings.name); +// // } +// //s +// // Map myMap = new Map.from(mesage); +// // print(myMap); +// // LandingPage.isOpenCallPage = true; +// // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); +// // if (!isPageNavigated) { +// // isPageNavigated = true; +// // Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { +// // isPageNavigated = false; +// // }); +// // } +// // } else { +// // print("Is Call Not Found iOS"); +// // } +// // } else { +// // print("Is Call Not Found iOS"); +// // } +// // +// // if (Platform.isAndroid) { +// // if (message['data'].containsKey("is_call")) { +// // var route = ModalRoute.of(context); +// // +// // if (route != null) { +// // print(route.settings.name); +// // } +// // +// // Map myMap = new Map.from(message['data']); +// // print(myMap); +// // if (LandingPage.isOpenCallPage) { +// // return; +// // } +// // LandingPage.isOpenCallPage = true; +// // LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); +// // if (!isPageNavigated) { +// // isPageNavigated = true; +// // Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { +// // Future.delayed(Duration(seconds: 5), () { +// // isPageNavigated = false; +// // }); +// // }); +// // } +// // } else { +// // print("Is Call Not Found Android"); +// // LocalNotification.getInstance().showNow(title: message['notification']['title'], subtitle: message['notification']['body']); +// // } +// // } else { +// // print("Is Call Not Found Android"); +// // } +// // }, +// onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, +// onLaunch: (Map message) async { +// print("onLaunch: $message"); +// // showDialog("onLaunch: $message"); +// }, +// onResume: (Map message) async { +// print("onResume: $message"); +// print(message); +// print(message['name']); +// print(message['appointmentdate']); +// +// // showDialog("onResume: $message"); +// +// if (Platform.isIOS) { +// if (message['is_call'] == "true") { +// var route = ModalRoute.of(context); +// +// if (route != null) { +// print(route.settings.name); +// } +// +// Map myMap = new Map.from(message); +// print(myMap); +// LandingPage.isOpenCallPage = true; +// LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); +// if (!isPageNavigated) { +// isPageNavigated = true; +// Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { +// isPageNavigated = false; +// }); +// } +// } else { +// print("Is Call Not Found iOS"); +// } +// } else { +// print("Is Call Not Found iOS"); +// } +// }, +// ); \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 8cf5ace0..b67ccb0b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -56,6 +56,8 @@ dependencies: flutter_flexible_toast: ^0.1.4 firebase_messaging: ^11.1.0 firebase_analytics: ^8.3.4 + + # Progress bar progress_hud_v2: ^2.0.0 percent_indicator: ^3.4.0 @@ -84,7 +86,10 @@ dependencies: charts_flutter: ^0.12.0 google_maps_flutter: ^2.1.1 + + # Huawei huawei_map: ^6.0.1+304 + huawei_push: ^5.3.0+304 # Qr code Scanner TODO fix it # barcode_scanner: ^1.0.1 @@ -134,7 +139,7 @@ dependencies: jiffy: ^4.1.0 #Flutter WebRTC - flutter_webrtc: ^0.7.1 + flutter_webrtc: ^0.8.0 screen: ^0.0.5 From 7733c74f00f8950f555b5619b790e5e396e7f9ed Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 14 Dec 2021 11:30:52 +0300 Subject: [PATCH 35/39] Updates & fixes --- lib/core/service/client/base_app_client.dart | 20 +++++++++---------- .../PharmacyAddressesViewModel.dart | 17 +++------------- .../pharmacyAddresses/PharmacyAddresses.dart | 15 +++++++------- .../pharmacyAddress_service.dart | 1 + 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 94492c6c..99365d0c 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -232,7 +232,7 @@ class BaseAppClient { Map headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', - 'Authorization': token ?? '', + 'Authorization': pharmacyToken ?? '', 'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "", 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Username': user != null ? user['PatientID'].toString() : "", @@ -291,20 +291,21 @@ class BaseAppClient { body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : user['PatientID']; body['PatientOutSA'] = user['OutSA']; body['SessionID'] = SESSION_ID; //getSe - headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': pharmacyToken, - 'Mobilenumber': user['MobileNumber'].toString(), - 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', - 'Username': user['PatientID'].toString(), - }; + // headers = { + // 'Content-Type': 'application/json', + // 'Accept': 'application/json', + // 'Authorization': pharmacyToken, + // 'Mobilenumber': user['MobileNumber'].toString(), + // 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', + // 'Username': user['PatientID'].toString(), + // }; } } } print("URL : $url"); print("Body : ${json.encode(body)}"); + print("Headers : ${json.encode(headers)}"); if (await Utils.checkConnection()) { final response = await http.post(url.trim(), body: json.encode(body), headers: headers); @@ -709,7 +710,6 @@ class BaseAppClient { body['PatientTypeID'] = body.containsKey('PatientTypeID') ? body['PatientTypeID'] != null - ? body['PatientTypeID'] : user['PatientType'] != null ? user['PatientType'] diff --git a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart index dae79ac1..2e883e5e 100644 --- a/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart @@ -1,11 +1,9 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Country.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart'; import 'package:google_maps_place_picker/google_maps_place_picker.dart'; import '../../../locator.dart'; @@ -76,27 +74,18 @@ class PharmacyAddressesViewModel extends BaseViewModel { sendingAddress.customerAttributes = ""; sendingAddress.createdOnUtc = DateTime.now().toString(); if (editedAddress == null) { - - ///TODO Fatima* await _pharmacyAddressService.addCustomerAddress(sendingAddress); - } else { - await _pharmacyAddressService.editCustomerAddress(sendingAddress); - + await _pharmacyAddressService.editCustomerAddress(sendingAddress).then((value) async { + // await _pharmacyAddressService.getAddresses(); + }); } if (_pharmacyAddressService.hasError) { - await _pharmacyAddressService.getAddresses(); setState(ViewState.Idle); - - - // setState(ViewState.Error); } else { setState(ViewState.Idle); } - - - } Future deleteAddresses(AddressInfo address) async { diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index c5edac52..3a9c4da4 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -37,10 +37,10 @@ class _PharmacyAddressesState extends State { ctx, FadePage( page: AddAddressPage(address, (pickResult) async { - model.addEditAddress(pickResult, address); - await model.getAddressesList(); - - }))); + await model.addEditAddress(pickResult, address); + }))).then((value) async { + // await model.getAddressesList(); + }); } Widget build(BuildContext context) { @@ -314,7 +314,7 @@ class _AddressItemWidgetState extends State { textColor: Color(0x99FF0000), handler: () { ConfirmDialog dialog = new ConfirmDialog( - // context: context, + // context: context, title: TranslationBase.of(context).deleteAddress, //"Are you sure want to delete", confirmMessage: "${widget.address.address1} ${widget.address.address2}", @@ -323,8 +323,9 @@ class _AddressItemWidgetState extends State { okFunction: () => { widget.model.deleteAddresses(widget.address).then((_) { ConfirmDialog.closeAlertDialog(context); - AppToast.showErrorToast(message: TranslationBase.of(context).deletedAddress, - // "Address has been deleted" + AppToast.showErrorToast( + message: TranslationBase.of(context).deletedAddress, + // "Address has been deleted" ); }) }, diff --git a/lib/services/pharmacy_services/pharmacyAddress_service.dart b/lib/services/pharmacy_services/pharmacyAddress_service.dart index 5329c658..352473e4 100644 --- a/lib/services/pharmacy_services/pharmacyAddress_service.dart +++ b/lib/services/pharmacy_services/pharmacyAddress_service.dart @@ -104,6 +104,7 @@ class PharmacyAddressService extends BaseService { response['customers'][0]['addresses'].forEach((item) { addresses.add(AddressInfo.fromJson(item)); }); + getAddresses(); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; From c8b5602d8e09d020cbdc331662e57a50caf09e6c Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Tue, 14 Dec 2021 11:57:16 +0300 Subject: [PATCH 36/39] flutter 2.8 improvements. --- lib/pages/Blood/new_text_Field.dart | 5 +---- lib/pages/medical/balance/new_text_Field.dart | 6 ++---- lib/widgets/input/text_field.dart | 5 +---- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/pages/Blood/new_text_Field.dart b/lib/pages/Blood/new_text_Field.dart index 643e1a93..641d528f 100644 --- a/lib/pages/Blood/new_text_Field.dart +++ b/lib/pages/Blood/new_text_Field.dart @@ -71,7 +71,6 @@ class NewTextFields extends StatefulWidget { this.onTap, this.fontSize = 16.0, this.fontWeight = FontWeight.w700, - this.autoValidate = false, this.hintColor,this.isEnabled=true}) : super(key: key); @@ -104,7 +103,6 @@ class NewTextFields extends StatefulWidget { final bool keepPadding; final TextCapitalization textCapitalization; final List inputFormatters; - final bool autoValidate; final EdgeInsets padding; final bool focus; final bool borderOnlyError; @@ -166,7 +164,6 @@ class _NewTextFieldsState extends State { initialValue: widget.initialValue, keyboardAppearance: Theme.of(context).brightness, scrollPhysics: BouncingScrollPhysics(), - autovalidate: widget.autoValidate, textCapitalization: widget.textCapitalization, onFieldSubmitted: widget.inputAction == TextInputAction.next ? (widget.onSubmit != null @@ -196,7 +193,7 @@ class _NewTextFieldsState extends State { .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), inputFormatters: widget.keyboardType == TextInputType.phone ? [ - WhitelistingTextInputFormatter.digitsOnly, + FilteringTextInputFormatter.digitsOnly, _mobileFormatter, ] : widget.inputFormatters, diff --git a/lib/pages/medical/balance/new_text_Field.dart b/lib/pages/medical/balance/new_text_Field.dart index e1f7fdd4..31476d06 100644 --- a/lib/pages/medical/balance/new_text_Field.dart +++ b/lib/pages/medical/balance/new_text_Field.dart @@ -71,7 +71,7 @@ class NewTextFields extends StatefulWidget { this.onTap, this.fontSize = 14.0, this.fontWeight = FontWeight.w600, - this.autoValidate = false, + this.hintColor, this.isEnabled = true,this.counterText=""}) : super(key: key); @@ -105,7 +105,6 @@ class NewTextFields extends StatefulWidget { final bool keepPadding; final TextCapitalization textCapitalization; final List inputFormatters; - final bool autoValidate; final EdgeInsets padding; final bool focus; final bool borderOnlyError; @@ -166,7 +165,6 @@ class _NewTextFieldsState extends State { initialValue: widget.initialValue, keyboardAppearance: Theme.of(context).brightness, scrollPhysics: BouncingScrollPhysics(), - autovalidate: widget.autoValidate, textCapitalization: widget.textCapitalization, onFieldSubmitted: widget.inputAction == TextInputAction.next ? (widget.onSubmit != null @@ -193,7 +191,7 @@ class _NewTextFieldsState extends State { fontSize: widget.fontSize, fontWeight: widget.fontWeight), inputFormatters: widget.keyboardType == TextInputType.phone ? [ - WhitelistingTextInputFormatter.digitsOnly, + FilteringTextInputFormatter.digitsOnly, _mobileFormatter, ] : widget.inputFormatters, diff --git a/lib/widgets/input/text_field.dart b/lib/widgets/input/text_field.dart index 9bb899cb..99f3625f 100644 --- a/lib/widgets/input/text_field.dart +++ b/lib/widgets/input/text_field.dart @@ -70,7 +70,6 @@ class TextFields extends StatefulWidget { this.onTap, this.fontSize = 16.0, this.fontWeight = FontWeight.w700, - this.autoValidate = false, this.fillColor, this.hintColor}) : super(key: key); @@ -102,7 +101,6 @@ class TextFields extends StatefulWidget { final bool keepPadding; final TextCapitalization textCapitalization; final List inputFormatters; - final bool autoValidate; final EdgeInsets padding; final bool focus; final bool borderOnlyError; @@ -214,7 +212,6 @@ class _TextFieldsState extends State { keyboardAppearance: Theme.of(context).brightness, scrollPhysics: BouncingScrollPhysics(), - autovalidate: widget.autoValidate, textCapitalization: widget.textCapitalization, onFieldSubmitted: widget.inputAction == TextInputAction.next ? (widget.onSubmit != null @@ -245,7 +242,7 @@ class _TextFieldsState extends State { inputFormatters: widget.keyboardType == TextInputType.phone ? [ - WhitelistingTextInputFormatter.digitsOnly, + FilteringTextInputFormatter.digitsOnly, _mobileFormatter, ] : widget.inputFormatters, From eea701907dfe9c63af79e16e33314069066b1db0 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 14 Dec 2021 14:17:53 +0300 Subject: [PATCH 37/39] Login fixes --- lib/pages/login/login.dart | 4 +--- lib/uitl/app_shared_preferences.dart | 36 ++++++++++++++++++---------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 49c8d0d6..984f64bf 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -1,4 +1,3 @@ -import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; @@ -8,7 +7,6 @@ import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; -import 'package:diplomaticquarterapp/models/Authentication/checkpatient_for_registration.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; @@ -315,7 +313,7 @@ class _Login extends State { projectViewModel.setPrivilege(privilegeList: result); result = CheckActivationCode.fromJson(result); result.list.isFamily = false; - this.sharedPref.setString(BLOOD_TYPE, result.patientBloodType); + this.sharedPref.setString(BLOOD_TYPE, result.patientBloodType != null ? result.patientBloodType : ""); this.sharedPref.setObject(USER_PROFILE, result.list); this.sharedPref.setObject(MAIN_USER, result.list); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); diff --git a/lib/uitl/app_shared_preferences.dart b/lib/uitl/app_shared_preferences.dart index f90a2f98..726aa543 100644 --- a/lib/uitl/app_shared_preferences.dart +++ b/lib/uitl/app_shared_preferences.dart @@ -7,38 +7,50 @@ class AppSharedPreferences { /// Save String [key] the key for save value [value] the value we need to save it setString(String key, String value) async { - final SharedPreferences prefs = await _prefs; - return prefs.setString(key, value); + if (value != null) { + final SharedPreferences prefs = await _prefs; + return prefs.setString(key, value); + } } /// Save List of String [key] the key for save value [value] the value we need to save it setStringList(String key, List value) async { - final SharedPreferences prefs = await _prefs; - return prefs.setStringList(key, value); + if (value != null) { + final SharedPreferences prefs = await _prefs; + return prefs.setStringList(key, value); + } } /// Save Double [key] the key for save value [value] the value we need to save it setDouble(String key, double value) async { - final SharedPreferences prefs = await _prefs; - return prefs.setDouble(key, value); + if (value != null) { + final SharedPreferences prefs = await _prefs; + return prefs.setDouble(key, value); + } } /// Save Bool [key] the key for save value [value] the value we need to save it setBool(String key, bool value) async { - final SharedPreferences prefs = await _prefs; - return prefs.setBool(key, value); + if (value != null) { + final SharedPreferences prefs = await _prefs; + return prefs.setBool(key, value); + } } /// Save int [key] the key for save value [value] the value we need to save it setInt(String key, int value) async { - final SharedPreferences prefs = await _prefs; - return prefs.setInt(key, value); + if (value != null) { + final SharedPreferences prefs = await _prefs; + return prefs.setInt(key, value); + } } /// save Object [key] the key for save value [value] the value we need to save it setObject(String key, value) async { - final SharedPreferences prefs = await _prefs; - return prefs.setString(key, json.encode(value)); + if (value != null) { + final SharedPreferences prefs = await _prefs; + return prefs.setString(key, json.encode(value)); + } } /// Get String [key] the key was saved From 3107d1e86db2da253c0424dba223a8955dcab8ba Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 15 Dec 2021 11:57:35 +0300 Subject: [PATCH 38/39] Updates & fixes --- android/app/build.gradle | 2 +- .../diplomaticquarterapp/MainActivity.kt | 2 +- .../opentok/LocalVideo.kt | 116 +++--- .../diplomaticquarterapp/opentok/OpenTok.kt | 340 +++++++++--------- .../opentok/RemoteVideo.kt | 116 +++--- .../utils/OpenTokPlatformBridge.kt | 84 ++--- android/build.gradle | 6 + ios/Podfile | 2 +- ios/Runner/Runner.entitlements | 11 +- .../authentication/auth_provider.dart | 12 +- .../family_files/family_files_provider.dart | 8 +- lib/uitl/app_shared_preferences.dart | 24 +- pubspec.yaml | 3 +- 13 files changed, 375 insertions(+), 351 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 65bb55fe..dc377f5c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -120,7 +120,7 @@ dependencies { implementation 'com.google.android.gms:play-services-basement:17.5.0' - implementation "com.opentok.android:opentok-android-sdk:2.19.1" +// implementation "com.opentok.android:opentok-android-sdk:2.19.1" implementation 'com.facebook.stetho:stetho:1.5.1' implementation 'com.facebook.stetho:stetho-urlconnection:1.5.1' diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt index 957262c3..0e5e1117 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/MainActivity.kt @@ -18,7 +18,7 @@ class MainActivity: FlutterFragmentActivity() { WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON or WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON) PlatformBridge(flutterEngine, this).create() - OpenTokPlatformBridge(flutterEngine, this).create() +// OpenTokPlatformBridge(flutterEngine, this).create() val time = timeToMillis("04:00:00", "HH:mm:ss") diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/LocalVideo.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/LocalVideo.kt index cfebfe65..960665d5 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/LocalVideo.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/LocalVideo.kt @@ -1,58 +1,58 @@ -package com.ejada.hmg.opentok - -import android.content.Context -import android.util.AttributeSet -import android.view.LayoutInflater -import android.view.View -import android.widget.FrameLayout -import android.widget.LinearLayout -import com.ejada.hmg.R -import io.flutter.plugin.common.StandardMessageCodec -import io.flutter.plugin.platform.PlatformView -import io.flutter.plugin.platform.PlatformViewFactory - -class LocalVideoFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) { - - companion object { - private lateinit var view: LocalVideoPlatformView - - fun getViewInstance(context: Context): LocalVideoPlatformView { - if(!this::view.isInitialized) { - view = LocalVideoPlatformView(context) - } - - return view - } - } - - override fun create(context: Context, viewId: Int, args: Any?): PlatformView { - return getViewInstance(context) - } -} - -class LocalVideoPlatformView(context: Context) : PlatformView { - private val videoContainer: LocalVideoContainer = LocalVideoContainer(context) - - val container get() = videoContainer.publisherContainer - - override fun getView(): View { - return videoContainer - } - - override fun dispose() {} -} - -class LocalVideoContainer @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyle: Int = 0, - defStyleRes: Int = 0 -) : LinearLayout(context, attrs, defStyle, defStyleRes) { - - var publisherContainer: FrameLayout private set - - init { - val view = LayoutInflater.from(context).inflate(R.layout.local_video, this, true) - publisherContainer = view.findViewById(R.id.publisher_container) - } -} \ No newline at end of file +//package com.ejada.hmg.opentok +// +//import android.content.Context +//import android.util.AttributeSet +//import android.view.LayoutInflater +//import android.view.View +//import android.widget.FrameLayout +//import android.widget.LinearLayout +//import com.ejada.hmg.R +//import io.flutter.plugin.common.StandardMessageCodec +//import io.flutter.plugin.platform.PlatformView +//import io.flutter.plugin.platform.PlatformViewFactory +// +//class LocalVideoFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) { +// +// companion object { +// private lateinit var view: LocalVideoPlatformView +// +// fun getViewInstance(context: Context): LocalVideoPlatformView { +// if(!this::view.isInitialized) { +// view = LocalVideoPlatformView(context) +// } +// +// return view +// } +// } +// +// override fun create(context: Context, viewId: Int, args: Any?): PlatformView { +// return getViewInstance(context) +// } +//} +// +//class LocalVideoPlatformView(context: Context) : PlatformView { +// private val videoContainer: LocalVideoContainer = LocalVideoContainer(context) +// +// val container get() = videoContainer.publisherContainer +// +// override fun getView(): View { +// return videoContainer +// } +// +// override fun dispose() {} +//} +// +//class LocalVideoContainer @JvmOverloads constructor( +// context: Context, +// attrs: AttributeSet? = null, +// defStyle: Int = 0, +// defStyleRes: Int = 0 +//) : LinearLayout(context, attrs, defStyle, defStyleRes) { +// +// var publisherContainer: FrameLayout private set +// +// init { +// val view = LayoutInflater.from(context).inflate(R.layout.local_video, this, true) +// publisherContainer = view.findViewById(R.id.publisher_container) +// } +//} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/OpenTok.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/OpenTok.kt index d53d6f9a..6d8e668a 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/OpenTok.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/OpenTok.kt @@ -1,170 +1,170 @@ -package com.ejada.hmg.opentok - -import android.content.Context -import android.os.Handler -import android.os.Looper -import android.util.Log -import android.view.ViewGroup -import com.facebook.stetho.urlconnection.StethoURLConnectionManager -import com.opentok.android.* -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister -import io.flutter.plugin.common.MethodCall -import io.flutter.plugin.common.MethodChannel - - -enum class OpenTokSDKState { - LOGGED_OUT, - LOGGED_IN, - WAIT, - ERROR -} - -class OpenTok(private var context: Context, private var flutterEngine: FlutterEngine){ - private lateinit var remoteVideoPlatformView: RemoteVideoPlatformView - private lateinit var localVideoPlatformView: LocalVideoPlatformView - - init { - remoteVideoPlatformView = RemoteVideoFactory.getViewInstance(context) - flutterEngine - .platformViewsController - .registry - .registerViewFactory("remote-video-container", RemoteVideoFactory()) - - localVideoPlatformView = LocalVideoFactory.getViewInstance(context) - flutterEngine - .platformViewsController - .registry - .registerViewFactory("local-video-container", LocalVideoFactory()) - } - - private var session: Session? = null - private var publisher: Publisher? = null - private var subscriber: Subscriber? = null - - - - private val sessionListener: Session.SessionListener = object: Session.SessionListener { - override fun onConnected(session: Session) { - // Connected to session - Log.d("MainActivity", "Connected to session ${session.sessionId}") - - publisher = Publisher.Builder(context).build().apply { - setPublisherListener(publisherListener) - renderer?.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL) - - view.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) - localVideoPlatformView.container.addView(view) - } - - notifyFlutter(OpenTokSDKState.LOGGED_IN) - session.publish(publisher) - } - - override fun onDisconnected(session: Session) { - notifyFlutter(OpenTokSDKState.LOGGED_OUT) - } - - override fun onStreamReceived(session: Session, stream: Stream) { - Log.d( - "MainActivity", - "onStreamReceived: New Stream Received " + stream.streamId + " in session: " + session.sessionId - ) - if (subscriber == null) { - subscriber = Subscriber.Builder(context, stream).build().apply { - renderer?.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL) - setSubscriberListener(subscriberListener) - session.subscribe(this) - - remoteVideoPlatformView.container.addView(view) - } - } - } - - override fun onStreamDropped(session: Session, stream: Stream) { - Log.d( - "MainActivity", - "onStreamDropped: Stream Dropped: " + stream.streamId + " in session: " + session.sessionId - ) - - if (subscriber != null) { - subscriber = null - - remoteVideoPlatformView.container.removeAllViews() - } - } - - override fun onError(session: Session, opentokError: OpentokError) { - Log.d("MainActivity", "Session error: " + opentokError.message) - notifyFlutter(OpenTokSDKState.ERROR) - } - } - - private val publisherListener: PublisherKit.PublisherListener = object : PublisherKit.PublisherListener { - override fun onStreamCreated(publisherKit: PublisherKit, stream: Stream) { - Log.d("MainActivity", "onStreamCreated: Publisher Stream Created. Own stream " + stream.streamId) - } - - override fun onStreamDestroyed(publisherKit: PublisherKit, stream: Stream) { - Log.d("MainActivity", "onStreamDestroyed: Publisher Stream Destroyed. Own stream " + stream.streamId) - } - - override fun onError(publisherKit: PublisherKit, opentokError: OpentokError) { - Log.d("MainActivity", "PublisherKit onError: " + opentokError.message) - notifyFlutter(OpenTokSDKState.ERROR) - } - } - - var subscriberListener: SubscriberKit.SubscriberListener = object : SubscriberKit.SubscriberListener { - override fun onConnected(subscriberKit: SubscriberKit) { - Log.d("MainActivity", "onConnected: Subscriber connected. Stream: " + subscriberKit.stream.streamId) - } - - override fun onDisconnected(subscriberKit: SubscriberKit) { - Log.d("MainActivity", "onDisconnected: Subscriber disconnected. Stream: " + subscriberKit.stream.streamId) - notifyFlutter(OpenTokSDKState.LOGGED_OUT) - } - - override fun onError(subscriberKit: SubscriberKit, opentokError: OpentokError) { - Log.d("MainActivity", "SubscriberKit onError: " + opentokError.message) - notifyFlutter(OpenTokSDKState.ERROR) - } - } - - fun initSession(call: MethodCall, result: MethodChannel.Result) { - - val apiKey = requireNotNull(call.argument("apiKey")) - val sessionId = requireNotNull(call.argument("sessionId")) - val token = requireNotNull(call.argument("token")) - - notifyFlutter(OpenTokSDKState.WAIT) - session = Session.Builder(context, apiKey, sessionId).build() - session?.setSessionListener(sessionListener) - session?.connect(token) - result.success("") - } - - fun swapCamera(call: MethodCall, result: MethodChannel.Result) { - publisher?.cycleCamera() - result.success("") - } - - fun toggleAudio(call: MethodCall, result: MethodChannel.Result) { - val publishAudio = requireNotNull(call.argument("publishAudio")) - publisher?.publishAudio = publishAudio - result.success("") - } - - fun toggleVideo(call: MethodCall, result: MethodChannel.Result) { - val publishVideo = requireNotNull(call.argument("publishVideo")) - publisher?.publishVideo = publishVideo - result.success("") - } - - private fun notifyFlutter(state: OpenTokSDKState) { - Handler(Looper.getMainLooper()).post { - MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "OpenTok-Platform-Bridge") - .invokeMethod("updateState", state.toString()) - } - } -} +//package com.ejada.hmg.opentok +// +//import android.content.Context +//import android.os.Handler +//import android.os.Looper +//import android.util.Log +//import android.view.ViewGroup +//import com.facebook.stetho.urlconnection.StethoURLConnectionManager +//import com.opentok.android.* +//import io.flutter.embedding.engine.FlutterEngine +//import io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister +//import io.flutter.plugin.common.MethodCall +//import io.flutter.plugin.common.MethodChannel +// +// +//enum class OpenTokSDKState { +// LOGGED_OUT, +// LOGGED_IN, +// WAIT, +// ERROR +//} +// +//class OpenTok(private var context: Context, private var flutterEngine: FlutterEngine){ +// private lateinit var remoteVideoPlatformView: RemoteVideoPlatformView +// private lateinit var localVideoPlatformView: LocalVideoPlatformView +// +// init { +// remoteVideoPlatformView = RemoteVideoFactory.getViewInstance(context) +// flutterEngine +// .platformViewsController +// .registry +// .registerViewFactory("remote-video-container", RemoteVideoFactory()) +// +// localVideoPlatformView = LocalVideoFactory.getViewInstance(context) +// flutterEngine +// .platformViewsController +// .registry +// .registerViewFactory("local-video-container", LocalVideoFactory()) +// } +// +// private var session: Session? = null +// private var publisher: Publisher? = null +// private var subscriber: Subscriber? = null +// +// +// +// private val sessionListener: Session.SessionListener = object: Session.SessionListener { +// override fun onConnected(session: Session) { +// // Connected to session +// Log.d("MainActivity", "Connected to session ${session.sessionId}") +// +// publisher = Publisher.Builder(context).build().apply { +// setPublisherListener(publisherListener) +// renderer?.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL) +// +// view.layoutParams = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) +// localVideoPlatformView.container.addView(view) +// } +// +// notifyFlutter(OpenTokSDKState.LOGGED_IN) +// session.publish(publisher) +// } +// +// override fun onDisconnected(session: Session) { +// notifyFlutter(OpenTokSDKState.LOGGED_OUT) +// } +// +// override fun onStreamReceived(session: Session, stream: Stream) { +// Log.d( +// "MainActivity", +// "onStreamReceived: New Stream Received " + stream.streamId + " in session: " + session.sessionId +// ) +// if (subscriber == null) { +// subscriber = Subscriber.Builder(context, stream).build().apply { +// renderer?.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL) +// setSubscriberListener(subscriberListener) +// session.subscribe(this) +// +// remoteVideoPlatformView.container.addView(view) +// } +// } +// } +// +// override fun onStreamDropped(session: Session, stream: Stream) { +// Log.d( +// "MainActivity", +// "onStreamDropped: Stream Dropped: " + stream.streamId + " in session: " + session.sessionId +// ) +// +// if (subscriber != null) { +// subscriber = null +// +// remoteVideoPlatformView.container.removeAllViews() +// } +// } +// +// override fun onError(session: Session, opentokError: OpentokError) { +// Log.d("MainActivity", "Session error: " + opentokError.message) +// notifyFlutter(OpenTokSDKState.ERROR) +// } +// } +// +// private val publisherListener: PublisherKit.PublisherListener = object : PublisherKit.PublisherListener { +// override fun onStreamCreated(publisherKit: PublisherKit, stream: Stream) { +// Log.d("MainActivity", "onStreamCreated: Publisher Stream Created. Own stream " + stream.streamId) +// } +// +// override fun onStreamDestroyed(publisherKit: PublisherKit, stream: Stream) { +// Log.d("MainActivity", "onStreamDestroyed: Publisher Stream Destroyed. Own stream " + stream.streamId) +// } +// +// override fun onError(publisherKit: PublisherKit, opentokError: OpentokError) { +// Log.d("MainActivity", "PublisherKit onError: " + opentokError.message) +// notifyFlutter(OpenTokSDKState.ERROR) +// } +// } +// +// var subscriberListener: SubscriberKit.SubscriberListener = object : SubscriberKit.SubscriberListener { +// override fun onConnected(subscriberKit: SubscriberKit) { +// Log.d("MainActivity", "onConnected: Subscriber connected. Stream: " + subscriberKit.stream.streamId) +// } +// +// override fun onDisconnected(subscriberKit: SubscriberKit) { +// Log.d("MainActivity", "onDisconnected: Subscriber disconnected. Stream: " + subscriberKit.stream.streamId) +// notifyFlutter(OpenTokSDKState.LOGGED_OUT) +// } +// +// override fun onError(subscriberKit: SubscriberKit, opentokError: OpentokError) { +// Log.d("MainActivity", "SubscriberKit onError: " + opentokError.message) +// notifyFlutter(OpenTokSDKState.ERROR) +// } +// } +// +// fun initSession(call: MethodCall, result: MethodChannel.Result) { +// +// val apiKey = requireNotNull(call.argument("apiKey")) +// val sessionId = requireNotNull(call.argument("sessionId")) +// val token = requireNotNull(call.argument("token")) +// +// notifyFlutter(OpenTokSDKState.WAIT) +// session = Session.Builder(context, apiKey, sessionId).build() +// session?.setSessionListener(sessionListener) +// session?.connect(token) +// result.success("") +// } +// +// fun swapCamera(call: MethodCall, result: MethodChannel.Result) { +// publisher?.cycleCamera() +// result.success("") +// } +// +// fun toggleAudio(call: MethodCall, result: MethodChannel.Result) { +// val publishAudio = requireNotNull(call.argument("publishAudio")) +// publisher?.publishAudio = publishAudio +// result.success("") +// } +// +// fun toggleVideo(call: MethodCall, result: MethodChannel.Result) { +// val publishVideo = requireNotNull(call.argument("publishVideo")) +// publisher?.publishVideo = publishVideo +// result.success("") +// } +// +// private fun notifyFlutter(state: OpenTokSDKState) { +// Handler(Looper.getMainLooper()).post { +// MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "OpenTok-Platform-Bridge") +// .invokeMethod("updateState", state.toString()) +// } +// } +//} diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/RemoteVideo.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/RemoteVideo.kt index 9116a1e8..8c822839 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/RemoteVideo.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/opentok/RemoteVideo.kt @@ -1,58 +1,58 @@ -package com.ejada.hmg.opentok - -import android.content.Context -import android.util.AttributeSet -import android.view.LayoutInflater -import android.view.View -import android.widget.FrameLayout -import android.widget.LinearLayout -import com.ejada.hmg.R -import io.flutter.plugin.common.StandardMessageCodec -import io.flutter.plugin.platform.PlatformView -import io.flutter.plugin.platform.PlatformViewFactory - -class RemoteVideoFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) { - - companion object { - private lateinit var view: RemoteVideoPlatformView - - fun getViewInstance(context: Context): RemoteVideoPlatformView { - if(!this::view.isInitialized) { - view = RemoteVideoPlatformView(context) - } - - return view - } - } - - override fun create(context: Context, viewId: Int, args: Any?): PlatformView { - return getViewInstance(context) - } -} - -class RemoteVideoPlatformView(context: Context) : PlatformView { - private val videoContainer: RemoteVideoContainer = RemoteVideoContainer(context) - - val container get() = videoContainer.subscriberContainer - - override fun getView(): View { - return videoContainer - } - - override fun dispose() {} -} - -class RemoteVideoContainer @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyle: Int = 0, - defStyleRes: Int = 0 -) : LinearLayout(context, attrs, defStyle, defStyleRes) { - - var subscriberContainer: FrameLayout private set - - init { - val view = LayoutInflater.from(context).inflate(R.layout.remote_video, this, true) - subscriberContainer = view.findViewById(R.id.subscriber_container) - } -} \ No newline at end of file +//package com.ejada.hmg.opentok +// +//import android.content.Context +//import android.util.AttributeSet +//import android.view.LayoutInflater +//import android.view.View +//import android.widget.FrameLayout +//import android.widget.LinearLayout +//import com.ejada.hmg.R +//import io.flutter.plugin.common.StandardMessageCodec +//import io.flutter.plugin.platform.PlatformView +//import io.flutter.plugin.platform.PlatformViewFactory +// +//class RemoteVideoFactory : PlatformViewFactory(StandardMessageCodec.INSTANCE) { +// +// companion object { +// private lateinit var view: RemoteVideoPlatformView +// +// fun getViewInstance(context: Context): RemoteVideoPlatformView { +// if(!this::view.isInitialized) { +// view = RemoteVideoPlatformView(context) +// } +// +// return view +// } +// } +// +// override fun create(context: Context, viewId: Int, args: Any?): PlatformView { +// return getViewInstance(context) +// } +//} +// +//class RemoteVideoPlatformView(context: Context) : PlatformView { +// private val videoContainer: RemoteVideoContainer = RemoteVideoContainer(context) +// +// val container get() = videoContainer.subscriberContainer +// +// override fun getView(): View { +// return videoContainer +// } +// +// override fun dispose() {} +//} +// +//class RemoteVideoContainer @JvmOverloads constructor( +// context: Context, +// attrs: AttributeSet? = null, +// defStyle: Int = 0, +// defStyleRes: Int = 0 +//) : LinearLayout(context, attrs, defStyle, defStyleRes) { +// +// var subscriberContainer: FrameLayout private set +// +// init { +// val view = LayoutInflater.from(context).inflate(R.layout.remote_video, this, true) +// subscriberContainer = view.findViewById(R.id.subscriber_container) +// } +//} \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/OpenTokPlatformBridge.kt b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/OpenTokPlatformBridge.kt index 6ac62546..33d9ff0a 100644 --- a/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/OpenTokPlatformBridge.kt +++ b/android/app/src/main/kotlin/com/cloud/diplomaticquarterapp/utils/OpenTokPlatformBridge.kt @@ -1,42 +1,42 @@ -package com.ejada.hmg.utils - -import com.ejada.hmg.MainActivity -import com.ejada.hmg.opentok.OpenTok -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.plugin.common.MethodCall -import io.flutter.plugin.common.MethodChannel - -class OpenTokPlatformBridge(private var flutterEngine: FlutterEngine, private var mainActivity: MainActivity) { - - private lateinit var channel: MethodChannel - private lateinit var openTok: OpenTok - - companion object { - private const val CHANNEL = "OpenTok-Platform-Bridge" - } - - fun create(){ - openTok = OpenTok(mainActivity, flutterEngine) - channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL) - channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result -> - when (call.method) { - "initSession" -> { - openTok.initSession(call, result) - } - "swapCamera" -> { - openTok.swapCamera(call, result) - } - "toggleAudio" -> { - openTok.toggleAudio(call, result) - } - "toggleVideo" -> { - openTok.toggleVideo(call, result) - } - else -> { - result.notImplemented() - } - } - } - } - -} +//package com.ejada.hmg.utils +// +//import com.ejada.hmg.MainActivity +//import com.ejada.hmg.opentok.OpenTok +//import io.flutter.embedding.engine.FlutterEngine +//import io.flutter.plugin.common.MethodCall +//import io.flutter.plugin.common.MethodChannel +// +//class OpenTokPlatformBridge(private var flutterEngine: FlutterEngine, private var mainActivity: MainActivity) { +// +// private lateinit var channel: MethodChannel +// private lateinit var openTok: OpenTok +// +// companion object { +// private const val CHANNEL = "OpenTok-Platform-Bridge" +// } +// +// fun create(){ +// openTok = OpenTok(mainActivity, flutterEngine) +// channel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL) +// channel.setMethodCallHandler { call: MethodCall, result: MethodChannel.Result -> +// when (call.method) { +// "initSession" -> { +// openTok.initSession(call, result) +// } +// "swapCamera" -> { +// openTok.swapCamera(call, result) +// } +// "toggleAudio" -> { +// openTok.toggleAudio(call, result) +// } +// "toggleVideo" -> { +// openTok.toggleVideo(call, result) +// } +// else -> { +// result.notImplemented() +// } +// } +// } +// } +// +//} diff --git a/android/build.gradle b/android/build.gradle index e4985a55..b514b78d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -44,3 +44,9 @@ subprojects { task clean(type: Delete) { delete rootProject.buildDir } + +configurations.all { + resolutionStrategy { + force 'androidx.core:core-ktx:1.6.0' + } +} diff --git a/ios/Podfile b/ios/Podfile index 1e8c3c90..10f3c9b4 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +platform :ios, '13.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements index be2e0283..38553e31 100644 --- a/ios/Runner/Runner.entitlements +++ b/ios/Runner/Runner.entitlements @@ -2,13 +2,20 @@ - - aps-environment development + com.apple.developer.healthkit + + com.apple.developer.healthkit.access + com.apple.developer.networking.HotspotConfiguration com.apple.developer.networking.wifi-info + com.apple.developer.nfc.readersession.formats + + NDEF + TAG + diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 3d759ce6..dc3a5813 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -468,12 +468,12 @@ class AuthProvider with ChangeNotifier { Future getDashboard() async { Map request = {}; - request['VersionID'] = VERSION_ID; - request['Channel'] = CHANNEL; - request['IPAdress'] = IP_ADDRESS; - request['generalid'] = GENERAL_ID; - request['LanguageID'] = LANGUAGE_ID; - request['DeviceTypeID'] = DeviceTypeID; + // request['VersionID'] = VERSION_ID; + // request['Channel'] = CHANNEL; + // request['IPAdress'] = IP_ADDRESS; + // request['generalid'] = GENERAL_ID; + // request['LanguageID'] = LANGUAGE_ID; + // request['DeviceTypeID'] = DeviceTypeID; dynamic localRes; try { diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index cc151c7b..2ca4ee8a 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -40,11 +40,9 @@ class FamilyFilesProvider with ChangeNotifier { dynamic localRes; try { var request = GetAllSharedRecordsByStatusReq(); - var result = await sharedPref.getObject(MAIN_USER); - request.status = 0; - - request.patientID = result["PatientID"]; - + // var result = await sharedPref.getObject(MAIN_USER); + // request.status = 0; + // request.patientID = result["PatientID"]; await new BaseAppClient().post(GET_SHARED_RECORD_BY_STATUS, onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { diff --git a/lib/uitl/app_shared_preferences.dart b/lib/uitl/app_shared_preferences.dart index 726aa543..517bfee7 100644 --- a/lib/uitl/app_shared_preferences.dart +++ b/lib/uitl/app_shared_preferences.dart @@ -49,19 +49,21 @@ class AppSharedPreferences { setObject(String key, value) async { if (value != null) { final SharedPreferences prefs = await _prefs; - return prefs.setString(key, json.encode(value)); + return await prefs.setString(key, json.encode(value)); } } /// Get String [key] the key was saved getString(String key) async { final SharedPreferences prefs = await _prefs; + await prefs.reload(); return prefs.getString(key); } /// Get String [key] the key was saved getStringWithDefaultValue(String key, String defaultVal) async { final SharedPreferences prefs = await _prefs; + await prefs.reload(); String value = prefs.getString(key); return value == null ? defaultVal : value; } @@ -69,35 +71,45 @@ class AppSharedPreferences { /// Get List of String [key] the key was saved getStringList(String key) async { final SharedPreferences prefs = await _prefs; + await prefs.reload(); return prefs.getStringList(key); } /// Get Double [key] the key was saved getDouble(String key) async { final SharedPreferences prefs = await _prefs; + await prefs.reload(); return prefs.getDouble(key); } /// Get Bool [key] the key was saved getBool(String key) async { final SharedPreferences prefs = await _prefs; + await prefs.reload(); return prefs.getBool(key); } /// Get Int [key] the key was saved getInt(String key) async { final SharedPreferences prefs = await _prefs; + await prefs.reload(); return prefs.getInt(key); } /// Get Object [key] the key was saved Future getObject(String key) async { - final SharedPreferences prefs = await _prefs; - var string = prefs.getString(key); - if (string == null) { - return null; + try { + final SharedPreferences prefs = await _prefs; + await prefs.reload(); + var string = prefs.getString(key); + if (string == null) { + return null; + } + return json.decode(string); + } catch (ex) { + print(ex); + print(ex.toString()); } - return json.decode(string); } /// clear all saved values in shared preferences diff --git a/pubspec.yaml b/pubspec.yaml index a7996dc8..2a581ac5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -52,7 +52,7 @@ dependencies: localstorage: ^4.0.0+1 maps_launcher: ^2.0.1 url_launcher: ^6.0.15 - shared_preferences: ^2.0.9 + shared_preferences: ^2.0.0 # flutter_flexible_toast: ^0.1.4 fluttertoast: ^8.0.8 firebase_messaging: ^11.1.0 @@ -198,6 +198,7 @@ dependency_overrides: provider : ^5.0.0 permission_handler : ^6.0.1+1 + dev_dependencies: flutter_test: sdk: flutter From c2b0326676d97759f8d8c9bf346f7bdaedbb2ed3 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 15 Dec 2021 14:35:44 +0300 Subject: [PATCH 39/39] Updates & fixes --- .../parmacyModule/order-preview-service.dart | 4 +- .../pharmacyModule/OrderPreviewViewModel.dart | 4 +- .../fragments/home_page_fragment2.dart | 286 ++++++++-------- .../screens/cart-page/cart-order-preview.dart | 304 +++++++++--------- .../cart-page/payment_bottom_widget.dart | 5 +- .../medical/LabResult/LabResultWidget.dart | 2 +- lib/widgets/in_app_browser/InAppBrowser.dart | 5 +- 7 files changed, 308 insertions(+), 302 deletions(-) diff --git a/lib/core/service/parmacyModule/order-preview-service.dart b/lib/core/service/parmacyModule/order-preview-service.dart index b9368180..17dfaf99 100644 --- a/lib/core/service/parmacyModule/order-preview-service.dart +++ b/lib/core/service/parmacyModule/order-preview-service.dart @@ -176,7 +176,7 @@ class OrderPreviewService extends BaseService { } } - Future makeOrder(PaymentCheckoutData paymentCheckoutData, List shoppingCarts) async { + Future makeOrder(PaymentCheckoutData paymentCheckoutData, List shoppingCarts, bool isLakumEnabled) async { paymentCheckoutData.address.isChecked = true; hasError = false; super.error = ""; @@ -201,7 +201,7 @@ class OrderPreviewService extends BaseService { orderBody['custom_values_xml'] = "PaymentOption:${getPaymentOptionName(paymentCheckoutData.paymentOption)}"; orderBody['shippingOption'] = paymentCheckoutData.shippingOption; orderBody['shipping_address'] = paymentCheckoutData.address; - // orderBody['lakum_amount'] = paymentCheckoutData.usedLakumPoints; + orderBody['lakum_amount'] = isLakumEnabled ? paymentCheckoutData.usedLakumPoints : 0; List> itemsList = List(); shoppingCarts.forEach((item) { diff --git a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart index 12623290..eb074e59 100644 --- a/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart +++ b/lib/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart @@ -209,11 +209,11 @@ class OrderPreviewViewModel extends BaseViewModel { }); } - Future makeOrder() async { + Future makeOrder(bool isLakumEnabled) async { setState(ViewState.Busy); await pharmacyModuleViewModel.generatePharmacyToken(); - await _orderService.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts); + await _orderService.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts, isLakumEnabled); if (_orderService.hasError) { error = _orderService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index 75b9a473..8fa20eaa 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -1,6 +1,7 @@ +import 'dart:math' as math; + import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/service/packages_offers/PackagesOffersServices.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; @@ -9,24 +10,19 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/models/gradient_color.dart'; import 'package:diplomaticquarterapp/models/hmg_services.dart'; import 'package:diplomaticquarterapp/models/slider_data.dart'; -import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page2.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/logged_slider_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/services_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/slider_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/pages/conference/web_rtc/call_home_page.dart'; -import 'dart:math' as math; class HomePageFragment2 extends StatefulWidget { DashboardViewModel model; @@ -284,150 +280,166 @@ class _HomePageFragment2State extends State { child: InkWell( onTap: () { AuthenticatedUser user = projectViewModel.user; - Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage(user))); + if (projectViewModel.havePrivilege(82)) Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage(user))); }, - child: Container( - width: double.infinity, - height: double.infinity, - clipBehavior: Clip.antiAlias, - decoration: containerRadiusWithGradientServices(20, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.lightGreyColor), - child: Stack( - children: [ - Container( - width: double.infinity, - height: double.infinity, - // color: Color(0xFF2B353E), - decoration: containerRadius(Color(0xFF2B353E), 20), - ), - Container( - width: double.infinity, - height: double.infinity, - clipBehavior: Clip.antiAlias, - decoration: projectViewModel.isArabic - ? containerBottomRightRadiusWithGradientForAr(60, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.lightGreyColor) - : containerBottomRightRadiusWithGradient(60, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.lightGreyColor), - child: Stack( - children: [ - SvgPicture.asset( - "assets/images/new/strips.svg", - width: double.infinity, - height: double.infinity, - fit: BoxFit.cover, - ), - ], - ), - ), - projectViewModel.isArabic - ? Positioned( - left: 20, - top: 12, - child: Opacity( - opacity: 0.04, - child: SvgPicture.asset( - "assets/images/new/logo.svg", - height: MediaQuery.of(context).size.width * 0.14, - ), - ), - ) - : Positioned( - right: 20, - top: 12, - child: Opacity( - opacity: 0.04, - child: SvgPicture.asset( - "assets/images/new/logo.svg", - height: MediaQuery.of(context).size.width * 0.14, + child: Stack( + children: [ + Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: containerRadiusWithGradientServices(20, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.lightGreyColor), + child: Stack( + children: [ + Container( + width: double.infinity, + height: double.infinity, + // color: Color(0xFF2B353E), + decoration: containerRadius(Color(0xFF2B353E), 20), + ), + Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: projectViewModel.isArabic + ? containerBottomRightRadiusWithGradientForAr(60, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.lightGreyColor) + : containerBottomRightRadiusWithGradient(60, lightColor: CustomColors.lightGreyColor, darkColor: CustomColors.lightGreyColor), + child: Stack( + children: [ + SvgPicture.asset( + "assets/images/new/strips.svg", + width: double.infinity, + height: double.infinity, + fit: BoxFit.cover, ), - ), + ], ), - projectViewModel.isArabic - ? Positioned( - right: -16, - top: 2, - child: Transform.rotate( - angle: math.pi / 4, - child: Container( - padding: EdgeInsets.only(left: 18, right: 18, top: 6, bottom: 3), - color: CustomColors.accentColor, - child: Text( - TranslationBase.of(context).newDes, - style: TextStyle( - color: Colors.white, - fontSize: 9, - height: 0.8, - letterSpacing: -0.27, + ), + projectViewModel.isArabic + ? Positioned( + left: 20, + top: 12, + child: Opacity( + opacity: 0.04, + child: SvgPicture.asset( + "assets/images/new/logo.svg", + height: MediaQuery.of(context).size.width * 0.14, + ), + ), + ) + : Positioned( + right: 20, + top: 12, + child: Opacity( + opacity: 0.04, + child: SvgPicture.asset( + "assets/images/new/logo.svg", + height: MediaQuery.of(context).size.width * 0.14, ), ), ), - ), - ) - : Positioned( - left: -16, - top: 2, - child: Transform.rotate( - angle: -math.pi / 4, - child: Container( - padding: EdgeInsets.only(left: 18, right: 18, top: 6, bottom: 3), - color: CustomColors.accentColor, - child: Text( - TranslationBase.of(context).newDes, - style: TextStyle( - color: Colors.white, - fontSize: 9, - letterSpacing: -0.27, - height: 1.2, + projectViewModel.isArabic + ? Positioned( + right: -16, + top: 2, + child: Transform.rotate( + angle: math.pi / 4, + child: Container( + padding: EdgeInsets.only(left: 18, right: 18, top: 6, bottom: 3), + color: CustomColors.accentColor, + child: Text( + TranslationBase.of(context).newDes, + style: TextStyle( + color: Colors.white, + fontSize: 9, + height: 0.8, + letterSpacing: -0.27, + ), + ), + ), + ), + ) + : Positioned( + left: -16, + top: 2, + child: Transform.rotate( + angle: -math.pi / 4, + child: Container( + padding: EdgeInsets.only(left: 18, right: 18, top: 6, bottom: 3), + color: CustomColors.accentColor, + child: Text( + TranslationBase.of(context).newDes, + style: TextStyle( + color: Colors.white, + fontSize: 9, + letterSpacing: -0.27, + height: 1.2, + ), + ), ), ), ), - ), - ), - Container( - width: double.infinity, - height: double.infinity, - padding: EdgeInsets.only(left: projectViewModel.isArabic ? 20 : 25, right: projectViewModel.isArabic ? 25 : 20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - mFlex(3), - AutoSizeText( - TranslationBase.of(context).offersdiscount, - maxLines: 1, - style: TextStyle( - color: Colors.black, - fontSize: 14, - fontWeight: FontWeight.bold, - letterSpacing: -0.75, - height: 1, - ), - ), - projectViewModel.isArabic ? mHeight(4) : Container(), - Text( - TranslationBase.of(context).explore, - style: TextStyle( - color: Colors.black, - fontSize: 9, - fontWeight: FontWeight.w600, - letterSpacing: -0.27, - height: projectViewModel.isArabic ? 0.8 : 1, - ), - ), - mFlex(1), - Row( + Container( + width: double.infinity, + height: double.infinity, + padding: EdgeInsets.only(left: projectViewModel.isArabic ? 20 : 25, right: projectViewModel.isArabic ? 25 : 20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ - showFloating("assets/images/new/ear.svg"), - mWidth(4), - showFloating("assets/images/new/head.svg"), - mWidth(4), - showFloating("assets/images/new/tooth.svg"), + mFlex(3), + AutoSizeText( + TranslationBase.of(context).offersdiscount, + maxLines: 1, + style: TextStyle( + color: Colors.black, + fontSize: 14, + fontWeight: FontWeight.bold, + letterSpacing: -0.75, + height: 1, + ), + ), + projectViewModel.isArabic ? mHeight(4) : Container(), + Text( + TranslationBase.of(context).explore, + style: TextStyle( + color: Colors.black, + fontSize: 9, + fontWeight: FontWeight.w600, + letterSpacing: -0.27, + height: projectViewModel.isArabic ? 0.8 : 1, + ), + ), + mFlex(1), + Row( + children: [ + showFloating("assets/images/new/ear.svg"), + mWidth(4), + showFloating("assets/images/new/head.svg"), + mWidth(4), + showFloating("assets/images/new/tooth.svg"), + ], + ), + mFlex(2) ], ), - mFlex(2) - ], - ), + ), + ], ), - ], - ), + ), + projectViewModel.havePrivilege(82) + ? Container() + : Container( + width: double.infinity, + height: double.infinity, + clipBehavior: Clip.antiAlias, + decoration: containerRadiusWithGradientServices(20, lightColor: CustomColors.lightGreyColor.withOpacity(0.7), darkColor: CustomColors.lightGreyColor.withOpacity(0.7)), + child: Icon( + Icons.lock_outline, + size: 40, + ), + ) + ], ), ), ); diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart index dc8dc0d7..48dbcbad 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-preview.dart @@ -2,6 +2,7 @@ import 'dart:ui'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_address_widget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/select_payment_option_widget.dart'; @@ -14,17 +15,12 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'lakum_widget.dart'; - class OrderPreviewPage extends StatefulWidget { final List addresses; final OrderPreviewViewModel model; - - OrderPreviewPage({this.addresses, this.model}); - @override _OrderPreviewPageState createState() => _OrderPreviewPageState(); } @@ -34,9 +30,6 @@ class _OrderPreviewPageState extends State { bool isLoading = true; bool isChecked = false; - - - @override void initState() { super.initState(); @@ -50,12 +43,11 @@ class _OrderPreviewPageState extends State { }); } - @override Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); final height = mediaQuery.size.height - 60 - mediaQuery.padding.top; - // OrderPreviewViewModel widget.model = Provider.of(context); + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: "${TranslationBase.of(context).checkOut}", isShowAppBar: true, @@ -73,108 +65,108 @@ class _OrderPreviewPageState extends State { color: Color(0xFFF1F1F1), child: Column( children: [ - SelectAddressWidget(widget.model, widget.addresses, changeMainState, isUpdating: true,), + SelectAddressWidget( + widget.model, + widget.addresses, + changeMainState, + isUpdating: true, + ), SizedBox( height: 10, ), - SelectPaymentOptionWidget(widget.model, changeMainState,isUpdating: true,), + SelectPaymentOptionWidget( + widget.model, + changeMainState, + isUpdating: true, + ), SizedBox( height: 10, ), widget.model.paymentCheckoutData.lacumInformation != null - ? AbsorbPointer( - absorbing: true, - child: Stack( + ? Stack( children: [ Container( - child: Column( - children: [ - // LakumWidget(widget.model), - Container( - color: Colors.white, - padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), - child: Row( - children: [ - Row( - children: [ - SizedBox( - height: 24.0, - width: 24.0, - child: Checkbox( - activeColor: CustomColors.green, - value: isChecked, - onChanged: (bool value) { - setState(() { - isChecked = value; - print(isChecked); - if (value){ - // isChecked; + child: Column( + children: [ + Container( + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 12, horizontal: 12), + child: Row( + children: [ + Row( + children: [ + SizedBox( + height: 24.0, + width: 24.0, + child: Checkbox( + activeColor: CustomColors.green, + value: isChecked, + onChanged: (bool value) { + setState(() { + isChecked = value; + if (value) { PaymentBottomWidget.isChecked = true; - print(value); - }else{ + } else { PaymentBottomWidget.isChecked = false; } - setState(() { - }); - }); - }, - ), + setState(() {}); + }); + }, ), - Padding( - padding: const EdgeInsets.only(left: 8.0, right: 8.0), - child: Text( - TranslationBase.of(context).useLakumPoints + - " (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})", - style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)), - ), - ], - ), - Expanded( - child: Container( - decoration: BoxDecoration(color: Color(0x99ffffff)), - padding: const EdgeInsets.symmetric(horizontal: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - decoration: BoxDecoration(color: Color(0x99ffffff)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts( - "${TranslationBase.of(context).availableBalance}", - fontSize: 12, - fontWeight: FontWeight.bold, - ), - Text( - "${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}", - style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56) - ), - ], - ), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + TranslationBase.of(context).useLakumPoints + + " (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)), + ), + ], + ), + Expanded( + child: Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + decoration: BoxDecoration(color: Color(0x99ffffff)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + "${TranslationBase.of(context).availableBalance}", + fontSize: 12, + fontWeight: FontWeight.bold, + ), + Text( + "${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}", + style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)), + ], ), - ], - ), - + ), + ], ), ), - - ], - ), - ), - SizedBox( - height: 10, + ), + ], ), - ], - ), + ), + SizedBox( + height: 10, + ), + ], ), - Container( - height: MediaQuery.of(context).size.height * .10, - color: Colors.white.withOpacity(0.6), - ) + ), + projectViewModel.havePrivilege(83) + ? Container() + : Container( + height: MediaQuery.of(context).size.height * .10, + color: Colors.white.withOpacity(0.6), + ) ], - ), - ) + ) : Container(), Container( color: Colors.white, @@ -284,65 +276,70 @@ class _OrderPreviewPageState extends State { indent: 0, endIndent: 0, ), - isChecked ? - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - "${TranslationBase.of(context).lakum}", - fontSize: 14, - color: Colors.green, - fontWeight: FontWeight.w500, - ), - Texts( - "- ${TranslationBase.of(context).sar} ${(widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.green, - fontWeight: FontWeight.w500, - ), - ], - ) : Container(), - isChecked ? const Divider( - color: Color(0xFFD6D6D6), - height: 20, - thickness: 1, - indent: 0, - endIndent: 0, - ): Container(), - isChecked ? Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).total, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Texts( - " ${TranslationBase.of(context).sar}""${(widget.model.cartResponse.totalAmount - widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - ], - ) - : Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts( - TranslationBase.of(context).total, - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Texts( - " ${TranslationBase.of(context).sar} ${(widget.model.cartResponse.totalAmount).toStringAsFixed(2)}", - fontSize: 14, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - ], - ), + isChecked + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + "${TranslationBase.of(context).lakum}", + fontSize: 14, + color: Colors.green, + fontWeight: FontWeight.w500, + ), + Texts( + "- ${TranslationBase.of(context).sar} ${(widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.green, + fontWeight: FontWeight.w500, + ), + ], + ) + : Container(), + isChecked + ? const Divider( + color: Color(0xFFD6D6D6), + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ) + : Container(), + isChecked + ? Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + " ${TranslationBase.of(context).sar}" + "${(widget.model.cartResponse.totalAmount - widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ) + : Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + TranslationBase.of(context).total, + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Texts( + " ${TranslationBase.of(context).sar} ${(widget.model.cartResponse.totalAmount).toStringAsFixed(2)}", + fontSize: 14, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ], + ), SizedBox( height: 10, ), @@ -364,12 +361,9 @@ class _OrderPreviewPageState extends State { child: PaymentBottomWidget(widget.model), ), ); - } changeMainState() { setState(() {}); } - - } diff --git a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart index 00595711..61248543 100644 --- a/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; @@ -25,7 +26,7 @@ class PaymentBottomWidget extends StatelessWidget { @override Widget build(BuildContext context) { - final scaffold = Scaffold.of(context); + ProjectViewModel projectViewModel = Provider.of(context); this.context = context; OrderPreviewViewModel orderPreviewViewModel = Provider.of(context); return Container( @@ -88,7 +89,7 @@ class PaymentBottomWidget extends StatelessWidget { onPressed: (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null) ? () async { GifLoaderDialogUtils.showMyDialog(context); - await model.makeOrder(); + await model.makeOrder(projectViewModel.havePrivilege(83)); if (model.state == ViewState.Idle) { AppToast.showSuccessToast(message: TranslationBase.of(context).compeleteOrderMsg); GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart index f396a2f4..427b16e1 100644 --- a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart +++ b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart @@ -183,7 +183,7 @@ class LabResultWidget extends StatelessWidget { children: [ Padding( padding: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 12, right: projectViewModel.isArabic ? 12 : 0), - child: Utils.tableColumnValue(labResultList[i].description, isLast: true), + child: Utils.tableColumnValue(labResultList[i].description ?? "", isLast: true), ), Utils.tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: true), Utils.tableColumnValue(labResultList[i].referanceRange, isLast: true, isCapitable: false), diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 9e363e4d..82af9e49 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -28,12 +28,11 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE paymentType; - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE - //static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT + // static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort PreAuth Payment Gateway URL UAT static String PREAUTH_SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort PreAuth Payment Gateway URL Live Store @@ -77,7 +76,7 @@ class MyInAppBrowser extends InAppBrowser { @override Future onLoadStart(Uri url) async { - if (onLoadStartCallback != null) onLoadStartCallback(url); + if (onLoadStartCallback != null) onLoadStartCallback(url.toString()); } @override