daynimic listing

merge-requests/279/head
hussam al-habibeh 4 years ago
parent 299a1bed25
commit 2723422bbf

@ -4,29 +4,29 @@ import 'PharmacyImageObject.dart';
import 'Reviews.dart'; import 'Reviews.dart';
class PharmacyProduct { class PharmacyProduct {
String id; dynamic id;
bool visibleIndividually; bool visibleIndividually;
String name; dynamic name;
String namen; dynamic namen;
String shortDescription; dynamic shortDescription;
String shortDescriptionn; dynamic shortDescriptionn;
String fullDescription; dynamic fullDescription;
String fullDescriptionn; dynamic fullDescriptionn;
bool markasNew; bool markasNew;
bool showOnHomePage; bool showOnHomePage;
String metaKeywords; dynamic metaKeywords;
String metaDescription; dynamic metaDescription;
String metaTitle; dynamic metaTitle;
bool allowCustomerReviews; bool allowCustomerReviews;
int approvedRatingSum; int approvedRatingSum;
int notApprovedRatingSum; int notApprovedRatingSum;
int approvedTotalReviews; int approvedTotalReviews;
int notApprovedTotalReviews; int notApprovedTotalReviews;
String sku; dynamic sku;
bool isRx; bool isRx;
bool prescriptionRequired; bool prescriptionRequired;
String rxMessage; dynamic rxMessage;
String rxMessagen; dynamic rxMessagen;
String manufacturerPartNumber; String manufacturerPartNumber;
String gtin; String gtin;
bool isGiftCard; bool isGiftCard;
@ -115,7 +115,6 @@ class PharmacyProduct {
int vendorId; int vendorId;
String seName; String seName;
PharmacyProduct( PharmacyProduct(
{this.id, {this.id,
this.visibleIndividually, this.visibleIndividually,

@ -112,7 +112,7 @@ class PharmacyCategoriseService extends BaseService {
); );
} }
Future getBrands() async { Future getBrands({String id}) async {
hasError = false; hasError = false;
_brandsList.clear(); _brandsList.clear();
await baseAppClient.getPharmacy( await baseAppClient.getPharmacy(

@ -55,11 +55,11 @@ class PharmacyCategoriseViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getBrands() async { Future getBrands({String id}) async {
hasError = false; hasError = false;
// _insuranceCardService.clearInsuranceCard(); // _insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy); setState(ViewState.Busy);
await _pharmacyCategoriseService.getBrands(); await _pharmacyCategoriseService.getBrands(id: id);
if (_pharmacyCategoriseService.hasError) { if (_pharmacyCategoriseService.hasError) {
error = _pharmacyCategoriseService.error; error = _pharmacyCategoriseService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
@ -105,7 +105,7 @@ class PharmacyCategoriseViewModel extends BaseViewModel {
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else } else
await getParentProducts(i: i); await getParentProducts(i: i);
await getBrands(); await getBrands(id: i);
} }
Future getParentProducts({String i}) async { Future getParentProducts({String i}) async {

@ -1,4 +1,5 @@
import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
@ -7,6 +8,7 @@ import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/entity_checkbox_list.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -42,7 +44,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
color: Colors.blue, color: Colors.blue,
size: 29.0, size: 29.0,
); );
List<CategoriseParentModel> entityList = List();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
@ -57,11 +59,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
backgroundColor: Colors.white, backgroundColor: Colors.white,
isShowDecPage: false, isShowDecPage: false,
baseViewModel: model, baseViewModel: model,
body: Container( body: SingleChildScrollView(
child: ListView( child: Container(
scrollDirection: Axis.vertical,
children: [
Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -97,8 +96,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
@ -125,16 +123,14 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
scrollDirection: scrollDirection:
Axis.vertical, Axis.vertical,
itemCount: model itemCount: model
.categoriseParent .categoriseParent.length,
.length,
itemBuilder: itemBuilder:
(BuildContext context, (BuildContext context,
int index) { int index) {
return Container( return Container(
child: Padding( child: Padding(
padding: padding:
EdgeInsets.all( EdgeInsets.all(4.0),
4.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
@ -146,8 +142,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
index] index]
.name), .name),
Divider( Divider(
thickness: thickness: 0.6,
0.6,
color: Colors color: Colors
.black12, .black12,
) )
@ -167,8 +162,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
.categoriseParent[ .categoriseParent[
index] index]
.id, .id,
parentId: parentId: id,
id,
)), )),
); );
}, },
@ -204,11 +198,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
itemCount: model.categoriseParent.length > 8 itemCount: model.categoriseParent.length > 8
? 8 ? 8
: model.categoriseParent.length, : model.categoriseParent.length,
itemBuilder: itemBuilder: (BuildContext context, int index) {
(BuildContext context, int index) {
return Padding( return Padding(
padding: EdgeInsets.symmetric( padding:
horizontal: 8.0), EdgeInsets.symmetric(horizontal: 8.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment:
@ -222,8 +215,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
width: 65.0, width: 65.0,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors color: Colors.orange.shade200
.orange.shade200
.withOpacity(0.45), .withOpacity(0.45),
), ),
child: Center( child: Center(
@ -247,12 +239,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Texts( child: Texts(
projectViewModel.isArabic projectViewModel.isArabic
? model ? model
.categoriseParent[ .categoriseParent[index]
index]
.namen .namen
: model : model
.categoriseParent[ .categoriseParent[index]
index]
.name, .name,
fontSize: 13.4, fontSize: 13.4,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -268,8 +258,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
FadePage( FadePage(
page: SubCategorisePage( page: SubCategorisePage(
title: model title: model
.categoriseParent[index] .categoriseParent[index].name,
.name,
id: model id: model
.categoriseParent[index].id, .categoriseParent[index].id,
parentId: id, parentId: id,
@ -318,11 +307,11 @@ 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(
color: Colors.white,
height: MediaQuery.of(context) height: MediaQuery.of(context)
.size .size
.height * .height *
@ -343,8 +332,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Texts( Texts(
'Refine', 'Refine',
fontWeight: fontWeight:
FontWeight FontWeight.w600,
.w600,
), ),
SizedBox( SizedBox(
width: 250.0, width: 250.0,
@ -352,11 +340,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
InkWell( InkWell(
child: Texts( child: Texts(
'Close', 'Close',
color: color: Colors.red,
Colors.red,
fontWeight: fontWeight:
FontWeight FontWeight.w600,
.w600,
fontSize: 15.0, fontSize: 15.0,
), ),
onTap: () { onTap: () {
@ -374,54 +360,46 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column( Column(
children: [ children: [
ExpansionTile( ExpansionTile(
title: Texts(
'Categorise'),
children: [
Container(
height: 350,
child: ListView
.builder(
controller:
scrollController,
scrollDirection:
Axis
.vertical,
shrinkWrap:
true,
itemCount: model
.categoriseParent
.length,
itemBuilder:
(BuildContext context,
int index) {
return CheckboxListTile(
tristate:
true,
title: title:
Texts(model.categoriseParent[index].name), Texts('Categorise'),
controlAffinity: children: [
ListTileControlAffinity.leading, ProcedureListWidget(
value: model: model,
checkedCategorise, masterList: model
onChanged: .categoriseParent,
(bool value) { removeHistory:
(item) {
setState(() { setState(() {
checkedCategorise = value; entityList
.remove(
item);
}); });
}, },
); addHistory:
}), (history) {
setState(() {
entityList.add(
history);
});
},
addSelectedHistories:
() {
//TODO build your fun herr
// widget.addSelectedHistories();
},
isEntityListSelected:
(master) =>
isEntityListSelected(
master),
) )
], ],
), ),
Divider( Divider(
thickness: 1.0, thickness: 1.0,
color: color: Colors.black12,
Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: title: Texts('Brands'),
Texts('Brands'),
children: [ children: [
Container( Container(
height: 350, height: 350,
@ -436,21 +414,26 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
.brandsList .brandsList
.length, .length,
itemBuilder: itemBuilder:
(BuildContext context, (BuildContext
context,
int index) { int index) {
return CheckboxListTile( return CheckboxListTile(
tristate: tristate:
true, true,
title: title: Texts(model
Texts(model.brandsList[index].name), .brandsList[index]
.name),
controlAffinity: controlAffinity:
ListTileControlAffinity.leading, ListTileControlAffinity.leading,
value: value:
checkedBrands, checkedBrands,
onChanged: onChanged:
(bool value) { (bool
setState(() { value) {
checkedBrands = value; setState(
() {
checkedBrands =
value;
}); });
}, },
autofocus: autofocus:
@ -462,12 +445,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Divider( Divider(
thickness: 1.0, thickness: 1.0,
color: color: Colors.black12,
Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: title: Texts('Price'),
Texts('Price'),
children: [ children: [
Container( Container(
color: Color( color: Color(
@ -485,8 +466,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Texts( Texts(
'Min'), 'Min'),
Container( Container(
color: color: Colors
Colors.white, .white,
width: width:
200, 200,
height: height:
@ -495,7 +476,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
TextFormField( TextFormField(
decoration: decoration:
InputDecoration( InputDecoration(
border: OutlineInputBorder(), border:
OutlineInputBorder(),
), ),
), ),
), ),
@ -509,8 +491,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Texts( Texts(
'Max'), 'Max'),
Container( Container(
color: color: Colors
Colors.white, .white,
width: width:
200, 200,
height: height:
@ -519,7 +501,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
TextFormField( TextFormField(
decoration: decoration:
InputDecoration( InputDecoration(
border: OutlineInputBorder(), border:
OutlineInputBorder(),
), ),
), ),
), ),
@ -532,8 +515,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Divider( Divider(
thickness: 1.0, thickness: 1.0,
color: color: Colors.black12,
Colors.black12,
), ),
SizedBox( SizedBox(
height: MediaQuery.of( height: MediaQuery.of(
@ -544,8 +526,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Padding( Padding(
padding: padding:
EdgeInsets.all( EdgeInsets.all(8.0),
8.0),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment MainAxisAlignment
@ -554,11 +535,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Container( Container(
width: 100, width: 100,
child: Button( child: Button(
label: label: 'Reset',
'Reset',
backgroundColor: backgroundColor:
Colors Colors.red,
.red,
), ),
), ),
SizedBox( SizedBox(
@ -567,8 +546,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Container( Container(
width: 200, width: 200,
child: Button( child: Button(
label: label: 'Apply',
'Apply',
backgroundColor: backgroundColor:
Colors Colors
.green, .green,
@ -637,7 +615,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
styleOne == true styleOne == true
? Container( ? Container(
height: SizeConfig.screenHeight * 7.8, height: model.parentProducts.length *
MediaQuery.of(context).size.height *
0.15,
child: GridView.builder( child: GridView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: gridDelegate:
@ -648,8 +628,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
childAspectRatio: 0.9, childAspectRatio: 0.9,
), ),
itemCount: model.parentProducts.length, itemCount: model.parentProducts.length,
itemBuilder: itemBuilder: (BuildContext context, int index) {
(BuildContext context, int index) {
return NetworkBaseView( return NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: InkWell( child: InkWell(
@ -684,10 +663,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius: BorderRadius.only(
BorderRadius.only( topLeft: Radius.circular(110.0),
topLeft:
Radius.circular(110.0),
), ),
color: Colors.white, color: Colors.white,
), ),
@ -715,8 +692,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
BoxDecoration(), BoxDecoration(),
child: Padding( child: Padding(
padding: padding:
EdgeInsets EdgeInsets.only(
.only(
right: 5.0, right: 5.0,
top: 20.0, top: 20.0,
bottom: 5.0, bottom: 5.0,
@ -724,10 +700,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Texts( child: Texts(
'offer' 'offer'
.toUpperCase(), .toUpperCase(),
color: Colors color: Colors.red,
.red, fontSize: 13.0,
fontSize:
13.0,
fontWeight: fontWeight:
FontWeight FontWeight
.w900, .w900,
@ -739,8 +713,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
), ),
Container( Container(
margin: EdgeInsets margin:
.fromLTRB( EdgeInsets.fromLTRB(
0, 16, 0, 0), 0, 16, 0, 0),
alignment: alignment:
Alignment.center, Alignment.center,
@ -774,10 +748,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
: 0, : 0,
padding: padding:
EdgeInsets.all(4), EdgeInsets.all(4),
decoration: decoration: BoxDecoration(
BoxDecoration( color:
color: Color( Color(0xffb23838),
0xffb23838),
borderRadius: borderRadius:
BorderRadius.only( BorderRadius.only(
topLeft: Radius topLeft: Radius
@ -805,8 +778,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
], ],
), ),
Container( Container(
margin: margin: EdgeInsets.symmetric(
EdgeInsets.symmetric(
horizontal: 6, horizontal: 6,
vertical: 0, vertical: 0,
), ),
@ -821,8 +793,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
.discountName != .discountName !=
null) null)
Container( Container(
width: double width:
.infinity, double.infinity,
height: 13.0, height: 13.0,
decoration: decoration:
BoxDecoration( BoxDecoration(
@ -836,10 +808,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
index] index]
.discountName, .discountName,
regular: true, regular: true,
color: Colors color:
.white, Colors.white,
fontSize: fontSize: 10.4,
10.4,
), ),
), ),
), ),
@ -873,20 +844,21 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
index] index]
.approvedRatingSum > .approvedRatingSum >
0 0
? (model.parentProducts[index].approvedRatingSum.toDouble() / ? (model.parentProducts[index].approvedRatingSum
model.parentProducts[index].approvedRatingSum .toDouble() /
model
.parentProducts[index]
.approvedRatingSum
.toDouble()) .toDouble())
.toDouble() .toDouble()
: 0, : 0,
forceStars: forceStars: true),
true),
Texts( Texts(
"(${model.parentProducts[index].approvedTotalReviews})", "(${model.parentProducts[index].approvedTotalReviews})",
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight:
FontWeight FontWeight.w400,
.w400,
) )
], ],
), ),
@ -901,9 +873,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: ProductDetailPage( page: ProductDetailPage(model
model.parentProducts[ .parentProducts[index]),
index]),
)), )),
}, },
)); ));
@ -911,8 +882,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
) )
: Container( : Container(
height: height: model.parentProducts.length *
MediaQuery.of(context).size.height * 5.0, MediaQuery.of(context).size.height *
0.122,
child: ListView.builder( child: ListView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: model.parentProducts.length, itemCount: model.parentProducts.length,
@ -939,8 +911,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
), ),
Container( Container(
margin: EdgeInsets margin:
.fromLTRB( EdgeInsets.fromLTRB(
0, 0, 0, 0), 0, 0, 0, 0),
alignment: alignment:
Alignment.center, Alignment.center,
@ -978,17 +950,15 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
: 0, : 0,
padding: padding:
EdgeInsets.all(4), EdgeInsets.all(4),
decoration: decoration: BoxDecoration(
BoxDecoration( color:
color: Color( Color(0xffb23838),
0xffb23838),
borderRadius: borderRadius:
BorderRadius.only( BorderRadius.only(
topLeft: Radius topLeft: Radius
.circular( .circular(
6)), 6)),
), ),
child: Expanded(
child: Texts( child: Texts(
model model
.parentProducts[ .parentProducts[
@ -1000,14 +970,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
index] index]
.rxMessage .rxMessage
: "", : "",
color: color: Colors.white,
Colors.white,
regular: true, regular: true,
fontSize: 10, fontSize: 10,
fontWeight: fontWeight:
FontWeight FontWeight.w400,
.w400,
),
), ),
), ),
], ],
@ -1024,22 +991,20 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
MainAxisAlignment MainAxisAlignment
.spaceAround, .spaceAround,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment CrossAxisAlignment.start,
.start,
children: [ children: [
SizedBox( SizedBox(
height: 4.0, height: 4.0,
), ),
Container( Container(
width: MediaQuery.of( width:
context) MediaQuery.of(context)
.size .size
.width * .width *
0.65, 0.65,
child: Texts( child: Texts(
model model
.parentProducts[ .parentProducts[index]
index]
.name, .name,
regular: true, regular: true,
fontSize: 13.2, fontSize: 13.2,
@ -1053,10 +1018,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Padding( Padding(
padding: padding:
const EdgeInsets const EdgeInsets.only(
.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,
@ -1071,10 +1034,14 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
index] index]
.approvedRatingSum > .approvedRatingSum >
0 0
? (model.parentProducts[index].approvedRatingSum ? (model
.parentProducts[
index]
.approvedRatingSum
.toDouble() / .toDouble() /
model model
.parentProducts[index] .parentProducts[
index]
.approvedRatingSum .approvedRatingSum
.toDouble()) .toDouble())
.toDouble() .toDouble()
@ -1099,8 +1066,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: ProductDetailPage(model page: ProductDetailPage(
.parentProducts[index]), model.parentProducts[index]),
)), )),
}, },
); );
@ -1109,9 +1076,16 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
], ],
), ),
), ),
],
),
), ),
)); ));
} }
bool isEntityListSelected(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history =
entityList.where((element) => masterKey.id == element.id);
if (history.length > 0) {
return true;
}
return false;
}
} }

@ -56,7 +56,6 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
baseViewModel: model, baseViewModel: model,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 5.97,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -596,7 +595,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
styleOne == true styleOne == true
? Container( ? Container(
height: MediaQuery.of(context).size.height * 3.85, height: model.subProducts.length *
MediaQuery.of(context).size.height *
0.15,
child: GridView.builder( child: GridView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: gridDelegate:
@ -604,7 +605,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
crossAxisCount: 2, crossAxisCount: 2,
crossAxisSpacing: 0.5, crossAxisSpacing: 0.5,
mainAxisSpacing: 2.0, mainAxisSpacing: 2.0,
childAspectRatio: 1.0, childAspectRatio: 0.9,
), ),
itemCount: model.subProducts.length, itemCount: model.subProducts.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
@ -798,7 +799,9 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
) )
: Container( : Container(
height: MediaQuery.of(context).size.height * 5.0, height: model.subProducts.length *
MediaQuery.of(context).size.height *
0.122,
child: ListView.builder( child: ListView.builder(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: model.subProducts.length, itemCount: model.subProducts.length,

@ -0,0 +1,170 @@
import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ProcedureListWidget extends StatefulWidget {
final PharmacyCategoriseViewModel model;
final Function addSelectedHistories;
final Function(CategoriseParentModel) removeHistory;
final Function(CategoriseParentModel) addHistory;
final Function(CategoriseParentModel) addRemarks;
final bool Function(CategoriseParentModel) isEntityListSelected;
final List<CategoriseParentModel> masterList;
ProcedureListWidget(
{Key key,
this.model,
this.addSelectedHistories,
this.removeHistory,
this.masterList,
this.addHistory,
this.isEntityListSelected,
this.addRemarks})
: super(key: key);
@override
_ProcedureListWidgetState createState() => _ProcedureListWidgetState();
}
class _ProcedureListWidgetState extends State<ProcedureListWidget> {
int selectedType = 0;
int typeUrgent;
int typeRegular;
setSelectedType(int val) {
setState(() {
selectedType = val;
});
}
List<CategoriseParentModel> items = List();
List<String> remarksList = List();
List<int> typeList = List();
@override
void initState() {
items.addAll(widget.masterList);
super.initState();
}
TextEditingController remarksController = TextEditingController();
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: [
NetworkBaseView(
baseViewModel: widget.model,
child: Container(
height: MediaQuery.of(context).size.height * 0.35,
child: Center(
child: Container(
margin: EdgeInsets.only(top: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.white),
child: ListView(
children: [
// TextFields(
// hintText:
// 'sss', //TranslationBase.of(context).searchProcedures,
// suffixIcon: EvaIcons.search,
// onChanged: (value) {
// filterSearchResults(value);
// },
// ),
SizedBox(
height: 15,
),
items.length != 0
? Column(
children: items.map((historyInfo) {
return Column(
children: [
Row(
children: [
Checkbox(
value: widget.isEntityListSelected(
historyInfo),
activeColor: Colors.red[800],
onChanged: (bool newValue) {
setState(() {
if (widget.isEntityListSelected(
historyInfo)) {
widget
.removeHistory(historyInfo);
} else {
widget.addHistory(historyInfo);
}
});
}),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0),
child: Texts(historyInfo.name,
variant: "bodyText",
bold: true,
color: Colors.black),
),
),
],
),
Divider(
height: 1,
),
],
);
}).toList(),
)
: Center(
child: Container(
child: AppText(
"There's no procedures for this category",
color: Color(0xFFB9382C)),
),
)
],
),
)),
),
),
SizedBox(
height: 10,
),
],
),
);
}
void filterSearchResults(String query) {
List<CategoriseParentModel> dummySearchList = List();
dummySearchList.addAll(widget.masterList);
if (query.isNotEmpty) {
List<CategoriseParentModel> dummyListData = List();
dummySearchList.forEach((item) {
if (item.name.toLowerCase().contains(query.toLowerCase())) {
dummyListData.add(item);
}
});
setState(() {
items.clear();
items.addAll(dummyListData);
});
return;
} else {
setState(() {
items.clear();
items.addAll(widget.masterList);
});
}
}
}
Loading…
Cancel
Save