dev_v3.13.6_voipcall
devamirsaleemahmad 3 years ago
parent d8836d5e89
commit 47801ecb36

@ -26,7 +26,7 @@ class TestPageState extends State<TestPage>{
}
void location(){
LocationUtils().getCurrentLocation(callBack: (latLng){
LocationUtils(context: context,isShowConfirmDialog: false).getCurrentLocation(callBack: (latLng){
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/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart';
@ -26,7 +26,7 @@ import 'base/base_view.dart';
dynamic languageID;
class FinalProductsPage extends StatefulWidget {
final String id;
final String? id;
final int productType; // 1 : default, 2 : manufacturer , 3 : recently viewed
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
@ -37,7 +37,7 @@ class FinalProductsPage extends StatefulWidget {
}
class _FinalProductsPageState extends State<FinalProductsPage> {
String id;
String? id;
_FinalProductsPageState({this.id});
@ -70,7 +70,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
model.getFinalProducts(i: id);
appBarTitle = TranslationBase.of(context).products;
} else if (widget.productType == 2) {
model.getManufacturerProducts(id);
model.getManufacturerProducts(id!);
} else if (widget.productType == 3) {
model.getLastVisitedProducts();
appBarTitle = TranslationBase.of(context).recentlyViewed;
@ -86,7 +86,7 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
}
},
allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold(
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget? child) => AppScaffold(
isPharmacy: true,
appBarTitle: appBarTitle,
isBottomBar: true,
@ -217,9 +217,9 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
alignment: Alignment.center,
child: (model.finalProducts[index].images != null &&
model.finalProducts[index].images.length > 0)
model.finalProducts[index].images!.length > 0)
? Image.network(
model.finalProducts[index].images[0].src,
model.finalProducts[index].images![0].src!,
fit: BoxFit.cover,
height: 80,
width: 80,
@ -305,16 +305,30 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
// ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble()
// : 0,
// forceStars: true),
RatingBar.readOnly(
initialRating: model.finalProducts[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(
initialRating: model.finalProducts[index].approvedRatingSum!.toDouble(),
ratingWidget: RatingWidget(
full: Icon(
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(
"(${model.finalProducts[index].approvedTotalReviews})",
regular: true,
@ -394,9 +408,9 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
margin: EdgeInsets.fromLTRB(0, 0, 0, 8),
alignment: Alignment.center,
child:(model.finalProducts[index].images != null &&
model.finalProducts[index].images.length > 0)
model.finalProducts[index].images!.length > 0)
? Image.network(
model.finalProducts[index].images[0].src,
model.finalProducts[index].images![0].src!,
fit: BoxFit.cover,
height: 80,
width: 80,
@ -489,16 +503,30 @@ class _FinalProductsPageState extends State<FinalProductsPage> {
// ? (model.finalProducts[index].approvedRatingSum.toDouble() / model.finalProducts[index].approvedRatingSum.toDouble()).toDouble()
// : 0,
// forceStars: true),
RatingBar.readOnly(
initialRating: model.finalProducts[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(
initialRating: model.finalProducts[index].approvedRatingSum!.toDouble(),
ratingWidget: RatingWidget(
full: Icon(
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(
"(${model.finalProducts[index].approvedTotalReviews})",
regular: true,

@ -18,9 +18,9 @@ import '../../config/config.dart';
class IncomingCall extends StatefulWidget {
IncomingCallData incomingCallData;
IncomingCallData? incomingCallData;
IncomingCall({required this.incomingCallData});
IncomingCall({ this.incomingCallData});
@override
_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/network_base_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart';
@ -32,9 +32,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
ProjectViewModel projectProvider = Provider.of(context);
return BaseView<OffersCategoriseViewModel>(
onModelReady: (model) => model.getOffersCategorise(),
builder: (BuildContext context, OffersCategoriseViewModel model,
Widget child) =>
PharmacyAppScaffold(
builder: (BuildContext context, OffersCategoriseViewModel model, Widget? child) => PharmacyAppScaffold(
appBarTitle: TranslationBase.of(context).offers,
isShowAppBar: true,
backgroundColor: Colors.white,
@ -65,8 +63,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: model.categorise.length,
itemBuilder:
(BuildContext context, int index) {
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Row(
@ -79,9 +76,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
width: 65.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors
.orange.shade200
.withOpacity(0.45),
color: Colors.orange.shade200.withOpacity(0.45),
),
child: Icon(
Icons.apps_sharp,
@ -89,21 +84,13 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
),
),
Container(
width:
MediaQuery.of(context)
.size
.width *
0.2,
height:
MediaQuery.of(context)
.size
.height *
0.09,
width: MediaQuery.of(context).size.width * 0.2,
height: MediaQuery.of(context).size.height * 0.09,
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,
fontWeight:
FontWeight.w600,
fontWeight: FontWeight.w600,
fontSize: 13.8,
),
),
@ -111,13 +98,10 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
],
),
onTap: () {
model.getOffersProducts(
i: model
.categorise[index].id);
String ids =
model.categorise[index].id;
model.getOffersProducts(i: model.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;
}),
],
@ -188,28 +172,20 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
styleOne == true
? Expanded(
child: Container(
height:
MediaQuery.of(context).size.height *
0.50,
height: MediaQuery.of(context).size.height * 0.50,
child: GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0,
childAspectRatio: 0.85,
),
itemCount: model.products.length,
itemBuilder:
(BuildContext context, int index) {
itemBuilder: (BuildContext context, int index) {
return NetworkBaseView(
baseViewModel: model,
child: Card(
color: model.products[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
color: model.products[index].discountName != null ? Color(0xffFFFF00) : Colors.white,
elevation: 0,
shape: Border(
right: BorderSide(
@ -236,118 +212,66 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
child: Container(
height: 250.0,
decoration: BoxDecoration(
borderRadius:
BorderRadius.only(
topLeft: Radius.circular(
110.0),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(110.0),
),
color: Colors.white,
),
padding: EdgeInsets.symmetric(
horizontal: 0),
width: MediaQuery.of(context)
.size
.width /
3,
padding: EdgeInsets.symmetric(horizontal: 0),
width: MediaQuery.of(context).size.width / 3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
children: [
if (model
.products[
index]
.discountName !=
null)
if (model.products[index].discountName != null)
RotatedBox(
quarterTurns: 4,
child: Container(
decoration:
BoxDecoration(),
decoration: BoxDecoration(),
child: Padding(
padding:
EdgeInsets
.only(
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,
TranslationBase.of(context).offers.toUpperCase(),
color: Colors.red,
fontSize: 13.0,
fontWeight: FontWeight.w900,
),
),
transform: new Matrix4
.rotationZ(
5.837200),
transform: new Matrix4.rotationZ(5.837200),
),
),
Container(
margin: EdgeInsets
.fromLTRB(0, 16,
0, 0),
alignment: Alignment
.center,
child:
Image.network(
model
.products[
index]
.images
.isNotEmpty
? model
.products[
index]
.images[0]
.thumb
margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
alignment: Alignment.center,
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',
fit: BoxFit.cover,
height: 80,
),
),
Container(
width: model
.products[
index]
.rxMessage !=
null
? MediaQuery.of(
context)
.size
.width /
5
: 0,
padding:
EdgeInsets.all(
4),
decoration:
BoxDecoration(
color: Color(
0xffb23838),
borderRadius: BorderRadius.only(
topLeft: Radius
.circular(
6)),
width: model.products[index].rxMessage != null ? MediaQuery.of(context).size.width / 5 : 0,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
),
child: model.products[index].rxMessage != null
? Texts(
projectProvider.isArabic
? model.products[index].rxMessagen
: model.products[index].rxMessage,
projectProvider.isArabic ? model.products[index].rxMessagen : model.products[index].rxMessage,
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
): Texts("")
)
: Texts("")
// Texts(
// model.products[index].rxMessage != null ?
// model.products[index].rxMessage
@ -364,63 +288,39 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
],
),
Container(
margin: EdgeInsets
.symmetric(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (model
.products[
index]
.discountName !=
null)
if (model.products[index].discountName != null)
Container(
width: double
.infinity,
width: double.infinity,
height: 22.0,
decoration:
BoxDecoration(
color: Color(
0xff5AB145),
decoration: BoxDecoration(
color: Color(0xff5AB145),
),
child: Center(
child: Texts(
model
.products[
index]
.discountName,
regular:
true,
color: Colors
.white,
fontSize:
12.0,
fontWeight:
FontWeight
.w700,
),
),
),
Texts( projectViewModel.isArabic ? model.products[index].namen : model.products[index].name,
model.products[index].discountName,
regular: true,
color: Colors.white,
fontSize: 12.0,
fontWeight: FontWeight.w700,
),
),
),
Texts(
projectViewModel.isArabic ? model.products[index].namen : model.products[index].name,
// model.products[index].name,
regular: true,
fontSize: 12.58,
fontWeight:
FontWeight
.w600,
fontWeight: FontWeight.w600,
),
Padding(
padding:
const EdgeInsets
.only(
top: 4,
bottom:
4),
padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Texts(
"SAR ${model.products[index].price}",
bold: true,
@ -437,23 +337,34 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
// : 0,
// forceStars:
// true),
RatingBar.readOnly(
initialRating: model.products[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(
initialRating: model.products[index].approvedRatingSum!.toDouble(),
ratingWidget: RatingWidget(
full: Icon(
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(
"(${model.products[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight
.w400,
fontWeight: FontWeight.w400,
)
],
),
@ -472,8 +383,7 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
child: Container(
child: ListView.builder(
itemCount: model.products.length,
itemBuilder: (BuildContext context,
int index) {
itemBuilder: (BuildContext context, int index) {
return Card(
// color:
// model.products[index].discountName !=
@ -486,66 +396,37 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
children: [
Column(
children: [
if (model
.products[
index]
.discountName !=
null)
if (model.products[index].discountName != null)
Container(
decoration:
BoxDecoration(),
decoration: BoxDecoration(),
child: Padding(
padding:
EdgeInsets
.only(
padding: EdgeInsets.only(
left: 9.0,
top: 8.0,
right: 10.0,
),
child:
Container(
color: Colors
.yellow,
child: Container(
color: Colors.yellow,
height: 25.0,
width: 70.0,
child: Center(
child:
Texts(
TranslationBase.of(context).offers
.toUpperCase(),
color: Colors
.red,
fontSize:
13.0,
fontWeight:
FontWeight
.w900,
child: Texts(
TranslationBase.of(context).offers.toUpperCase(),
color: Colors.red,
fontSize: 13.0,
fontWeight: FontWeight.w900,
),
),
),
),
transform: new Matrix4
.rotationZ(
6.15099),
transform: new Matrix4.rotationZ(6.15099),
),
Container(
margin: EdgeInsets
.fromLTRB(
0, 0, 0, 0),
alignment: Alignment
.center,
child:
Image.network(
model
.products[
index]
.images
.isNotEmpty
? model
.products[
index]
.images[0]
.thumb
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
alignment: Alignment.center,
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',
fit: BoxFit.cover,
height: 80,
@ -556,39 +437,21 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
Column(
children: [
Container(
width: model
.products[
index]
.rxMessage !=
null
? MediaQuery.of(
context)
.size
.width /
5
: 0,
padding:
EdgeInsets.all(
4),
decoration:
BoxDecoration(
color: Color(
0xffb23838),
borderRadius: BorderRadius.only(
topLeft: Radius
.circular(
6)),
width: model.products[index].rxMessage != null ? MediaQuery.of(context).size.width / 5 : 0,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
),
child: model.products[index].rxMessage != null
? Texts(
projectProvider.isArabic
? model.products[index].rxMessagen
: model.products[index].rxMessage,
projectProvider.isArabic ? model.products[index].rxMessagen : model.products[index].rxMessage,
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight: FontWeight.w400,
): Texts("")
)
: Texts("")
// Texts(
// model.products[index].rxMessage != null
// ? model.products[index].rxMessage
@ -607,67 +470,48 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
],
),
Container(
margin:
EdgeInsets.symmetric(
margin: EdgeInsets.symmetric(
horizontal: 6,
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (model
.products[index]
.discountName !=
null)
if (model.products[index].discountName != null)
Container(
width: 250.0,
height: 22.5,
decoration:
BoxDecoration(
color: Color(
0xff5AB145),
decoration: BoxDecoration(
color: Color(0xff5AB145),
),
child: Padding(
padding: EdgeInsets
.symmetric(
padding: EdgeInsets.symmetric(
horizontal: 5.5,
),
child: Texts(
model
.products[
index]
.discountName,
model.products[index].discountName,
regular: true,
color: Colors
.white,
color: Colors.white,
fontSize: 12.0,
fontWeight:
FontWeight
.w700,
fontWeight: FontWeight.w700,
),
),
),
SizedBox(
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,
regular: true,
fontSize: 14.0,
fontWeight:
FontWeight.w600,
fontWeight: FontWeight.w600,
),
SizedBox(
height: 8.0,
),
Padding(
padding:
const EdgeInsets
.only(
top: 4,
bottom: 4),
padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Texts(
"SAR ${model.products[index].price}",
bold: true,
@ -689,23 +533,34 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
// : 0,
// forceStars:
// true),
RatingBar.readOnly(
initialRating: model.products[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(
initialRating: model.products[index].approvedRatingSum!.toDouble(),
ratingWidget: RatingWidget(
full: Icon(
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(
"(${model.products[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight
.w500,
fontWeight: FontWeight.w500,
)
],
),
@ -736,7 +591,8 @@ class _OffersCategorisePageState extends State<OffersCategorisePage> {
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(TranslationBase.of(context).noOffersAvailable,
child: Text(
TranslationBase.of(context).noOffersAvailable,
// 'There is no data',
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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:rating_bar/rating_bar.dart';
import 'base/base_view.dart';
class ParentCategorisePage extends StatefulWidget {
String id;
String titleName;
String? id;
String? titleName;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
@ -40,8 +40,8 @@ class ParentCategorisePage extends StatefulWidget {
}
class _ParentCategorisePageState extends State<ParentCategorisePage> {
String id;
String titleName;
String? id;
String? titleName;
final dynamic productID;
_ParentCategorisePageState({
@ -63,8 +63,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
int pageIndex = 1;
List<CategoriseParentModel> entityList =[];
List<CategoriseParentModel> entityListBrands =[];
List<CategoriseParentModel> entityList = [];
List<CategoriseParentModel> entityListBrands = [];
RefreshController controller = RefreshController();
@ -77,9 +77,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategoriseParent(i: id, pageIndex: pageIndex, isLoading: false, context: context),
allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => AppScaffold(
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget? child) => AppScaffold(
isPharmacy: true,
appBarTitle: titleName,
appBarTitle: titleName!,
isBottomBar: true,
isShowAppBar: true,
backgroundColor: Colors.white,
@ -338,10 +338,6 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
entityList.add(history);
});
},
addSelectedHistories: () {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected: (master) => isEntityListSelected(master),
)
],
@ -366,10 +362,6 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
entityListBrands.add(history);
});
},
addSelectedHistories: () {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected: (master) => isEntityListSelectedBrands(master),
)
],
@ -462,7 +454,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
String categoriesId = "";
for (CategoriseParentModel category in entityList) {
if (categoriesId == "") {
categoriesId = category.id;
categoriesId = category.id!;
} else {
categoriesId = "$categoriesId,${category.id}";
}
@ -470,7 +462,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
String brandIds = "";
for (CategoriseParentModel brand in entityListBrands) {
if (brandIds == "") {
brandIds = brand.id;
brandIds = brand.id!;
} else {
brandIds = "$brandIds,${brand.id}";
}
@ -633,8 +625,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
alignment: Alignment.center,
child: Image.network(
model.parentProducts[index].images.isNotEmpty
? model.parentProducts[index].images[0].thumb
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,
@ -736,16 +728,29 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
// ? (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(
initialRating: model.parentProducts[index].approvedRatingSum!.toDouble(),
ratingWidget: RatingWidget(
full: Icon(
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(
"(${model.parentProducts[index].approvedTotalReviews})",
regular: true,
@ -799,9 +804,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Container(
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
alignment: Alignment.center,
child: model.parentProducts[index].images.isNotEmpty
child: model.parentProducts[index].images!.isNotEmpty
? Image.network(
model.parentProducts[index].images[0].thumb,
model.parentProducts[index].images![0].thumb!,
fit: BoxFit.contain,
height: 70,
)
@ -879,16 +884,29 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
// ? (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(
initialRating: model.parentProducts[index].approvedRatingSum!.toDouble(),
ratingWidget: RatingWidget(
full: Icon(
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(
"(${model.parentProducts[index].approvedTotalReviews})",
regular: true,

@ -23,7 +23,7 @@ class PharmacyCategorisePage extends StatefulWidget {
}
class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
String idCategorise;
String? idCategorise;
@override
Widget build(BuildContext context) {
@ -31,9 +31,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategorise(),
allowAny: true,
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
AppScaffold(
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget? child) => AppScaffold(
isShowDecPage: false,
isShowAppBar: false,
isMainPharmacyPages: true,
@ -66,9 +64,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
projectViewModel.isArabic
? model.categorise[index].namen
: model.categorise[index].name,
projectViewModel.isArabic ? model.categorise[index].namen : model.categorise[index].name,
fontWeight: FontWeight.w600,
),
),
@ -99,10 +95,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
height: 140,
child: Column(
children: [
Divider(
height: 2.0,
thickness: 1.0,
color: Colors.black12.withOpacity(0.14)),
Divider(height: 2.0, thickness: 1.0, color: Colors.black12.withOpacity(0.14)),
SizedBox(
height: 10.0,
),
@ -128,16 +121,12 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
width: 55.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.0),
color:
Colors.green.shade300.withOpacity(0.34),
color: Colors.green.shade300.withOpacity(0.34),
),
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 10.0),
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
projectViewModel.isArabic
? 'الاكثر مبيعا'
: 'Best Sellers',
projectViewModel.isArabic ? 'الاكثر مبيعا' : 'Best Sellers',
fontWeight: FontWeight.w600,
),
),
@ -164,17 +153,13 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
height: 50.0,
width: 55.0,
decoration: BoxDecoration(
color: Colors.orangeAccent.shade200
.withOpacity(0.34),
color: Colors.orangeAccent.shade200.withOpacity(0.34),
borderRadius: BorderRadius.circular(5.0),
),
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 10.0),
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
projectViewModel.isArabic
? 'الاكثر مشاهدة'
: 'Most Viewed',
projectViewModel.isArabic ? 'الاكثر مشاهدة' : 'Most Viewed',
fontWeight: FontWeight.w600,
),
),
@ -209,12 +194,9 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
borderRadius: BorderRadius.circular(5.0),
),
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 10.0),
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
projectViewModel.isArabic
? 'منتجات جديدة'
: 'New Products',
projectViewModel.isArabic ? 'منتجات جديدة' : 'New Products',
fontWeight: FontWeight.w600,
),
),
@ -241,17 +223,13 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
height: 50.0,
width: 55.0,
decoration: BoxDecoration(
color:
Colors.purple.shade200.withOpacity(0.34),
color: Colors.purple.shade200.withOpacity(0.34),
borderRadius: BorderRadius.circular(5.0),
),
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 10.0),
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Texts(
projectViewModel.isArabic
? 'شوهد مؤخرا'
: 'Recently Viewed',
projectViewModel.isArabic ? 'شوهد مؤخرا' : 'Recently Viewed',
fontWeight: FontWeight.w600,
),
),
@ -277,7 +255,9 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
/// When give qr we will change this method to get data
/// var result = await BarcodeScanner.scan();
/// 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);
if (data != null) {
var qRParkingID = data['QRParkingID'];
@ -285,7 +265,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else {
AppToast.showSuccessToast(message: model.scanList[0].id);
AppToast.showSuccessToast(message: model.scanList[0].id!);
{
Navigator.push(
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/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/product-detail.dart';
// import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -37,9 +38,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
ProjectViewModel projectProvider = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.clearSearchList(),
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
PharmacyAppScaffold(
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget? child) => PharmacyAppScaffold(
appBarTitle: TranslationBase.of(context).search,
isBottomBar: false,
isShowAppBar: true,
@ -122,8 +121,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
height: MediaQuery.of(context).size.height * 0.80,
child: GridView.builder(
//physics: NeverScrollableScrollPhysics(),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0,
@ -133,11 +131,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
itemBuilder: (BuildContext context, int index) {
return InkWell(
child: Card(
color: model.searchList[index]
.discountName !=
null
? Color(0xffFFFF00)
: Colors.white,
color: model.searchList[index].discountName != null ? Color(0xffFFFF00) : Colors.white,
elevation: 0,
shape: Border(
right: BorderSide(
@ -168,70 +162,38 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
),
color: Colors.white,
),
padding:
EdgeInsets.symmetric(horizontal: 0),
width:
MediaQuery.of(context).size.width /
3,
padding: EdgeInsets.symmetric(horizontal: 0),
width: MediaQuery.of(context).size.width / 3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
children: [
Container(
margin: EdgeInsets.fromLTRB(
0, 16, 0, 0),
margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
alignment: Alignment.center,
child: Image.network(
model.searchList[index]
.images.isNotEmpty
? model
.searchList[index]
.images[0]
.thumb
model.searchList[index].images!.isNotEmpty
? 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',
fit: BoxFit.cover,
height: 80,
),
),
Container(
width: model.searchList[index]
.rxMessage !=
null
? MediaQuery.of(context)
.size
.width /
3
: 0,
width: model.searchList[index].rxMessage != null ? MediaQuery.of(context).size.width / 3 : 0,
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color: Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft:
Radius.circular(
6)),
),
child: model.searchList[index]
.rxMessage !=
null
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
),
child: model.searchList[index].rxMessage != null
? Texts(
projectProvider
.isArabic
? model
.searchList[
index]
.rxMessagen
: model
.searchList[
index]
.rxMessage,
projectProvider.isArabic ? model.searchList[index].rxMessagen : model.searchList[index].rxMessage,
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
fontWeight: FontWeight.w400,
)
: Texts(""),
// Texts(
@ -256,17 +218,10 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
projectProvider.isArabic
? model
.searchList[index]
.namen
: model
.searchList[index]
.name,
projectProvider.isArabic ? model.searchList[index].namen : model.searchList[index].name,
// model.searchList[index].name,
regular: true,
@ -274,9 +229,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
fontWeight: FontWeight.w400,
),
Padding(
padding:
const EdgeInsets.only(
top: 4, bottom: 4),
padding: const EdgeInsets.only(top: 4, bottom: 4),
child: Texts(
"SAR ${model.searchList[index].price}",
bold: true,
@ -286,30 +239,15 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
Row(
children: [
StarRating(
totalAverage: model
.searchList[
index]
.approvedRatingSum >
0
? (model
.searchList[
index]
.approvedRatingSum
.toDouble() /
model
.searchList[
index]
.approvedRatingSum
.toDouble())
.toDouble()
totalAverage: model.searchList[index].approvedRatingSum! > 0
? (model.searchList[index].approvedRatingSum!.toDouble() / model.searchList[index].approvedRatingSum!.toDouble()).toDouble()
: 0,
forceStars: true),
Texts(
"(${model.searchList[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
fontWeight: FontWeight.w400,
)
],
),
@ -324,8 +262,7 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.searchList[index]),
page: ProductDetailPage(model.searchList[index]),
)),
},
);
@ -350,7 +287,6 @@ class _SearchProductsPageState extends State<SearchProductsPage> {
searchMedicine(PharmacyCategoriseViewModel model, BuildContext context) {
Utils.hideKeyboard(context);
if (_formKey.currentState.validate())
model.searchProducts(productName: textController.text);
if (_formKey.currentState!.validate()) model.searchProducts(productName: textController.text);
}
}

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

@ -38,9 +38,6 @@ class CalendarUtils {
else
_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) {
RecurrenceRule recurrenceRule = RecurrenceRule(
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/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
@ -75,7 +76,7 @@ class AppScaffold extends StatefulWidget {
final int? dropdownIndexValue;
List<String>? dropDownList;
final void Function(int?)? dropDownIndexChange;
VoidCallbackAction()? onTap;
VoidCallbackAction? onTap;
final bool isMainPharmacyPages;
final bool extendBody;
final ValueChanged<int>? changeCurrentTab;

Loading…
Cancel
Save