merge-update-with-lab-changes
devamirsaleemahmad 2 years ago
parent d8836d5e89
commit 47801ecb36

@ -26,7 +26,7 @@ class TestPageState extends State<TestPage>{
} }
void location(){ void location(){
LocationUtils().getCurrentLocation(callBack: (latLng){ LocationUtils(context: context,isShowConfirmDialog: false).getCurrentLocation(callBack: (latLng){
print(latLng.toString()); print(latLng.toString());
}); });
} }

@ -17,8 +17,8 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
@ -26,7 +26,7 @@ import 'base/base_view.dart';
dynamic languageID; dynamic languageID;
class FinalProductsPage extends StatefulWidget { class FinalProductsPage extends StatefulWidget {
final String id; final String? id;
final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>(); AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
@ -37,7 +37,7 @@ class FinalProductsPage extends StatefulWidget {
} }
class _FinalProductsPageState extends State<FinalProductsPage> { class _FinalProductsPageState extends State<FinalProductsPage> {
String id; String? id;
_FinalProductsPageState({this.id}); _FinalProductsPageState({this.id});
@ -70,7 +70,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
model.getFinalProducts(i: id); model.getFinalProducts(i: id);
appBarTitle = TranslationBase.of(context).products; appBarTitle = TranslationBase.of(context).products;
} else if (widget.productType == 2) { } else if (widget.productType == 2) {
model.getManufacturerProducts(id); model.getManufacturerProducts(id!);
} else if (widget.productType == 3) { } else if (widget.productType == 3) {
model.getLastVisitedProducts(); model.getLastVisitedProducts();
appBarTitle = TranslationBase.of(context).recentlyViewed; appBarTitle = TranslationBase.of(context).recentlyViewed;
@ -86,7 +86,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
} }
}, },
allowAny: true, allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget? child) => AppScaffold(
isPharmacy: true, isPharmacy: true,
appBarTitle: appBarTitle, appBarTitle: appBarTitle,
isBottomBar: true, isBottomBar: true,
@ -217,9 +217,9 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
margin: EdgeInsets.fromLTRB(0, 16, 0, 0), margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
alignment: Alignment.center, alignment: Alignment.center,
child: (model.finalProducts[index].images != null && child: (model.finalProducts[index].images != null &&
model.finalProducts[index].images.length > 0) model.finalProducts[index].images!.length > 0)
? Image.network( ? Image.network(
model.finalProducts[index].images[0].src, model.finalProducts[index].images![0].src!,
fit: BoxFit.cover, fit: BoxFit.cover,
height: 80, height: 80,
width: 80, width: 80,
@ -305,16 +305,30 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
// ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble() // ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble()
// : 0, // : 0,
// forceStars: true), // forceStars: true),
RatingBar.readOnly(
initialRating: model.finalProducts[index].approvedRatingSum.toDouble(), RatingBar(
size: 15.0, initialRating: model.finalProducts[index].approvedRatingSum!.toDouble(),
filledColor: Colors.yellow[700], ratingWidget: RatingWidget(
emptyColor: Colors.grey[500], full: Icon(
isHalfAllowed: true, Icons.star,
halfFilledIcon: Icons.star_half, color: Colors.yellow[700],
filledIcon: Icons.star, ),
emptyIcon: Icons.star, half: Icon(
Icons.star_half,
color: Colors.yellow[700],
),
empty: Icon(
Icons.star_border,
color: Colors.grey[500],
),
), ),
onRatingUpdate: (double value) {},
unratedColor: Colors.grey[500],
updateOnDrag: false,
tapOnlyMode: false,
),
Texts( Texts(
"(${model.finalProducts[index].approvedTotalReviews})", "(${model.finalProducts[index].approvedTotalReviews})",
regular: true, regular: true,
@ -394,9 +408,9 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
margin: EdgeInsets.fromLTRB(0, 0, 0, 8), margin: EdgeInsets.fromLTRB(0, 0, 0, 8),
alignment: Alignment.center, alignment: Alignment.center,
child:(model.finalProducts[index].images != null && child:(model.finalProducts[index].images != null &&
model.finalProducts[index].images.length > 0) model.finalProducts[index].images!.length > 0)
? Image.network( ? Image.network(
model.finalProducts[index].images[0].src, model.finalProducts[index].images![0].src!,
fit: BoxFit.cover, fit: BoxFit.cover,
height: 80, height: 80,
width: 80, width: 80,
@ -489,16 +503,30 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
// ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble() // ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble()
// : 0, // : 0,
// forceStars: true), // forceStars: true),
RatingBar.readOnly( RatingBar(
initialRating: model.finalProducts[index].approvedRatingSum.toDouble(), initialRating: model.finalProducts[index].approvedRatingSum!.toDouble(),
size: 15.0, ratingWidget: RatingWidget(
filledColor: Colors.yellow[700], full: Icon(
emptyColor: Colors.grey[500], Icons.star,
isHalfAllowed: true, color: Colors.yellow[700],
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
), ),
half: Icon(
Icons.star_half,
color: Colors.yellow[700],
),
empty: Icon(
Icons.star_border,
color: Colors.grey[500],
),
),
onRatingUpdate: (double value) {},
unratedColor: Colors.grey[500],
updateOnDrag: false,
tapOnlyMode: false,
),
Texts( Texts(
"(${model.finalProducts[index].approvedTotalReviews})", "(${model.finalProducts[index].approvedTotalReviews})",
regular: true, regular: true,

@ -18,9 +18,9 @@ import '../../config/config.dart';
class IncomingCall extends StatefulWidget { class IncomingCall extends StatefulWidget {
IncomingCallData incomingCallData; IncomingCallData? incomingCallData;
IncomingCall({required this.incomingCallData}); IncomingCall({ this.incomingCallData});
@override @override
_IncomingCallState createState() => _IncomingCallState(); _IncomingCallState createState() => _IncomingCallState();

@ -6,8 +6,8 @@ import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
@ -32,9 +32,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
ProjectViewModel projectProvider = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context);
return BaseView<OffersCategoriseViewModel>( return BaseView<OffersCategoriseViewModel>(
onModelReady: (model) => model.getOffersCategorise(), onModelReady: (model) => model.getOffersCategorise(),
builder: (BuildContext context, OffersCategoriseViewModel model, builder: (BuildContext context, OffersCategoriseViewModel model, Widget? child) => PharmacyAppScaffold(
Widget child) =>
PharmacyAppScaffold(
appBarTitle: TranslationBase.of(context).offers, appBarTitle: TranslationBase.of(context).offers,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -65,8 +63,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: model.categorise.length, itemCount: model.categorise.length,
itemBuilder: itemBuilder: (BuildContext context, int index) {
(BuildContext context, int index) {
return Padding( return Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: Row( child: Row(
@ -79,9 +76,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
width: 65.0, width: 65.0,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors color: Colors.orange.shade200.withOpacity(0.45),
.orange.shade200
.withOpacity(0.45),
), ),
child: Icon( child: Icon(
Icons.apps_sharp, Icons.apps_sharp,
@ -89,21 +84,13 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
), ),
), ),
Container( Container(
width: width: MediaQuery.of(context).size.width * 0.2,
MediaQuery.of(context) height: MediaQuery.of(context).size.height * 0.09,
.size
.width *
0.2,
height:
MediaQuery.of(context)
.size
.height *
0.09,
child: Center( child: Center(
child: Texts(projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name, child: Texts(
projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name,
// model.categorise[index].name, // model.categorise[index].name,
fontWeight: fontWeight: FontWeight.w600,
FontWeight.w600,
fontSize: 13.8, fontSize: 13.8,
), ),
), ),
@ -111,13 +98,10 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
], ],
), ),
onTap: () { onTap: () {
model.getOffersProducts( model.getOffersProducts(i: model.categorise[index].id);
i: model String ids = model.categorise[index].id!;
.categorise[index].id);
String ids =
model.categorise[index].id;
categoriseName = projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name; categoriseName = projectViewModel.isArabic ? model.categorise[index].namen! : model.categorise[index].name!;
//model.categorise[index].name; //model.categorise[index].name;
}), }),
], ],
@ -188,28 +172,20 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
styleOne == true styleOne == true
? Expanded( ? Expanded(
child: Container( child: Container(
height: height: MediaQuery.of(context).size.height * 0.50,
MediaQuery.of(context).size.height *
0.50,
child: GridView.builder( child: GridView.builder(
gridDelegate: gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 0.5, crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0, mainAxisSpacing: 2.0,
childAspectRatio: 0.85, childAspectRatio: 0.85,
), ),
itemCount: model.products.length, itemCount: model.products.length,
itemBuilder: itemBuilder: (BuildContext context, int index) {
(BuildContext context, int index) {
return NetworkBaseView( return NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: Card( child: Card(
color: model.products[index] color: model.products[index].discountName != null ? Color(0xffFFFF00) : Colors.white,
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0, elevation: 0,
shape: Border( shape: Border(
right: BorderSide( right: BorderSide(
@ -236,118 +212,66 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
child: Container( child: Container(
height: 250.0, height: 250.0,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius: BorderRadius.only(
BorderRadius.only( topLeft: Radius.circular(110.0),
topLeft: Radius.circular(
110.0),
), ),
color: Colors.white, color: Colors.white,
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(horizontal: 0),
horizontal: 0), width: MediaQuery.of(context).size.width / 3,
width: MediaQuery.of(context)
.size
.width /
3,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [ children: [
Stack( Stack(
children: [ children: [
if (model if (model.products[index].discountName != null)
.products[
index]
.discountName !=
null)
RotatedBox( RotatedBox(
quarterTurns: 4, quarterTurns: 4,
child: Container( child: Container(
decoration: decoration: BoxDecoration(),
BoxDecoration(),
child: Padding( child: Padding(
padding: padding: EdgeInsets.only(
EdgeInsets
.only(
right: 5.0, right: 5.0,
top: 20.0, top: 20.0,
bottom: 5.0, bottom: 5.0,
), ),
child: Texts( child: Texts(
TranslationBase.of(context).offers TranslationBase.of(context).offers.toUpperCase(),
.toUpperCase(), color: Colors.red,
color: Colors fontSize: 13.0,
.red, fontWeight: FontWeight.w900,
fontSize:
13.0,
fontWeight:
FontWeight
.w900,
), ),
), ),
transform: new Matrix4 transform: new Matrix4.rotationZ(5.837200),
.rotationZ(
5.837200),
), ),
), ),
Container( Container(
margin: EdgeInsets margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
.fromLTRB(0, 16, alignment: Alignment.center,
0, 0), child: Image.network(
alignment: Alignment model.products[index].images!.isNotEmpty
.center, ? model.products[index].images![0].thumb!
child:
Image.network(
model
.products[
index]
.images
.isNotEmpty
? model
.products[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover, fit: BoxFit.cover,
height: 80, height: 80,
), ),
), ),
Container( Container(
width: model width: model.products[index].rxMessage != null ? MediaQuery.of(context).size.width / 5 : 0,
.products[ padding: EdgeInsets.all(4),
index] decoration: BoxDecoration(
.rxMessage != color: Color(0xffb23838),
null borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
? MediaQuery.of(
context)
.size
.width /
5
: 0,
padding:
EdgeInsets.all(
4),
decoration:
BoxDecoration(
color: Color(
0xffb23838),
borderRadius: BorderRadius.only(
topLeft: Radius
.circular(
6)),
), ),
child: model.products[index].rxMessage != null child: model.products[index].rxMessage != null
? Texts( ? Texts(
projectProvider.isArabic projectProvider.isArabic ? model.products[index].rxMessagen : model.products[index].rxMessage,
? model.products[index].rxMessagen
: model.products[index].rxMessage,
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
): Texts("") )
: Texts("")
// Texts( // Texts(
// model.products[index].rxMessage != null ? // model.products[index].rxMessage != null ?
// model.products[index].rxMessage // model.products[index].rxMessage
@ -364,63 +288,39 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
], ],
), ),
Container( Container(
margin: EdgeInsets margin: EdgeInsets.symmetric(
.symmetric(
horizontal: 6, horizontal: 6,
vertical: 0, vertical: 0,
), ),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [ children: [
if (model if (model.products[index].discountName != null)
.products[
index]
.discountName !=
null)
Container( Container(
width: double width: double.infinity,
.infinity,
height: 22.0, height: 22.0,
decoration: decoration: BoxDecoration(
BoxDecoration( color: Color(0xff5AB145),
color: Color(
0xff5AB145),
), ),
child: Center( child: Center(
child: Texts( child: Texts(
model model.products[index].discountName,
.products[ regular: true,
index] color: Colors.white,
.discountName, fontSize: 12.0,
regular: fontWeight: FontWeight.w700,
true, ),
color: Colors ),
.white, ),
fontSize: Texts(
12.0, projectViewModel.isArabic ? model.products[index].namen : model.products[index].name,
fontWeight:
FontWeight
.w700,
),
),
),
Texts( projectViewModel.isArabic ? model.products[index].namen : model.products[index].name,
// model.products[index].name, // model.products[index].name,
regular: true, regular: true,
fontSize: 12.58, fontSize: 12.58,
fontWeight: fontWeight: FontWeight.w600,
FontWeight
.w600,
), ),
Padding( Padding(
padding: padding: const EdgeInsets.only(top: 4, bottom: 4),
const EdgeInsets
.only(
top: 4,
bottom:
4),
child: Texts( child: Texts(
"SAR ${model.products[index].price}", "SAR ${model.products[index].price}",
bold: true, bold: true,
@ -437,23 +337,34 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
// : 0, // : 0,
// forceStars: // forceStars:
// true), // true),
RatingBar.readOnly(
initialRating: model.products[index].approvedRatingSum.toDouble(), RatingBar(
size: 15.0, initialRating: model.products[index].approvedRatingSum!.toDouble(),
filledColor: Colors.yellow[700], ratingWidget: RatingWidget(
emptyColor: Colors.grey[500], full: Icon(
isHalfAllowed: true, Icons.star,
halfFilledIcon: Icons.star_half, color: Colors.yellow[700],
filledIcon: Icons.star, ),
emptyIcon: Icons.star, half: Icon(
Icons.star_half,
color: Colors.yellow[700],
),
empty: Icon(
Icons.star_border,
color: Colors.grey[500],
),
),
onRatingUpdate: (double value) {},
unratedColor: Colors.grey[500],
updateOnDrag: false,
tapOnlyMode: false,
), ),
Texts( Texts(
"(${model.products[index].approvedTotalReviews})", "(${model.products[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight: FontWeight.w400,
FontWeight
.w400,
) )
], ],
), ),
@ -472,8 +383,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
child: Container( child: Container(
child: ListView.builder( child: ListView.builder(
itemCount: model.products.length, itemCount: model.products.length,
itemBuilder: (BuildContext context, itemBuilder: (BuildContext context, int index) {
int index) {
return Card( return Card(
// color: // color:
// model.products[index].discountName != // model.products[index].discountName !=
@ -486,66 +396,37 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
children: [ children: [
Column( Column(
children: [ children: [
if (model if (model.products[index].discountName != null)
.products[
index]
.discountName !=
null)
Container( Container(
decoration: decoration: BoxDecoration(),
BoxDecoration(),
child: Padding( child: Padding(
padding: padding: EdgeInsets.only(
EdgeInsets
.only(
left: 9.0, left: 9.0,
top: 8.0, top: 8.0,
right: 10.0, right: 10.0,
), ),
child: child: Container(
Container( color: Colors.yellow,
color: Colors
.yellow,
height: 25.0, height: 25.0,
width: 70.0, width: 70.0,
child: Center( child: Center(
child: child: Texts(
Texts( TranslationBase.of(context).offers.toUpperCase(),
TranslationBase.of(context).offers color: Colors.red,
.toUpperCase(), fontSize: 13.0,
color: Colors fontWeight: FontWeight.w900,
.red,
fontSize:
13.0,
fontWeight:
FontWeight
.w900,
), ),
), ),
), ),
), ),
transform: new Matrix4 transform: new Matrix4.rotationZ(6.15099),
.rotationZ(
6.15099),
), ),
Container( Container(
margin: EdgeInsets margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
.fromLTRB( alignment: Alignment.center,
0, 0, 0, 0), child: Image.network(
alignment: Alignment model.products[index].images!.isNotEmpty
.center, ? model.products[index].images![0].thumb!
child:
Image.network(
model
.products[
index]
.images
.isNotEmpty
? model
.products[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover, fit: BoxFit.cover,
height: 80, height: 80,
@ -556,39 +437,21 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
Column( Column(
children: [ children: [
Container( Container(
width: model width: model.products[index].rxMessage != null ? MediaQuery.of(context).size.width / 5 : 0,
.products[ padding: EdgeInsets.all(4),
index] decoration: BoxDecoration(
.rxMessage != color: Color(0xffb23838),
null borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
? MediaQuery.of(
context)
.size
.width /
5
: 0,
padding:
EdgeInsets.all(
4),
decoration:
BoxDecoration(
color: Color(
0xffb23838),
borderRadius: BorderRadius.only(
topLeft: Radius
.circular(
6)),
), ),
child: model.products[index].rxMessage != null child: model.products[index].rxMessage != null
? Texts( ? Texts(
projectProvider.isArabic projectProvider.isArabic ? model.products[index].rxMessagen : model.products[index].rxMessage,
? model.products[index].rxMessagen
: model.products[index].rxMessage,
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
): Texts("") )
: Texts("")
// Texts( // Texts(
// model.products[index].rxMessage != null // model.products[index].rxMessage != null
// ? model.products[index].rxMessage // ? model.products[index].rxMessage
@ -607,67 +470,48 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
], ],
), ),
Container( Container(
margin: margin: EdgeInsets.symmetric(
EdgeInsets.symmetric(
horizontal: 6, horizontal: 6,
vertical: 0, vertical: 0,
), ),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [ children: [
if (model if (model.products[index].discountName != null)
.products[index]
.discountName !=
null)
Container( Container(
width: 250.0, width: 250.0,
height: 22.5, height: 22.5,
decoration: decoration: BoxDecoration(
BoxDecoration( color: Color(0xff5AB145),
color: Color(
0xff5AB145),
), ),
child: Padding( child: Padding(
padding: EdgeInsets padding: EdgeInsets.symmetric(
.symmetric(
horizontal: 5.5, horizontal: 5.5,
), ),
child: Texts( child: Texts(
model model.products[index].discountName,
.products[
index]
.discountName,
regular: true, regular: true,
color: Colors color: Colors.white,
.white,
fontSize: 12.0, fontSize: 12.0,
fontWeight: fontWeight: FontWeight.w700,
FontWeight
.w700,
), ),
), ),
), ),
SizedBox( SizedBox(
height: 4.0, height: 4.0,
), ),
Texts( projectViewModel.isArabic ? model.products[index].namen : model.products[index].name, Texts(
projectViewModel.isArabic ? model.products[index].namen : model.products[index].name,
// model.products[index].name, // model.products[index].name,
regular: true, regular: true,
fontSize: 14.0, fontSize: 14.0,
fontWeight: fontWeight: FontWeight.w600,
FontWeight.w600,
), ),
SizedBox( SizedBox(
height: 8.0, height: 8.0,
), ),
Padding( Padding(
padding: padding: const EdgeInsets.only(top: 4, bottom: 4),
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts( child: Texts(
"SAR ${model.products[index].price}", "SAR ${model.products[index].price}",
bold: true, bold: true,
@ -689,23 +533,34 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
// : 0, // : 0,
// forceStars: // forceStars:
// true), // true),
RatingBar.readOnly(
initialRating: model.products[index].approvedRatingSum.toDouble(), RatingBar(
size: 15.0, initialRating: model.products[index].approvedRatingSum!.toDouble(),
filledColor: Colors.yellow[700], ratingWidget: RatingWidget(
emptyColor: Colors.grey[500], full: Icon(
isHalfAllowed: true, Icons.star,
halfFilledIcon: Icons.star_half, color: Colors.yellow[700],
filledIcon: Icons.star,
emptyIcon: Icons.star,
), ),
half: Icon(
Icons.star_half,
color: Colors.yellow[700],
),
empty: Icon(
Icons.star_border,
color: Colors.grey[500],
),
),
onRatingUpdate: (double value) {},
unratedColor: Colors.grey[500],
updateOnDrag: false,
tapOnlyMode: false,
),
Texts( Texts(
"(${model.products[index].approvedTotalReviews})", "(${model.products[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight: FontWeight.w500,
FontWeight
.w500,
) )
], ],
), ),
@ -736,7 +591,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text(TranslationBase.of(context).noOffersAvailable, child: Text(
TranslationBase.of(context).noOffersAvailable,
// 'There is no data', // 'There is no data',
style: TextStyle(fontSize: 30), style: TextStyle(fontSize: 30),
), ),

@ -21,15 +21,15 @@ import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart'; import 'base/base_view.dart';
class ParentCategorisePage extends StatefulWidget { class ParentCategorisePage extends StatefulWidget {
String id; String? id;
String titleName; String? titleName;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>(); AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
@ -40,8 +40,8 @@ class ParentCategorisePage extends StatefulWidget {
} }
class _ParentCategorisePageState extends State<ParentCategorisePage> { class _ParentCategorisePageState extends State<ParentCategorisePage> {
String id; String? id;
String titleName; String? titleName;
final dynamic productID; final dynamic productID;
_ParentCategorisePageState({ _ParentCategorisePageState({
@ -63,8 +63,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
int pageIndex = 1; int pageIndex = 1;
List<CategoriseParentModel> entityList =[]; List<CategoriseParentModel> entityList = [];
List<CategoriseParentModel> entityListBrands =[]; List<CategoriseParentModel> entityListBrands = [];
RefreshController controller = RefreshController(); RefreshController controller = RefreshController();
@ -77,9 +77,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
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, allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold( builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget? child) => AppScaffold(
isPharmacy: true, isPharmacy: true,
appBarTitle: titleName, appBarTitle: titleName!,
isBottomBar: true, isBottomBar: true,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -338,10 +338,6 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
entityList.add(history); entityList.add(history);
}); });
}, },
addSelectedHistories: () {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected: (master) => isEntityListSelected(master), isEntityListSelected: (master) => isEntityListSelected(master),
) )
], ],
@ -366,10 +362,6 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
entityListBrands.add(history); entityListBrands.add(history);
}); });
}, },
addSelectedHistories: () {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected: (master) => isEntityListSelectedBrands(master), isEntityListSelected: (master) => isEntityListSelectedBrands(master),
) )
], ],
@ -462,7 +454,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
String categoriesId = ""; String categoriesId = "";
for (CategoriseParentModel category in entityList) { for (CategoriseParentModel category in entityList) {
if (categoriesId == "") { if (categoriesId == "") {
categoriesId = category.id; categoriesId = category.id!;
} else { } else {
categoriesId = "$categoriesId,${category.id}"; categoriesId = "$categoriesId,${category.id}";
} }
@ -470,7 +462,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
String brandIds = ""; String brandIds = "";
for (CategoriseParentModel brand in entityListBrands) { for (CategoriseParentModel brand in entityListBrands) {
if (brandIds == "") { if (brandIds == "") {
brandIds = brand.id; brandIds = brand.id!;
} else { } else {
brandIds = "$brandIds,${brand.id}"; brandIds = "$brandIds,${brand.id}";
} }
@ -633,8 +625,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
margin: EdgeInsets.fromLTRB(0, 16, 0, 0), margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.network( child: Image.network(
model.parentProducts[index].images.isNotEmpty model.parentProducts[index].images!.isNotEmpty
? model.parentProducts[index].images[0].thumb ? 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', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover, fit: BoxFit.cover,
height: 80, height: 80,
@ -736,16 +728,29 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
// ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() // ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble()
// : 0, // : 0,
// forceStars: true), // forceStars: true),
RatingBar.readOnly(
initialRating: model.parentProducts[index].approvedRatingSum.toDouble(), RatingBar(
size: 15.0, initialRating: model.parentProducts[index].approvedRatingSum!.toDouble(),
filledColor: Colors.yellow[700], ratingWidget: RatingWidget(
emptyColor: Colors.grey[500], full: Icon(
isHalfAllowed: true, Icons.star,
halfFilledIcon: Icons.star_half, color: Colors.yellow[700],
filledIcon: Icons.star, ),
emptyIcon: Icons.star, half: Icon(
Icons.star_half,
color: Colors.yellow[700],
),
empty: Icon(
Icons.star_border,
color: Colors.grey[500],
),
),
onRatingUpdate: (double value) {},
unratedColor: Colors.grey[500],
updateOnDrag: false,
tapOnlyMode: false,
), ),
Texts( Texts(
"(${model.parentProducts[index].approvedTotalReviews})", "(${model.parentProducts[index].approvedTotalReviews})",
regular: true, regular: true,
@ -799,9 +804,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Container( Container(
margin: EdgeInsets.fromLTRB(0, 0, 0, 0), margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
alignment: Alignment.center, alignment: Alignment.center,
child: model.parentProducts[index].images.isNotEmpty child: model.parentProducts[index].images!.isNotEmpty
? Image.network( ? Image.network(
model.parentProducts[index].images[0].thumb, model.parentProducts[index].images![0].thumb!,
fit: BoxFit.contain, fit: BoxFit.contain,
height: 70, height: 70,
) )
@ -879,16 +884,29 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
// ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble() // ? (model.parentProducts[index].approvedRatingSum.toDouble() / model.parentProducts[index].approvedRatingSum.toDouble()).toDouble()
// : 0, // : 0,
// forceStars: true), // forceStars: true),
RatingBar.readOnly(
initialRating: model.parentProducts[index].approvedRatingSum.toDouble(), RatingBar(
size: 15.0, initialRating: model.parentProducts[index].approvedRatingSum!.toDouble(),
filledColor: Colors.yellow[700], ratingWidget: RatingWidget(
emptyColor: Colors.grey[500], full: Icon(
isHalfAllowed: true, Icons.star,
halfFilledIcon: Icons.star_half, color: Colors.yellow[700],
filledIcon: Icons.star, ),
emptyIcon: Icons.star, half: Icon(
Icons.star_half,
color: Colors.yellow[700],
),
empty: Icon(
Icons.star_border,
color: Colors.grey[500],
), ),
),
onRatingUpdate: (double value) {},
unratedColor: Colors.grey[500],
updateOnDrag: false,
tapOnlyMode: false,
),
Texts( Texts(
"(${model.parentProducts[index].approvedTotalReviews})", "(${model.parentProducts[index].approvedTotalReviews})",
regular: true, regular: true,

@ -23,7 +23,7 @@ class PharmacyCategorisePage extends StatefulWidget {
} }
class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> { class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
String idCategorise; String? idCategorise;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -31,9 +31,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategorise(), onModelReady: (model) => model.getCategorise(),
allowAny: true, allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget? child) => AppScaffold(
Widget child) =>
AppScaffold(
isShowDecPage: false, isShowDecPage: false,
isShowAppBar: false, isShowAppBar: false,
isMainPharmacyPages: true, isMainPharmacyPages: true,
@ -66,9 +64,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0), padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts( child: Texts(
projectViewModel.isArabic projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name,
? model.categorise[index].namen
: model.categorise[index].name,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
@ -99,10 +95,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
height: 140, height: 140,
child: Column( child: Column(
children: [ children: [
Divider( Divider(height: 2.0, thickness: 1.0, color: Colors.black12.withOpacity(0.14)),
height: 2.0,
thickness: 1.0,
color: Colors.black12.withOpacity(0.14)),
SizedBox( SizedBox(
height: 10.0, height: 10.0,
), ),
@ -128,16 +121,12 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
width: 55.0, width: 55.0,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
color: color: Colors.green.shade300.withOpacity(0.34),
Colors.green.shade300.withOpacity(0.34),
), ),
child: Padding( child: Padding(
padding: padding: EdgeInsets.symmetric(horizontal: 10.0),
EdgeInsets.symmetric(horizontal: 10.0),
child: Texts( child: Texts(
projectViewModel.isArabic projectViewModel.isArabic ? 'الاكثر مبيعا' : 'Best Sellers',
? 'الاكثر مبيعا'
: 'Best Sellers',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
@ -164,17 +153,13 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
height: 50.0, height: 50.0,
width: 55.0, width: 55.0,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.orangeAccent.shade200 color: Colors.orangeAccent.shade200.withOpacity(0.34),
.withOpacity(0.34),
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
), ),
child: Padding( child: Padding(
padding: padding: EdgeInsets.symmetric(horizontal: 10.0),
EdgeInsets.symmetric(horizontal: 10.0),
child: Texts( child: Texts(
projectViewModel.isArabic projectViewModel.isArabic ? 'الاكثر مشاهدة' : 'Most Viewed',
? 'الاكثر مشاهدة'
: 'Most Viewed',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
@ -209,12 +194,9 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
), ),
child: Padding( child: Padding(
padding: padding: EdgeInsets.symmetric(horizontal: 10.0),
EdgeInsets.symmetric(horizontal: 10.0),
child: Texts( child: Texts(
projectViewModel.isArabic projectViewModel.isArabic ? 'منتجات جديدة' : 'New Products',
? 'منتجات جديدة'
: 'New Products',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
@ -241,17 +223,13 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
height: 50.0, height: 50.0,
width: 55.0, width: 55.0,
decoration: BoxDecoration( decoration: BoxDecoration(
color: color: Colors.purple.shade200.withOpacity(0.34),
Colors.purple.shade200.withOpacity(0.34),
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
), ),
child: Padding( child: Padding(
padding: padding: EdgeInsets.symmetric(horizontal: 10.0),
EdgeInsets.symmetric(horizontal: 10.0),
child: Texts( child: Texts(
projectViewModel.isArabic projectViewModel.isArabic ? 'شوهد مؤخرا' : 'Recently Viewed',
? 'شوهد مؤخرا'
: 'Recently Viewed',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
@ -277,7 +255,9 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
/// When give qr we will change this method to get data /// When give qr we will change this method to get data
/// var result = await BarcodeScanner.scan(); /// var result = await BarcodeScanner.scan();
/// int patientID = get from qr result /// int patientID = get from qr result
String result = (await BarcodeScanner.scan())?.rawContent; String result = await BarcodeScanner.scan().then((value) {
return value.rawContent;
});
var data = json.decode(result); var data = json.decode(result);
if (data != null) { if (data != null) {
var qRParkingID = data['QRParkingID']; var qRParkingID = data['QRParkingID'];
@ -285,7 +265,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error); Utils.showErrorToast(model.error);
} else { } else {
AppToast.showSuccessToast(message: model.scanList[0].id); AppToast.showSuccessToast(message: model.scanList[0].id!);
{ {
Navigator.push( Navigator.push(
context, context,

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
// import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; // import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -37,9 +38,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
ProjectViewModel projectProvider = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.clearSearchList(), onModelReady: (model) => model.clearSearchList(),
builder: (BuildContext context, PharmacyCategoriseViewModel model, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget? child) => PharmacyAppScaffold(
Widget child) =>
PharmacyAppScaffold(
appBarTitle: TranslationBase.of(context).search, appBarTitle: TranslationBase.of(context).search,
isBottomBar: false, isBottomBar: false,
isShowAppBar: true, isShowAppBar: true,
@ -122,8 +121,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
height: MediaQuery.of(context).size.height * 0.80, height: MediaQuery.of(context).size.height * 0.80,
child: GridView.builder( child: GridView.builder(
//physics: NeverScrollableScrollPhysics(), //physics: NeverScrollableScrollPhysics(),
gridDelegate: gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 0.5, crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0, mainAxisSpacing: 2.0,
@ -133,11 +131,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return InkWell( return InkWell(
child: Card( child: Card(
color: model.searchList[index] color: model.searchList[index].discountName != null ? Color(0xffFFFF00) : Colors.white,
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0, elevation: 0,
shape: Border( shape: Border(
right: BorderSide( right: BorderSide(
@ -168,70 +162,38 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
), ),
color: Colors.white, color: Colors.white,
), ),
padding: padding: EdgeInsets.symmetric(horizontal: 0),
EdgeInsets.symmetric(horizontal: 0), width: MediaQuery.of(context).size.width / 3,
width:
MediaQuery.of(context).size.width /
3,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
Stack( Stack(
children: [ children: [
Container( Container(
margin: EdgeInsets.fromLTRB( margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
0, 16, 0, 0),
alignment: Alignment.center, alignment: Alignment.center,
child: Image.network( child: Image.network(
model.searchList[index] model.searchList[index].images!.isNotEmpty
.images.isNotEmpty ? model.searchList[index].images![0].thumb!
? model
.searchList[index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover, fit: BoxFit.cover,
height: 80, height: 80,
), ),
), ),
Container( Container(
width: model.searchList[index] width: model.searchList[index].rxMessage != null ? MediaQuery.of(context).size.width / 3 : 0,
.rxMessage !=
null
? MediaQuery.of(context)
.size
.width /
3
: 0,
padding: EdgeInsets.all(4), padding: EdgeInsets.all(4),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xffb23838), color: Color(0xffb23838),
borderRadius: borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
BorderRadius.only( ),
topLeft: child: model.searchList[index].rxMessage != null
Radius.circular(
6)),
),
child: model.searchList[index]
.rxMessage !=
null
? Texts( ? Texts(
projectProvider projectProvider.isArabic ? model.searchList[index].rxMessagen : model.searchList[index].rxMessage,
.isArabic
? model
.searchList[
index]
.rxMessagen
: model
.searchList[
index]
.rxMessage,
color: Colors.white, color: Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight: FontWeight.w400,
FontWeight.w400,
) )
: Texts(""), : Texts(""),
// Texts( // Texts(
@ -256,17 +218,10 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
vertical: 0, vertical: 0,
), ),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
Texts( Texts(
projectProvider.isArabic projectProvider.isArabic ? model.searchList[index].namen : model.searchList[index].name,
? model
.searchList[index]
.namen
: model
.searchList[index]
.name,
// model.searchList[index].name, // model.searchList[index].name,
regular: true, regular: true,
@ -274,9 +229,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), ),
Padding( Padding(
padding: padding: const EdgeInsets.only(top: 4, bottom: 4),
const EdgeInsets.only(
top: 4, bottom: 4),
child: Texts( child: Texts(
"SAR ${model.searchList[index].price}", "SAR ${model.searchList[index].price}",
bold: true, bold: true,
@ -286,30 +239,15 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
Row( Row(
children: [ children: [
StarRating( StarRating(
totalAverage: model totalAverage: model.searchList[index].approvedRatingSum! > 0
.searchList[ ? (model.searchList[index].approvedRatingSum!.toDouble() / model.searchList[index].approvedRatingSum!.toDouble()).toDouble()
index]
.approvedRatingSum >
0
? (model
.searchList[
index]
.approvedRatingSum
.toDouble() /
model
.searchList[
index]
.approvedRatingSum
.toDouble())
.toDouble()
: 0, : 0,
forceStars: true), forceStars: true),
Texts( Texts(
"(${model.searchList[index].approvedTotalReviews})", "(${model.searchList[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight: FontWeight.w400,
FontWeight.w400,
) )
], ],
), ),
@ -324,8 +262,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: ProductDetailPage( page: ProductDetailPage(model.searchList[index]),
model.searchList[index]),
)), )),
}, },
); );
@ -350,7 +287,6 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
searchMedicine(PharmacyCategoriseViewModel model, BuildContext context) { searchMedicine(PharmacyCategoriseViewModel model, BuildContext context) {
Utils.hideKeyboard(context); Utils.hideKeyboard(context);
if (_formKey.currentState.validate()) if (_formKey.currentState!.validate()) model.searchProducts(productName: textController.text);
model.searchProducts(productName: textController.text);
} }
} }

@ -17,8 +17,8 @@ import 'package:provider/provider.dart';
class SubCategoriseModalsheet extends StatefulWidget { class SubCategoriseModalsheet extends StatefulWidget {
String id; String? id;
String titleName; String? titleName;
SubCategoriseModalsheet({this.id, this.titleName}); SubCategoriseModalsheet({this.id, this.titleName});
@override @override
@ -27,8 +27,8 @@ class SubCategoriseModalsheet extends StatefulWidget {
} }
class _SubCategoriseModalsheetState extends State<SubCategoriseModalsheet> { class _SubCategoriseModalsheetState extends State<SubCategoriseModalsheet> {
String id; String? id;
String titleName; String? titleName;
// List<CategoriseParentModel> categoriesList = []; // List<CategoriseParentModel> categoriesList = [];
_SubCategoriseModalsheetState({this.id, this.titleName}); _SubCategoriseModalsheetState({this.id, this.titleName});

@ -19,35 +19,33 @@ import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart' as utils;
import 'package:diplomaticquarterapp/uitl/utils.dart' as utils ;
import 'base/base_view.dart'; import 'base/base_view.dart';
import 'final_products_page.dart'; import 'final_products_page.dart';
class SubCategorisePage extends StatefulWidget { class SubCategorisePage extends StatefulWidget {
String id; String? id;
String title; String? title;
String parentId; String? parentId;
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
locator<AuthenticatedUserObject>();
SubCategorisePage({this.id, this.parentId, this.title}); SubCategorisePage({this.id, this.parentId, this.title});
@override @override
_SubCategorisePageState createState() => _SubCategorisePageState createState() => _SubCategorisePageState(id: id, title: title, parentId: parentId);
_SubCategorisePageState(id: id, title: title, parentId: parentId);
} }
class _SubCategorisePageState extends State<SubCategorisePage> { class _SubCategorisePageState extends State<SubCategorisePage> {
bool checkedBrands = false; bool checkedBrands = false;
bool checkedCategorise = false; bool checkedCategorise = false;
String id; String? id;
String title; String? title;
String parentId; String? parentId;
_SubCategorisePageState({this.title, this.parentId, this.id}); _SubCategorisePageState({this.title, this.parentId, this.id});
@ -63,8 +61,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
int pageIndex = 1; int pageIndex = 1;
RefreshController controller = RefreshController(); RefreshController controller = RefreshController();
List<CategoriseParentModel> entityList =[]; List<CategoriseParentModel> entityList = [];
List<CategoriseParentModel> entityListBrands =[]; List<CategoriseParentModel> entityListBrands = [];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -73,14 +71,11 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
ProjectViewModel projectProvider = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getSubCategorise( onModelReady: (model) => model.getSubCategorise(i: id, pageIndex: pageIndex, isLoading: false, context: context),
i: id, pageIndex: pageIndex, isLoading: false, context: context),
allowAny: true, allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget? child) => AppScaffold(
Widget child) =>
AppScaffold(
isPharmacy: true, isPharmacy: true,
appBarTitle: title, appBarTitle: title!,
isBottomBar: true, isBottomBar: true,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -96,11 +91,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
setState(() { setState(() {
++pageIndex; ++pageIndex;
}); });
await model.getSubProducts( await model.getSubProducts(pageIndex: pageIndex, i: id, isLoading: true, context: context);
pageIndex: pageIndex,
i: id,
isLoading: true,
context: context);
if (model.state != ViewState.BusyLocal && pageIndex < 5) { if (model.state != ViewState.BusyLocal && pageIndex < 5) {
controller.loadComplete(); controller.loadComplete();
} else { } else {
@ -132,8 +123,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png'
: parentId == '9' : parentId == '9'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png'
: parentId == : parentId == '10'
'10'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png'
: '', : '',
fit: BoxFit.fill, fit: BoxFit.fill,
@ -145,14 +135,12 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
children: [ children: [
InkWell( InkWell(
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
child: Container( child: Container(
child: Texts(TranslationBase.of(context) child: Texts(TranslationBase.of(context).viewSubCategorise),
.viewSubCategorise),
), ),
), ),
Icon(Icons.arrow_forward) Icon(Icons.arrow_forward)
@ -164,45 +152,27 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return Container( return Container(
height: height: MediaQuery.of(context).size.height * 0.89,
MediaQuery.of(context).size.height *
0.89,
color: Colors.white, color: Colors.white,
child: Center( child: Center(
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
itemCount: itemCount: model.subCategorise.length,
model.subCategorise.length, itemBuilder: (BuildContext context, int index) {
itemBuilder:
(BuildContext context,
int index) {
return Container( return Container(
child: Padding( child: Padding(
padding: padding: EdgeInsets.all(8.0),
EdgeInsets.all(8.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [ children: [
Texts( Texts(
projectViewModel projectViewModel.isArabic ? model.subCategorise[index].namen : model.subCategorise[index].name,
.isArabic
? model
.subCategorise[
index]
.namen
: model
.subCategorise[
index]
.name,
// model.subCategorise[index].name // model.subCategorise[index].name
), ),
Divider( Divider(
thickness: 0.6, thickness: 0.6,
color: color: Colors.black12,
Colors.black12,
) )
], ],
), ),
@ -210,12 +180,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: page: FinalProductsPage(
FinalProductsPage( id: model.subCategorise[index].id!,
id: model
.subCategorise[
index]
.id,
), ),
), ),
); );
@ -246,26 +212,21 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: model.subCategorise.length, itemCount: model.subCategorise.length,
itemBuilder: itemBuilder: (BuildContext context, int index) {
(BuildContext context, int index) {
return Padding( return Padding(
padding: padding: EdgeInsets.symmetric(horizontal: 8.0),
EdgeInsets.symmetric(horizontal: 8.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(horizontal: 13.0),
horizontal: 13.0),
child: Container( child: Container(
height: 60.0, height: 60.0,
width: 65.0, width: 65.0,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.orange.shade200 color: Colors.orange.shade200.withOpacity(0.45),
.withOpacity(0.45),
), ),
child: Center( child: Center(
child: Icon( child: Icon(
@ -276,23 +237,11 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
), ),
Container( Container(
width: MediaQuery.of(context) width: MediaQuery.of(context).size.width * 0.17,
.size height: MediaQuery.of(context).size.height * 0.10,
.width *
0.17,
height: MediaQuery.of(context)
.size
.height *
0.10,
child: Center( child: Center(
child: Texts( child: Texts(
projectViewModel.isArabic projectViewModel.isArabic ? model.subCategorise[index].namen : model.subCategorise[index].name,
? model
.subCategorise[index]
.namen
: model
.subCategorise[index]
.name,
// model.subCategorise[index].name, // model.subCategorise[index].name,
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -307,8 +256,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
context, context,
FadePage( FadePage(
page: FinalProductsPage( page: FinalProductsPage(
id: model id: model.subCategorise[index].id!,
.subCategorise[index].id,
), ),
), ),
); );
@ -352,22 +300,16 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
initialChildSize: 0.95, initialChildSize: 0.95,
maxChildSize: 0.95, maxChildSize: 0.95,
minChildSize: 0.9, minChildSize: 0.9,
builder: (BuildContext context, builder: (BuildContext context, ScrollController scrollController) {
ScrollController
scrollController) {
return SingleChildScrollView( return SingleChildScrollView(
controller: scrollController, controller: scrollController,
child: Container( child: Container(
color: Colors.white, color: Colors.white,
height: MediaQuery.of(context) height: MediaQuery.of(context).size.height * 1.95,
.size
.height *
1.95,
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: padding: EdgeInsets.all(8.0),
EdgeInsets.all(8.0),
child: Row( child: Row(
children: [ children: [
Icon( Icon(
@ -377,31 +319,23 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
width: 10.0, width: 10.0,
), ),
Texts( Texts(
TranslationBase.of( TranslationBase.of(context).refine,
context)
.refine,
// 'Refine', // 'Refine',
fontWeight: fontWeight: FontWeight.w600,
FontWeight.w600,
), ),
SizedBox( SizedBox(
width: 250.0, width: 250.0,
), ),
InkWell( InkWell(
child: Texts( child: Texts(
TranslationBase.of( TranslationBase.of(context).closeIt,
context)
.closeIt,
// 'Close', // 'Close',
color: Colors.red, color: Colors.red,
fontWeight: fontWeight: FontWeight.w600,
FontWeight
.w600,
fontSize: 15.0, fontSize: 15.0,
), ),
onTap: () { onTap: () {
Navigator.pop( Navigator.pop(context);
context);
}, },
), ),
], ],
@ -414,39 +348,22 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column( Column(
children: [ children: [
ExpansionTile( ExpansionTile(
title: Texts( title: Texts(TranslationBase.of(context).subGroup),
TranslationBase.of(
context)
.subGroup),
children: [ children: [
ProcedureListWidget( ProcedureListWidget(
model: model, model: model,
masterList: model masterList: model.subCategorise,
.subCategorise, removeHistory: (item) {
removeHistory:
(item) {
setState(() { setState(() {
entityList entityList.remove(item);
.remove(
item);
}); });
}, },
addHistory: addHistory: (history) {
(history) {
setState(() { setState(() {
entityList.add( entityList.add(history);
history);
}); });
}, },
addSelectedHistories: isEntityListSelected: (master) => isEntityListSelected(master),
() {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected:
(master) =>
isEntityListSelected(
master),
) )
], ],
), ),
@ -455,40 +372,22 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: Texts( title: Texts(TranslationBase.of(context).brands),
TranslationBase.of(
context)
.brands),
children: [ children: [
ProcedureListWidget( ProcedureListWidget(
model: model, model: model,
masterList: model masterList: model.brandsList,
.brandsList, removeHistory: (item) {
removeHistory:
(item) {
setState(() { setState(() {
entityListBrands entityListBrands.remove(item);
.remove(
item);
}); });
}, },
addHistory: addHistory: (history) {
(history) {
setState(() { setState(() {
entityListBrands entityListBrands.add(history);
.add(
history);
}); });
}, },
addSelectedHistories: isEntityListSelected: (master) => isEntityListSelectedBrands(master),
() {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected:
(master) =>
isEntityListSelectedBrands(
master),
) )
], ],
), ),
@ -497,71 +396,43 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: Texts( title: Texts(TranslationBase.of(context).price),
TranslationBase.of(
context)
.price),
children: [ children: [
Container( Container(
color: Color( color: Color(0xffEEEEEE),
0xffEEEEEE),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceAround,
MainAxisAlignment
.spaceAround,
children: [ children: [
Column( Column(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment
.start,
children: [ children: [
Texts(TranslationBase.of( Texts(TranslationBase.of(context).min),
context)
.min),
Container( Container(
color: Colors color: Colors.white,
.white, width: 200,
width: height: 40,
200, child: TextFormField(
height: decoration: InputDecoration(
40, border: OutlineInputBorder(),
child: ),
TextFormField( controller: minField,
decoration:
InputDecoration(
border:
OutlineInputBorder(),
),
controller:
minField,
), ),
), ),
], ],
), ),
Column( Column(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment
.start,
children: [ children: [
Texts(TranslationBase.of( Texts(TranslationBase.of(context).max),
context)
.max),
Container( Container(
color: Colors color: Colors.white,
.white, width: 200,
width: height: 40,
200, child: TextFormField(
height: decoration: InputDecoration(
40, border: OutlineInputBorder(),
child: ),
TextFormField( controller: maxField,
decoration:
InputDecoration(
border:
OutlineInputBorder(),
),
controller:
maxField,
), ),
), ),
], ],
@ -576,33 +447,20 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
SizedBox( SizedBox(
height: MediaQuery.of( height: MediaQuery.of(context).size.height * 0.4,
context)
.size
.height *
0.4,
), ),
Padding( Padding(
padding: padding: EdgeInsets.all(8.0),
EdgeInsets.all(
8.0),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceEvenly,
MainAxisAlignment
.spaceEvenly,
children: [ children: [
Expanded( Expanded(
child: child: Container(
Container(
width: 100, width: 100,
child: Button( child: Button(
label: TranslationBase.of( label: TranslationBase.of(context).reset,
context)
.reset,
// 'Reset', // 'Reset',
backgroundColor: backgroundColor: Colors.red,
Colors
.red,
), ),
), ),
), ),
@ -612,69 +470,37 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Container( Container(
width: 200, width: 200,
child: Button( child: Button(
onTap: onTap: () async {
() async { String categoriesId = "";
String for (CategoriseParentModel category in entityList) {
categoriesId = if (categoriesId == "") {
""; categoriesId = category.id!;
for (CategoriseParentModel category
in entityList) {
if (categoriesId ==
"") {
categoriesId =
category.id;
} else { } else {
categoriesId = categoriesId = "$categoriesId,${category.id}";
"$categoriesId,${category.id}";
} }
} }
String String brandIds = "";
brandIds =
"";
for (CategoriseParentModel brand for (CategoriseParentModel brand in entityListBrands) {
in entityListBrands) { if (brandIds == "") {
if (brandIds == brandIds = brand.id!;
"") {
brandIds =
brand.id;
} else { } else {
brandIds = brandIds = "$brandIds,${brand.id}";
"$brandIds,${brand.id}";
} }
} }
GifLoaderDialogUtils GifLoaderDialogUtils.showMyDialog(context);
.showMyDialog(
context);
await model.getFilteredSubProducts( await model.getFilteredSubProducts(
min: minField.text.isEmpty min: minField.text.isEmpty ? "" : minField.text.toString(),
? "" max: maxField.text.isEmpty ? "" : maxField.text.toString(),
: minField.text categoryId: categoriesId,
.toString(), brandId: brandIds.isEmpty ? "" : "&manufacturerids=" + brandIds);
max: maxField.text.isEmpty GifLoaderDialogUtils.hideDialog(context);
? "" Navigator.pop(context);
: maxField.text
.toString(),
categoryId:
categoriesId,
brandId: brandIds.isEmpty
? ""
: "&manufacturerids=" +
brandIds);
GifLoaderDialogUtils
.hideDialog(
context);
Navigator.pop(
context);
}, },
label: TranslationBase.of( label: TranslationBase.of(context).apply,
context)
.apply,
// 'Apply', // 'Apply',
backgroundColor: backgroundColor: Colors.green,
Colors
.green,
), ),
), ),
], ],
@ -741,28 +567,20 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
model.subProducts.isNotEmpty model.subProducts.isNotEmpty
? styleOne == true ? styleOne == true
? Container( ? Container(
height: model.subProducts.length * height: model.subProducts.length * MediaQuery.of(context).size.height * 0.15,
MediaQuery.of(context).size.height *
0.15,
child: GridView.builder( child: GridView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 0.5, crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0, mainAxisSpacing: 2.0,
childAspectRatio: 0.9, childAspectRatio: 0.9,
), ),
itemCount: model.subProducts.length, itemCount: model.subProducts.length,
itemBuilder: itemBuilder: (BuildContext context, int index) {
(BuildContext context, int index) {
return InkWell( return InkWell(
child: Card( child: Card(
color: model.subProducts[index] color: model.subProducts[index].discountName != null ? Color(0xffFFFF00) : Colors.white,
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0, elevation: 0,
shape: Border( shape: Border(
right: BorderSide( right: BorderSide(
@ -789,92 +607,42 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: topLeft: Radius.circular(110.0),
Radius.circular(110.0),
), ),
color: Colors.white, color: Colors.white,
), ),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(horizontal: 0),
horizontal: 0), width: MediaQuery.of(context).size.width / 3,
width: MediaQuery.of(context)
.size
.width /
3,
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
Stack( Stack(
children: [ children: [
Container( Container(
margin: margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
EdgeInsets.fromLTRB( alignment: Alignment.center,
0, 16, 0, 0),
alignment:
Alignment.center,
child: Image.network( child: Image.network(
model model.subProducts[index].images!.isNotEmpty
.subProducts[ ? model.subProducts[index].images![0].thumb!
index]
.images
.isNotEmpty
? model
.subProducts[
index]
.images[0]
.thumb
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png', : 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
fit: BoxFit.cover, fit: BoxFit.cover,
height: 80, height: 80,
), ),
), ),
Container( Container(
width: model width: model.subProducts[index].rxMessage != null ? MediaQuery.of(context).size.width / 3 : 0,
.subProducts[ padding: EdgeInsets.all(4),
index] decoration: BoxDecoration(
.rxMessage != color: Color(0xffb23838),
null borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
? MediaQuery.of( ),
context) child: model.subProducts[index].rxMessage != null
.size
.width /
3
: 0,
padding:
EdgeInsets.all(4),
decoration:
BoxDecoration(
color:
Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(
6)),
),
child: model
.subProducts[
index]
.rxMessage !=
null
? Texts( ? Texts(
projectProvider projectProvider.isArabic ? model.subProducts[index].rxMessagen : model.subProducts[index].rxMessage,
.isArabic color: Colors.white,
? model
.subProducts[
index]
.rxMessagen
: model
.subProducts[
index]
.rxMessage,
color: Colors
.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight: FontWeight.w400,
FontWeight
.w400,
) )
: Texts(""), : Texts(""),
// Texts( // Texts(
@ -888,39 +656,22 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
], ],
), ),
Container( Container(
margin: margin: EdgeInsets.symmetric(
EdgeInsets.symmetric(
horizontal: 6, horizontal: 6,
vertical: 0, vertical: 0,
), ),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [ children: [
Texts( Texts(
projectViewModel projectViewModel.isArabic ? model.subProducts[index].namen : model.subProducts[index].name,
.isArabic
? model
.subProducts[
index]
.namen
: model
.subProducts[
index]
.name,
// model.subProducts[index].name, // model.subProducts[index].name,
regular: true, regular: true,
fontSize: 12, fontSize: 12,
fontWeight: fontWeight: FontWeight.w400,
FontWeight.w400,
), ),
Padding( Padding(
padding: padding: const EdgeInsets.only(top: 4, bottom: 4),
const EdgeInsets
.only(
top: 4,
bottom: 4),
child: Texts( child: Texts(
"SAR ${model.subProducts[index].price}", "SAR ${model.subProducts[index].price}",
bold: true, bold: true,
@ -934,35 +685,32 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
// ? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble() // ? (model.subProducts[index].approvedRatingSum.toDouble() / model.subProducts[index].approvedRatingSum.toDouble()).toDouble()
// : 0, // : 0,
// forceStars: true), // forceStars: true),
RatingBar.readOnly( RatingBar(
initialRating: model initialRating: model.subProducts[index].approvedRatingSum!.toDouble(),
.subProducts[ ratingWidget: RatingWidget(
index] full: Icon(
.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, Icons.star,
color: Colors.yellow[700],
),
half: Icon(
Icons.star_half,
color: Colors.yellow[700],
),
empty: Icon(
Icons.star_border,
color: Colors.grey[500],
),
),
onRatingUpdate: (double value) {},
unratedColor: Colors.grey[500],
updateOnDrag: false,
tapOnlyMode: false,
), ),
Texts( Texts(
"(${model.subProducts[index].approvedTotalReviews})", "(${model.subProducts[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight: FontWeight.w400,
FontWeight
.w400,
) )
], ],
), ),
@ -977,8 +725,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: ProductDetailPage( page: ProductDetailPage(model.subProducts[index]),
model.subProducts[index]),
)), )),
}, },
); );
@ -986,14 +733,11 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
) )
: Container( : Container(
height: model.subProducts.length * height: model.subProducts.length * MediaQuery.of(context).size.height * 0.122,
MediaQuery.of(context).size.height *
0.122,
child: ListView.builder( child: ListView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: model.subProducts.length, itemCount: model.subProducts.length,
itemBuilder: itemBuilder: (BuildContext context, int index) {
(BuildContext context, int index) {
return InkWell( return InkWell(
child: Card( child: Card(
child: Row( child: Row(
@ -1015,14 +759,12 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Container( Container(
margin: EdgeInsets.fromLTRB(0, 0, 0, 8), margin: EdgeInsets.fromLTRB(0, 0, 0, 8),
alignment: Alignment.center, alignment: Alignment.center,
child:(model.subProducts[index].images != null && child: (model.subProducts[index].images != null && model.subProducts[index].images!.length > 0)
model.subProducts[index].images.length > 0)
? Image.network( ? Image.network(
model.subProducts[index].images[0].src, model.subProducts[index].images![0].src!,
fit: BoxFit.cover, fit: BoxFit.cover,
height: 80, height: 80,
width: 80, width: 80,
) )
: Image.asset( : Image.asset(
"assets/images/no_image.png", "assets/images/no_image.png",
@ -1042,7 +784,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Color(0xffb23838), color: Color(0xffb23838),
//borderRadius: BorderRadius.only(topLeft: Radius.circular(5)), //borderRadius: BorderRadius.only(topLeft: Radius.circular(5)),
), ),
child:model.subProducts[index].rxMessage != null child: model.subProducts[index].rxMessage != null
? Texts( ? Texts(
projectProvider.isArabic ? model.subProducts[index].rxMessagen : model.subProducts[index].rxMessage, projectProvider.isArabic ? model.subProducts[index].rxMessagen : model.subProducts[index].rxMessage,
color: Colors.white, color: Colors.white,
@ -1071,7 +813,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
Container( Container(
width: MediaQuery.of(context).size.width * 0.55, width: MediaQuery.of(context).size.width * 0.55,
child: Texts(projectViewModel.isArabic ? model.subProducts[index].namen : model.subProducts[index].name, child: Texts(
projectViewModel.isArabic ? model.subProducts[index].namen : model.subProducts[index].name,
regular: true, regular: true,
fontSize: 13.2, fontSize: 13.2,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -1091,15 +834,26 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
Row( Row(
children: [ children: [
RatingBar.readOnly( RatingBar(
initialRating: model.subProducts[index].approvedRatingSum.toDouble(), initialRating: model.subProducts[index].approvedRatingSum!.toDouble(),
size: 15.0, ratingWidget: RatingWidget(
filledColor: Colors.yellow[700], full: Icon(
emptyColor: Colors.grey[500], Icons.star,
isHalfAllowed: true, color: Colors.yellow[700],
halfFilledIcon: Icons.star_half, ),
filledIcon: Icons.star, half: Icon(
emptyIcon: Icons.star, Icons.star_half,
color: Colors.yellow[700],
),
empty: Icon(
Icons.star_border,
color: Colors.grey[500],
),
),
onRatingUpdate: (double value) {},
unratedColor: Colors.grey[500],
updateOnDrag: false,
tapOnlyMode: false,
), ),
Texts( Texts(
"(${model.subProducts[index].approvedTotalReviews})", "(${model.subProducts[index].approvedTotalReviews})",
@ -1126,8 +880,6 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
await addToCartFunction(1, model.subProducts[index].id); await addToCartFunction(1, model.subProducts[index].id);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
utils.Utils.navigateToCartPage(); utils.Utils.navigateToCartPage();
} else { } else {
AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription); AppToast.showErrorToast(message: TranslationBase.of(context).needPrescription);
} }
@ -1420,8 +1172,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
child: Container( child: Container(
child: Center( child: Center(
child: Column( child: Column(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
@ -1453,8 +1204,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
} }
bool isEntityListSelected(CategoriseParentModel masterKey) { bool isEntityListSelected(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history = Iterable<CategoriseParentModel> history = entityList.where((element) => masterKey.id == element.id);
entityList.where((element) => masterKey.id == element.id);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }
@ -1462,8 +1212,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
} }
bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { bool isEntityListSelectedBrands(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history = Iterable<CategoriseParentModel> history = entityListBrands.where((element) => masterKey.id == element.id);
entityListBrands.where((element) => masterKey.id == element.id);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }

@ -38,9 +38,6 @@ class CalendarUtils {
else else
_currentLocation = getLocation('Asia/Riyadh'); _currentLocation = getLocation('Asia/Riyadh');
scheduleDateTime!.forEach((element) {
Future createOrUpdateEvents({List<DateTime>? scheduleList, String? title, String? description, List<DateTime>? scheduleDateTime, List<DayOfWeek>? daysOfWeek}) async {
List<Event> events =[];
scheduleDateTime!.forEach((element) { scheduleDateTime!.forEach((element) {
RecurrenceRule recurrenceRule = RecurrenceRule( RecurrenceRule recurrenceRule = RecurrenceRule(
RecurrenceFrequency.Daily, RecurrenceFrequency.Daily,

@ -29,6 +29,7 @@ import 'package:diplomaticquarterapp/widgets/pharmacy/bottom_nav_pharmacy_bar.da
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -75,7 +76,7 @@ class AppScaffold extends StatefulWidget {
final int? dropdownIndexValue; final int? dropdownIndexValue;
List<String>? dropDownList; List<String>? dropDownList;
final void Function(int?)? dropDownIndexChange; final void Function(int?)? dropDownIndexChange;
VoidCallbackAction()? onTap; VoidCallbackAction? onTap;
final bool isMainPharmacyPages; final bool isMainPharmacyPages;
final bool extendBody; final bool extendBody;
final ValueChanged<int>? changeCurrentTab; final ValueChanged<int>? changeCurrentTab;

Loading…
Cancel
Save