Merge branch 'blood_pressure' into 'development'

parent product and sub product update

See merge request Cloud_Solution/diplomatic-quarter!389
merge-update-with-lab-changes
Mohammad Aljammal 4 years ago
commit cfe9e35c38

File diff suppressed because it is too large Load Diff

@ -23,8 +23,7 @@ class SubCategorisePage extends StatefulWidget {
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> {
@ -52,9 +51,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
TextEditingController maxField = TextEditingController();
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getSubCategorise(i: id),
builder: (BuildContext context, PharmacyCategoriseViewModel model,
Widget child) =>
PharmacyAppScaffold(
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold(
appBarTitle: title,
isBottomBar: false,
isShowAppBar: true,
@ -86,8 +83,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,
@ -99,14 +95,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)
.viewCategorise),
child: Texts(TranslationBase.of(context).viewCategorise),
),
),
Icon(Icons.arrow_forward)
@ -118,30 +112,21 @@ 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),
child: InkWell(
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(model
.subCategorise[
index]
.name),
Texts(model.subCategorise[index].name),
Divider(
thickness: 0.6,
color: Colors.black12,
@ -152,12 +137,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Navigator.push(
context,
FadePage(
page:
FinalProductsPage(
id: model
.subCategorise[
index]
.id,
page: FinalProductsPage(
id: model.subCategorise[index].id,
),
),
);
@ -190,23 +171,19 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
itemCount: model.subCategorise.length,
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(
@ -217,14 +194,8 @@ 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(
model.subCategorise[index].name,
@ -285,21 +256,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(
@ -309,30 +275,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);
},
),
],
@ -345,39 +304,27 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column(
children: [
ExpansionTile(
title: Texts(
TranslationBase.of(
context)
.categorise),
title: Texts(TranslationBase.of(context).categorise),
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:
() {
addSelectedHistories: () {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected:
(master) =>
isEntityListSelected(
master),
isEntityListSelected: (master) =>
isEntityListSelected(master),
)
],
),
@ -386,40 +333,27 @@ 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:
() {
addSelectedHistories: () {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected:
(master) =>
isEntityListSelectedBrands(
master),
isEntityListSelected: (master) =>
isEntityListSelectedBrands(master),
)
],
),
@ -428,69 +362,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(
'Min'),
Texts('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(
'Max'),
Texts('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,
),
),
],
@ -505,31 +413,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(
width: 100,
child: Button(
label: TranslationBase.of(
context)
.reset,
label: TranslationBase.of(context).reset,
// 'Reset',
backgroundColor:
Colors
.red,
backgroundColor: Colors.red,
),
),
),
@ -539,66 +436,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;
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
.toString(),
max: maxField
.text
.toString(),
categoryId:
categoriesId,
brandId:
brandIds);
GifLoaderDialogUtils
.hideDialog(
context);
Navigator.pop(
context);
min: minField.text.toString(),
max: maxField.text.toString(),
categoryId: categoriesId,
brandId: brandIds);
GifLoaderDialogUtils.hideDialog(context);
Navigator.pop(context);
},
label: TranslationBase.of(
context)
.apply,
label: TranslationBase.of(context).apply,
// 'Apply',
backgroundColor:
Colors
.green,
backgroundColor: Colors.green,
),
),
],
@ -662,15 +530,13 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
thickness: 1.0,
color: Colors.grey.shade400,
),
styleOne == true
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,
@ -682,9 +548,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
baseViewModel: model,
child: InkWell(
child: Card(
color: model.subProducts[index]
.discountName !=
null
color: model.subProducts[index].discountName != null
? Color(0xffFFFF00)
: Colors.white,
elevation: 0,
@ -717,77 +581,42 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
),
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 /
5
width: model.subProducts[index].rxMessage != null
? MediaQuery.of(context).size.width / 5
: 0,
padding:
EdgeInsets.all(4),
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color:
Color(0xffb23838),
color: Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(
6)),
BorderRadius.only(topLeft: Radius.circular(6)),
),
child: Texts(
model.subProducts[index]
.rxMessage !=
null
? model
.subProducts[
index]
.rxMessage
model.subProducts[index].rxMessage != null
? model.subProducts[index].rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
fontWeight: FontWeight.w400,
),
),
],
@ -798,24 +627,16 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
vertical: 0,
),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
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,
@ -825,15 +646,11 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Row(
children: [
StarRating(
totalAverage: model
.subProducts[
index]
.approvedRatingSum >
0
totalAverage:
model.subProducts[index].approvedRatingSum > 0
? (model.subProducts[index].approvedRatingSum
.toDouble() /
model
.subProducts[index]
model.subProducts[index]
.approvedRatingSum
.toDouble())
.toDouble()
@ -843,8 +660,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
"(${model.subProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
fontWeight: FontWeight.w400,
)
],
),
@ -859,8 +675,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.subProducts[index]),
page: ProductDetailPage(model.subProducts[index]),
)),
},
));
@ -868,14 +683,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(
@ -885,11 +697,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column(
children: [
Container(
decoration:
BoxDecoration(),
decoration: BoxDecoration(),
child: Padding(
padding:
EdgeInsets.only(
padding: EdgeInsets.only(
left: 9.0,
top: 8.0,
right: 10.0,
@ -897,22 +707,11 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
),
),
Container(
margin:
EdgeInsets.fromLTRB(
0, 0, 0, 0),
alignment:
Alignment.center,
margin: EdgeInsets.fromLTRB(0, 0, 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.contain,
height: 80,
@ -923,42 +722,23 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column(
children: [
Container(
width: model
.subProducts[
index]
.rxMessage !=
null
? MediaQuery.of(
context)
.size
.width /
5
width: model.subProducts[index].rxMessage != null
? MediaQuery.of(context).size.width / 5
: 0,
padding:
EdgeInsets.all(4),
padding: EdgeInsets.all(4),
decoration: BoxDecoration(
color:
Color(0xffb23838),
color: Color(0xffb23838),
borderRadius:
BorderRadius.only(
topLeft: Radius
.circular(
6)),
BorderRadius.only(topLeft: Radius.circular(6)),
),
child: Texts(
model.subProducts[index]
.rxMessage !=
null
? model
.subProducts[
index]
.rxMessage
model.subProducts[index].rxMessage != null
? model.subProducts[index].rxMessage
: "",
color: Colors.white,
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
fontWeight: FontWeight.w400,
),
),
],
@ -972,28 +752,19 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
vertical: 0,
),
child: Column(
mainAxisAlignment:
MainAxisAlignment
.spaceAround,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 4.0,
),
Container(
width:
MediaQuery.of(context)
.size
.width *
0.65,
width: MediaQuery.of(context).size.width * 0.65,
child: Texts(
model.subProducts[index]
.name,
model.subProducts[index].name,
regular: true,
fontSize: 13.2,
fontWeight:
FontWeight.w500,
fontWeight: FontWeight.w500,
maxLines: 5,
),
),
@ -1001,9 +772,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
height: 8.0,
),
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,
@ -1013,20 +782,11 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Row(
children: [
StarRating(
totalAverage: model
.subProducts[
index]
.approvedRatingSum >
0
? (model
.subProducts[
index]
.approvedRatingSum
totalAverage:
model.subProducts[index].approvedRatingSum > 0
? (model.subProducts[index].approvedRatingSum
.toDouble() /
model
.subProducts[
index]
.approvedRatingSum
model.subProducts[index].approvedRatingSum
.toDouble())
.toDouble()
: 0,
@ -1035,8 +795,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
"(${model.subProducts[index].approvedTotalReviews})",
regular: true,
fontSize: 10,
fontWeight:
FontWeight.w400,
fontWeight: FontWeight.w400,
)
],
),
@ -1050,13 +809,40 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Navigator.push(
context,
FadePage(
page: ProductDetailPage(
model.subProducts[index]),
page: ProductDetailPage(model.subProducts[index]),
)),
},
);
}),
)
: Padding(
padding: const EdgeInsets.all(12.0),
child: Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(
'assets/images/new-design/empty_box.png',
width: 100,
height: 100,
fit: BoxFit.cover,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'There is no data',
style: TextStyle(fontSize: 30),
),
)
],
),
),
),
)
],
),
),
@ -1065,8 +851,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;
}
@ -1074,8 +859,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;
}

Loading…
Cancel
Save