Merge branch 'pharmacy' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into enad_pharmacy_merge

merge-requests/227/head
Mohammad Aljammal 4 years ago
commit 6827efc1b6

@ -1,3 +1,4 @@
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/sub_categorise_page.dart'; import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart';
@ -52,9 +53,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
backgroundColor: Colors.white, backgroundColor: Colors.white,
isShowDecPage: false, isShowDecPage: false,
baseViewModel: model, baseViewModel: model,
body: SingleChildScrollView( body: Container(
child: Container( child: ListView(
height: MediaQuery.of(context).size.height * 5.90, scrollDirection: Axis.vertical,
children: [
Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -90,7 +93,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
@ -117,14 +121,16 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
scrollDirection: scrollDirection:
Axis.vertical, Axis.vertical,
itemCount: model itemCount: model
.categoriseParent.length, .categoriseParent
.length,
itemBuilder: itemBuilder:
(BuildContext context, (BuildContext context,
int index) { 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:
@ -136,7 +142,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
index] index]
.name), .name),
Divider( Divider(
thickness: 0.6, thickness:
0.6,
color: Colors color: Colors
.black12, .black12,
) )
@ -149,11 +156,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
builder: builder:
(context) => (context) =>
SubCategorisePage( SubCategorisePage(
title: title: model.categoriseParent[index].name,
model.categoriseParent[index].name,
id: model.categoriseParent[index].id, id: model.categoriseParent[index].id,
parentId: parentId: id,
id,
)), )),
); );
}, },
@ -189,10 +194,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
itemCount: model.categoriseParent.length > 8 itemCount: model.categoriseParent.length > 8
? 8 ? 8
: model.categoriseParent.length, : model.categoriseParent.length,
itemBuilder: (BuildContext context, int index) { itemBuilder:
(BuildContext context, int index) {
return Padding( return Padding(
padding: padding: EdgeInsets.symmetric(
EdgeInsets.symmetric(horizontal: 8.0), horizontal: 8.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
@ -206,7 +212,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
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(
@ -230,10 +237,12 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Texts( child: Texts(
projectViewModel.isArabic projectViewModel.isArabic
? model ? model
.categoriseParent[index] .categoriseParent[
index]
.namen .namen
: model : model
.categoriseParent[index] .categoriseParent[
index]
.name, .name,
fontSize: 13.4, fontSize: 13.4,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -250,10 +259,12 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
builder: (context) => builder: (context) =>
SubCategorisePage( SubCategorisePage(
title: model title: model
.categoriseParent[index] .categoriseParent[
index]
.name, .name,
id: model id: model
.categoriseParent[index] .categoriseParent[
index]
.id, .id,
parentId: id, parentId: id,
)), )),
@ -301,7 +312,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
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(
@ -325,7 +337,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Texts( Texts(
'Refine', 'Refine',
fontWeight: fontWeight:
FontWeight.w600, FontWeight
.w600,
), ),
SizedBox( SizedBox(
width: 250.0, width: 250.0,
@ -333,9 +346,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
InkWell( InkWell(
child: Texts( child: Texts(
'Close', 'Close',
color: Colors.red, color:
Colors.red,
fontWeight: fontWeight:
FontWeight.w600, FontWeight
.w600,
fontSize: 15.0, fontSize: 15.0,
), ),
onTap: () { onTap: () {
@ -353,8 +368,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column( Column(
children: [ children: [
ExpansionTile( ExpansionTile(
title: title: Texts(
Texts('Categorise'), 'Categorise'),
children: [ children: [
Container( Container(
height: 350, height: 350,
@ -371,26 +386,21 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
.categoriseParent .categoriseParent
.length, .length,
itemBuilder: itemBuilder:
(BuildContext (BuildContext context,
context,
int index) { int index) {
return CheckboxListTile( return CheckboxListTile(
tristate: tristate:
true, true,
title: Texts(model title:
.categoriseParent[index] Texts(model.categoriseParent[index].name),
.name),
controlAffinity: controlAffinity:
ListTileControlAffinity.leading, ListTileControlAffinity.leading,
value: value:
checkedCategorise, checkedCategorise,
onChanged: onChanged:
(bool (bool value) {
value) { setState(() {
setState( checkedCategorise = value;
() {
checkedCategorise =
value;
}); });
}, },
); );
@ -400,10 +410,12 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Divider( Divider(
thickness: 1.0, thickness: 1.0,
color: Colors.black12, color:
Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: Texts('Brands'), title:
Texts('Brands'),
children: [ children: [
Container( Container(
height: 350, height: 350,
@ -418,26 +430,21 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
.brandsList .brandsList
.length, .length,
itemBuilder: itemBuilder:
(BuildContext (BuildContext context,
context,
int index) { int index) {
return CheckboxListTile( return CheckboxListTile(
tristate: tristate:
true, true,
title: Texts(model title:
.brandsList[index] Texts(model.brandsList[index].name),
.name),
controlAffinity: controlAffinity:
ListTileControlAffinity.leading, ListTileControlAffinity.leading,
value: value:
checkedBrands, checkedBrands,
onChanged: onChanged:
(bool (bool value) {
value) { setState(() {
setState( checkedBrands = value;
() {
checkedBrands =
value;
}); });
}, },
autofocus: autofocus:
@ -449,10 +456,12 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Divider( Divider(
thickness: 1.0, thickness: 1.0,
color: Colors.black12, color:
Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: Texts('Price'), title:
Texts('Price'),
children: [ children: [
Container( Container(
color: Color( color: Color(
@ -470,8 +479,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Texts( Texts(
'Min'), 'Min'),
Container( Container(
color: Colors color:
.white, Colors.white,
width: width:
200, 200,
height: height:
@ -480,8 +489,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
TextFormField( TextFormField(
decoration: decoration:
InputDecoration( InputDecoration(
border: border: OutlineInputBorder(),
OutlineInputBorder(),
), ),
), ),
), ),
@ -495,8 +503,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Texts( Texts(
'Max'), 'Max'),
Container( Container(
color: Colors color:
.white, Colors.white,
width: width:
200, 200,
height: height:
@ -505,8 +513,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
TextFormField( TextFormField(
decoration: decoration:
InputDecoration( InputDecoration(
border: border: OutlineInputBorder(),
OutlineInputBorder(),
), ),
), ),
), ),
@ -519,7 +526,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Divider( Divider(
thickness: 1.0, thickness: 1.0,
color: Colors.black12, color:
Colors.black12,
), ),
SizedBox( SizedBox(
height: MediaQuery.of( height: MediaQuery.of(
@ -530,7 +538,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Padding( Padding(
padding: padding:
EdgeInsets.all(8.0), EdgeInsets.all(
8.0),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment MainAxisAlignment
@ -539,9 +548,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Container( Container(
width: 100, width: 100,
child: Button( child: Button(
label: 'Reset', label:
'Reset',
backgroundColor: backgroundColor:
Colors.red, Colors
.red,
), ),
), ),
SizedBox( SizedBox(
@ -550,7 +561,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Container( Container(
width: 200, width: 200,
child: Button( child: Button(
label: 'Apply', label:
'Apply',
backgroundColor: backgroundColor:
Colors Colors
.green, .green,
@ -619,7 +631,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
styleOne == true styleOne == true
? Container( ? Container(
height: MediaQuery.of(context).size.height * 4.89, height: SizeConfig.screenHeight * 7.8,
child: GridView.builder( child: GridView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: gridDelegate:
@ -630,7 +642,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
childAspectRatio: 0.9, childAspectRatio: 0.9,
), ),
itemCount: model.parentProducts.length, itemCount: model.parentProducts.length,
itemBuilder: (BuildContext context, int index) { itemBuilder:
(BuildContext context, int index) {
return NetworkBaseView( return NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: Card( child: Card(
@ -665,7 +678,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(110.0), topLeft:
Radius.circular(110.0),
), ),
color: Colors.white, color: Colors.white,
), ),
@ -682,7 +696,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Stack( Stack(
children: [ children: [
if (model if (model
.parentProducts[index] .parentProducts[
index]
.discountName != .discountName !=
null) null)
RotatedBox( RotatedBox(
@ -692,7 +707,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
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,
@ -700,10 +716,12 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Texts( child: Texts(
'offer' 'offer'
.toUpperCase(), .toUpperCase(),
color: Colors.red, color:
Colors.red,
fontSize: 13.0, fontSize: 13.0,
fontWeight: fontWeight:
FontWeight.w900, FontWeight
.w900,
), ),
), ),
transform: new Matrix4 transform: new Matrix4
@ -712,9 +730,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
), ),
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 model
.parentProducts[ .parentProducts[
@ -737,18 +757,23 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
index] index]
.rxMessage != .rxMessage !=
null null
? MediaQuery.of(context) ? MediaQuery.of(
context)
.size .size
.width / .width /
5 5
: 0, : 0,
padding: EdgeInsets.all(4), padding:
decoration: BoxDecoration( EdgeInsets.all(4),
color: Color(0xffb23838), decoration:
BoxDecoration(
color:
Color(0xffb23838),
borderRadius: borderRadius:
BorderRadius.only( BorderRadius.only(
topLeft: Radius topLeft: Radius
.circular(6)), .circular(
6)),
), ),
child: Texts( child: Texts(
model model
@ -771,13 +796,15 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
], ],
), ),
Container( Container(
margin: EdgeInsets.symmetric( margin:
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
.parentProducts[ .parentProducts[
@ -785,12 +812,13 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
.discountName != .discountName !=
null) null)
Container( Container(
width: double.infinity, width:
double.infinity,
height: 13.0, height: 13.0,
decoration: decoration:
BoxDecoration( BoxDecoration(
color: color: Color(
Color(0xff5AB145), 0xff5AB145),
), ),
child: Center( child: Center(
child: Texts( child: Texts(
@ -799,14 +827,16 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
index] index]
.discountName, .discountName,
regular: true, regular: true,
color: Colors.white, color: Colors
.white,
fontSize: 10.4, fontSize: 10.4,
), ),
), ),
), ),
Texts( Texts(
model model
.parentProducts[index] .parentProducts[
index]
.name, .name,
regular: true, regular: true,
fontSize: 12, fontSize: 12,
@ -815,7 +845,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Padding( Padding(
padding: padding:
const EdgeInsets.only( const EdgeInsets
.only(
top: 4, top: 4,
bottom: 4), bottom: 4),
child: Texts( child: Texts(
@ -832,21 +863,20 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
index] index]
.approvedRatingSum > .approvedRatingSum >
0 0
? (model.parentProducts[index].approvedRatingSum ? (model.parentProducts[index].approvedRatingSum.toDouble() /
.toDouble() / model.parentProducts[index].approvedRatingSum
model
.parentProducts[index]
.approvedRatingSum
.toDouble()) .toDouble())
.toDouble() .toDouble()
: 0, : 0,
forceStars: true), forceStars:
true),
Texts( Texts(
"(${model.parentProducts[index].approvedTotalReviews})", "(${model.parentProducts[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight:
FontWeight.w400, FontWeight
.w400,
) )
], ],
), ),
@ -861,7 +891,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
) )
: Container( : Container(
height: MediaQuery.of(context).size.height * 5.0, height:
MediaQuery.of(context).size.height * 5.0,
child: ListView.builder( child: ListView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: model.parentProducts.length, itemCount: model.parentProducts.length,
@ -875,9 +906,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column( Column(
children: [ children: [
Container( Container(
decoration: BoxDecoration(), decoration:
BoxDecoration(),
child: Padding( child: Padding(
padding: EdgeInsets.only( padding:
EdgeInsets.only(
left: 9.0, left: 9.0,
top: 8.0, top: 8.0,
right: 10.0, right: 10.0,
@ -885,9 +918,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB( margin:
EdgeInsets.fromLTRB(
0, 0, 0, 0), 0, 0, 0, 0),
alignment: Alignment.center, alignment:
Alignment.center,
child: Image.network( child: Image.network(
model model
.parentProducts[ .parentProducts[
@ -914,18 +949,23 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
index] index]
.rxMessage != .rxMessage !=
null null
? MediaQuery.of(context) ? MediaQuery.of(
context)
.size .size
.width / .width /
5 5
: 0, : 0,
padding: EdgeInsets.all(4), padding:
decoration: BoxDecoration( EdgeInsets.all(4),
color: Color(0xffb23838), decoration:
BoxDecoration(
color:
Color(0xffb23838),
borderRadius: borderRadius:
BorderRadius.only( BorderRadius.only(
topLeft: Radius topLeft: Radius
.circular(6)), .circular(
6)),
), ),
child: Texts( child: Texts(
model model
@ -957,7 +997,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
child: Column( child: Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceAround, MainAxisAlignment
.spaceAround,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
@ -965,11 +1006,13 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
height: 4.0, height: 4.0,
), ),
Texts( Texts(
model.parentProducts[index] model
.parentProducts[index]
.name, .name,
regular: true, regular: true,
fontSize: 13.2, fontSize: 13.2,
fontWeight: FontWeight.w500, fontWeight:
FontWeight.w500,
maxLines: 5, maxLines: 5,
), ),
SizedBox( SizedBox(
@ -978,7 +1021,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Padding( Padding(
padding: padding:
const EdgeInsets.only( const EdgeInsets.only(
top: 4, bottom: 4), top: 4,
bottom: 4),
child: Texts( child: Texts(
"SAR ${model.parentProducts[index].price}", "SAR ${model.parentProducts[index].price}",
bold: true, bold: true,
@ -993,14 +1037,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
index] index]
.approvedRatingSum > .approvedRatingSum >
0 0
? (model ? (model.parentProducts[index].approvedRatingSum
.parentProducts[
index]
.approvedRatingSum
.toDouble() / .toDouble() /
model model
.parentProducts[ .parentProducts[index]
index]
.approvedRatingSum .approvedRatingSum
.toDouble()) .toDouble())
.toDouble() .toDouble()
@ -1026,6 +1066,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
], ],
), ),
), ),
],
),
), ),
)); ));
} }

Loading…
Cancel
Save