parent product and sub product update

merge-update-with-lab-changes
hussam al-habibeh 4 years ago
parent f1c2dbbbfc
commit e4d54f0c0b

@ -26,8 +26,7 @@ class ParentCategorisePage extends StatefulWidget {
ParentCategorisePage({this.id, this.titleName}); ParentCategorisePage({this.id, this.titleName});
@override @override
_ParentCategorisePageState createState() => _ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName);
_ParentCategorisePageState(id: id, titleName: titleName);
} }
class _ParentCategorisePageState extends State<ParentCategorisePage> { class _ParentCategorisePageState extends State<ParentCategorisePage> {
@ -58,9 +57,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategoriseParent(i: id), onModelReady: (model) => model.getCategoriseParent(i: id),
builder: (BuildContext context, PharmacyCategoriseViewModel model, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold(
Widget child) =>
PharmacyAppScaffold(
appBarTitle: titleName, appBarTitle: titleName,
isBottomBar: false, isBottomBar: false,
isShowAppBar: true, isShowAppBar: true,
@ -111,8 +108,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: InkWell( child: InkWell(
child: Container( child: Container(
child: Texts( child: Texts(
TranslationBase.of(context) TranslationBase.of(context).viewCategorise,
.viewCategorise,
// 'View All Categories', // 'View All Categories',
fontWeight: FontWeight.w300, fontWeight: FontWeight.w300,
), ),
@ -130,37 +126,22 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
color: Colors.white, color: Colors.white,
child: Center( child: Center(
child: ListView.builder( child: ListView.builder(
scrollDirection: scrollDirection: Axis.vertical,
Axis.vertical, itemCount: model.categoriseParent.length,
itemCount: model itemBuilder: (BuildContext context, int index) {
.categoriseParent.length,
itemBuilder:
(BuildContext context,
int index) {
return Container( return Container(
child: Padding( child: Padding(
padding: padding: EdgeInsets.all(4.0),
EdgeInsets.all(4.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [ children: [
Texts(projectViewModel Texts(projectViewModel.isArabic
.isArabic ? model.categoriseParent[index].namen
? model : model.categoriseParent[index].name),
.categoriseParent[
index]
.namen
: model
.categoriseParent[
index]
.name),
Divider( Divider(
thickness: 0.6, thickness: 0.6,
color: Colors color: Colors.black12,
.black12,
) )
], ],
), ),
@ -168,16 +149,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: page: SubCategorisePage(
SubCategorisePage( title: model.categoriseParent[index].name,
title: model id: model.categoriseParent[index].id,
.categoriseParent[
index]
.name,
id: model
.categoriseParent[
index]
.id,
parentId: id, parentId: id,
)), )),
); );
@ -211,28 +185,22 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
child: Center( child: Center(
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: model.categoriseParent.length > 8 itemCount: model.categoriseParent.length > 8 ? 8 : model.categoriseParent.length,
? 8
: model.categoriseParent.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Padding( return Padding(
padding: padding: EdgeInsets.symmetric(horizontal: 8.0),
EdgeInsets.symmetric(horizontal: 8.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(horizontal: 13.0),
horizontal: 13.0),
child: Container( child: Container(
height: 60.0, height: 60.0,
width: 65.0, width: 65.0,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.orange.shade200 color: Colors.orange.shade200.withOpacity(0.45),
.withOpacity(0.45),
), ),
child: Center( child: Center(
child: Icon( child: Icon(
@ -266,10 +234,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
context, context,
FadePage( FadePage(
page: SubCategorisePage( page: SubCategorisePage(
title: model title: model.categoriseParent[index].name,
.categoriseParent[index].name, id: model.categoriseParent[index].id,
id: model
.categoriseParent[index].id,
parentId: id, parentId: id,
)), )),
); );
@ -315,21 +281,16 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
initialChildSize: 0.95, initialChildSize: 0.95,
maxChildSize: 0.95, maxChildSize: 0.95,
minChildSize: 0.9, minChildSize: 0.9,
builder: (BuildContext context, builder: (BuildContext context, ScrollController scrollController) {
ScrollController scrollController) {
return SingleChildScrollView( return SingleChildScrollView(
controller: scrollController, controller: scrollController,
child: Container( child: Container(
color: Colors.white, color: Colors.white,
height: MediaQuery.of(context) height: MediaQuery.of(context).size.height * 1.95,
.size
.height *
1.95,
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: padding: EdgeInsets.all(8.0),
EdgeInsets.all(8.0),
child: Row( child: Row(
children: [ children: [
Icon( Icon(
@ -340,8 +301,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
Texts( Texts(
'Refine', 'Refine',
fontWeight: fontWeight: FontWeight.w600,
FontWeight.w600,
), ),
SizedBox( SizedBox(
width: 250.0, width: 250.0,
@ -350,13 +310,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
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: () {
Navigator.pop( Navigator.pop(context);
context);
}, },
), ),
], ],
@ -369,37 +327,27 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Column( Column(
children: [ children: [
ExpansionTile( ExpansionTile(
title: title: Texts('Categorise'),
Texts('Categorise'),
children: [ children: [
ProcedureListWidget( ProcedureListWidget(
model: model, model: model,
masterList: model masterList: model.categoriseParent,
.categoriseParent, removeHistory: (item) {
removeHistory:
(item) {
setState(() { setState(() {
entityList entityList.remove(item);
.remove(
item);
}); });
}, },
addHistory: addHistory: (history) {
(history) {
setState(() { setState(() {
entityList.add( entityList.add(history);
history);
}); });
}, },
addSelectedHistories: addSelectedHistories: () {
() {
//TODO build your fun herr //TODO build your fun herr
// widget.addSelectedHistories(); // widget.addSelectedHistories();
}, },
isEntityListSelected: isEntityListSelected: (master) =>
(master) => isEntityListSelected(master),
isEntityListSelected(
master),
) )
], ],
), ),
@ -412,33 +360,23 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
children: [ children: [
ProcedureListWidget( ProcedureListWidget(
model: model, model: model,
masterList: model masterList: model.brandsList,
.brandsList, removeHistory: (item) {
removeHistory:
(item) {
setState(() { setState(() {
entityListBrands entityListBrands.remove(item);
.remove(
item);
}); });
}, },
addHistory: addHistory: (history) {
(history) {
setState(() { setState(() {
entityListBrands entityListBrands.add(history);
.add(
history);
}); });
}, },
addSelectedHistories: addSelectedHistories: () {
() {
//TODO build your fun herr //TODO build your fun herr
// widget.addSelectedHistories(); // widget.addSelectedHistories();
}, },
isEntityListSelected: isEntityListSelected: (master) =>
(master) => isEntityListSelectedBrands(master),
isEntityListSelectedBrands(
master),
) )
], ],
), ),
@ -450,63 +388,40 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
title: Texts('Price'), title: Texts('Price'),
children: [ children: [
Container( Container(
color: Color( color: Color(0xffEEEEEE),
0xffEEEEEE),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceAround,
MainAxisAlignment
.spaceAround,
children: [ children: [
Column( Column(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment
.start,
children: [ children: [
Texts( Texts('Min'),
'Min'),
Container( Container(
color: Colors color: Colors.white,
.white, width: 200,
width: height: 40,
200, child: TextFormField(
height: decoration: InputDecoration(
40, border: OutlineInputBorder(),
child:
TextFormField(
decoration:
InputDecoration(
border:
OutlineInputBorder(),
), ),
controller: controller: minField,
minField,
), ),
), ),
], ],
), ),
Column( Column(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment
.start,
children: [ children: [
Texts( Texts('Max'),
'Max'),
Container( Container(
color: Colors color: Colors.white,
.white, width: 200,
width: height: 40,
200, child: TextFormField(
height: decoration: InputDecoration(
40, border: OutlineInputBorder(),
child:
TextFormField(
decoration:
InputDecoration(
border:
OutlineInputBorder(),
), ),
controller: controller: maxField,
maxField,
), ),
), ),
], ],
@ -521,26 +436,18 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
SizedBox( SizedBox(
height: MediaQuery.of( height: MediaQuery.of(context).size.height * 0.4,
context)
.size
.height *
0.4,
), ),
Padding( Padding(
padding: padding: EdgeInsets.all(8.0),
EdgeInsets.all(8.0),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceEvenly,
MainAxisAlignment
.spaceEvenly,
children: [ children: [
Container( Container(
width: 100, width: 100,
child: Button( child: Button(
label: 'Reset', label: 'Reset',
backgroundColor: backgroundColor: Colors.red,
Colors.red,
), ),
), ),
SizedBox( SizedBox(
@ -549,65 +456,38 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Container( Container(
width: 200, width: 200,
child: Button( child: Button(
onTap: onTap: () async {
() async { String categoriesId = "";
String for (CategoriseParentModel category in entityList) {
categoriesId = if (categoriesId == "") {
""; categoriesId = category.id;
for (CategoriseParentModel category
in entityList) {
if (categoriesId ==
"") {
categoriesId =
category
.id;
} else { } else {
categoriesId = categoriesId = "$categoriesId,${category.id}";
"$categoriesId,${category.id}";
} }
} }
String String brandIds = "";
brandIds =
"";
for (CategoriseParentModel brand for (CategoriseParentModel brand
in entityListBrands) { in entityListBrands) {
if (brandIds == if (brandIds == "") {
"") { brandIds = brand.id;
brandIds =
brand
.id;
} else { } else {
brandIds = brandIds = "$brandIds,${brand.id}";
"$brandIds,${brand.id}";
} }
} }
GifLoaderDialogUtils GifLoaderDialogUtils.showMyDialog(context);
.showMyDialog(
context);
await model.getFilteredProducts( await model.getFilteredProducts(
min: minField min: minField.text.toString(),
.text max: maxField.text.toString(),
.toString(), categoryId: categoriesId,
max: maxField brandId: brandIds);
.text GifLoaderDialogUtils.hideDialog(context);
.toString(),
categoryId:
categoriesId,
brandId:
brandIds);
GifLoaderDialogUtils
.hideDialog(
context);
Navigator.pop( Navigator.pop(context);
context);
}, },
label: 'Apply', label: 'Apply',
backgroundColor: backgroundColor: Colors.green,
Colors
.green,
), ),
), ),
], ],
@ -808,13 +688,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
), ),
), ),
Texts( Texts(
projectViewModel projectViewModel.isArabic
.isArabic ? model.parentProducts[index].namen
? model : model.parentProducts[index].name,
.parentProducts[
index]
.namen
:model.parentProducts[index].name,
regular: true, regular: true,
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -946,13 +822,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
width: MediaQuery.of(context).size.width * 0.65, width: MediaQuery.of(context).size.width * 0.65,
child: Texts( child: Texts(
projectViewModel.isArabic projectViewModel.isArabic
? model ? model.parentProducts[index].namen
.parentProducts[ : model.parentProducts[index].name,
index]
.namen
: model
.parentProducts[
index].name,
regular: true, regular: true,
fontSize: 13.2, fontSize: 13.2,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -973,8 +844,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
Row( Row(
children: [ children: [
StarRating( StarRating(
totalAverage:model totalAverage:
.parentProducts[index].approvedRatingSum > 0 model.parentProducts[index].approvedRatingSum > 0
? (model.parentProducts[index].approvedRatingSum ? (model.parentProducts[index].approvedRatingSum
.toDouble() / .toDouble() /
model.parentProducts[index] model.parentProducts[index]
@ -1043,8 +914,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
} }
bool isEntityListSelected(CategoriseParentModel masterKey) { bool isEntityListSelected(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history = Iterable<CategoriseParentModel> history = entityList.where((element) => masterKey.id == element.id);
entityList.where((element) => masterKey.id == element.id);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }
@ -1052,8 +922,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
} }
bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { bool isEntityListSelectedBrands(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history = Iterable<CategoriseParentModel> history = entityListBrands.where((element) => masterKey.id == element.id);
entityListBrands.where((element) => masterKey.id == element.id);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }

@ -23,8 +23,7 @@ class SubCategorisePage extends StatefulWidget {
SubCategorisePage({this.id, this.parentId, this.title}); SubCategorisePage({this.id, this.parentId, this.title});
@override @override
_SubCategorisePageState createState() => _SubCategorisePageState createState() => _SubCategorisePageState(id: id, title: title, parentId: parentId);
_SubCategorisePageState(id: id, title: title, parentId: parentId);
} }
class _SubCategorisePageState extends State<SubCategorisePage> { class _SubCategorisePageState extends State<SubCategorisePage> {
@ -52,9 +51,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
TextEditingController maxField = TextEditingController(); TextEditingController maxField = TextEditingController();
return BaseView<PharmacyCategoriseViewModel>( return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getSubCategorise(i: id), onModelReady: (model) => model.getSubCategorise(i: id),
builder: (BuildContext context, PharmacyCategoriseViewModel model, builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold(
Widget child) =>
PharmacyAppScaffold(
appBarTitle: title, appBarTitle: title,
isBottomBar: false, isBottomBar: false,
isShowAppBar: true, isShowAppBar: true,
@ -86,8 +83,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089195_diet-nutrition_2.png'
: parentId == '9' : parentId == '9'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089196_household_2.png'
: parentId == : parentId == '10'
'10'
? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png' ? 'https://uat.hmgwebservices.com/epharmacy/content/images/thumbs/0089197_home-care-appliances_2.png'
: '', : '',
fit: BoxFit.fill, fit: BoxFit.fill,
@ -99,14 +95,12 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
children: [ children: [
InkWell( InkWell(
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
child: Container( child: Container(
child: Texts(TranslationBase.of(context) child: Texts(TranslationBase.of(context).viewCategorise),
.viewCategorise),
), ),
), ),
Icon(Icons.arrow_forward) Icon(Icons.arrow_forward)
@ -118,30 +112,21 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return Container( return Container(
height: height: MediaQuery.of(context).size.height * 0.89,
MediaQuery.of(context).size.height *
0.89,
color: Colors.white, color: Colors.white,
child: Center( child: Center(
child: ListView.builder( child: ListView.builder(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
itemCount: itemCount: model.subCategorise.length,
model.subCategorise.length, itemBuilder: (BuildContext context, int index) {
itemBuilder: (BuildContext context,
int index) {
return Container( return Container(
child: Padding( child: Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment
.start,
children: [ children: [
Texts(model Texts(model.subCategorise[index].name),
.subCategorise[
index]
.name),
Divider( Divider(
thickness: 0.6, thickness: 0.6,
color: Colors.black12, color: Colors.black12,
@ -152,12 +137,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: page: FinalProductsPage(
FinalProductsPage( id: model.subCategorise[index].id,
id: model
.subCategorise[
index]
.id,
), ),
), ),
); );
@ -190,23 +171,19 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
itemCount: model.subCategorise.length, itemCount: model.subCategorise.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Padding( return Padding(
padding: padding: EdgeInsets.symmetric(horizontal: 8.0),
EdgeInsets.symmetric(horizontal: 8.0),
child: InkWell( child: InkWell(
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(horizontal: 13.0),
horizontal: 13.0),
child: Container( child: Container(
height: 60.0, height: 60.0,
width: 65.0, width: 65.0,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.orange.shade200 color: Colors.orange.shade200.withOpacity(0.45),
.withOpacity(0.45),
), ),
child: Center( child: Center(
child: Icon( child: Icon(
@ -217,14 +194,8 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
), ),
), ),
Container( Container(
width: MediaQuery.of(context) width: MediaQuery.of(context).size.width * 0.17,
.size height: MediaQuery.of(context).size.height * 0.10,
.width *
0.17,
height: MediaQuery.of(context)
.size
.height *
0.10,
child: Center( child: Center(
child: Texts( child: Texts(
model.subCategorise[index].name, model.subCategorise[index].name,
@ -285,21 +256,16 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
initialChildSize: 0.95, initialChildSize: 0.95,
maxChildSize: 0.95, maxChildSize: 0.95,
minChildSize: 0.9, minChildSize: 0.9,
builder: (BuildContext context, builder: (BuildContext context, ScrollController scrollController) {
ScrollController scrollController) {
return SingleChildScrollView( return SingleChildScrollView(
controller: scrollController, controller: scrollController,
child: Container( child: Container(
color: Colors.white, color: Colors.white,
height: MediaQuery.of(context) height: MediaQuery.of(context).size.height * 1.95,
.size
.height *
1.95,
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: padding: EdgeInsets.all(8.0),
EdgeInsets.all(8.0),
child: Row( child: Row(
children: [ children: [
Icon( Icon(
@ -309,30 +275,23 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
width: 10.0, width: 10.0,
), ),
Texts( Texts(
TranslationBase.of( TranslationBase.of(context).refine,
context)
.refine,
// 'Refine', // 'Refine',
fontWeight: fontWeight: FontWeight.w600,
FontWeight.w600,
), ),
SizedBox( SizedBox(
width: 250.0, width: 250.0,
), ),
InkWell( InkWell(
child: Texts( child: Texts(
TranslationBase.of( TranslationBase.of(context).closeIt,
context)
.closeIt,
// 'Close', // 'Close',
color: Colors.red, color: Colors.red,
fontWeight: fontWeight: FontWeight.w600,
FontWeight.w600,
fontSize: 15.0, fontSize: 15.0,
), ),
onTap: () { onTap: () {
Navigator.pop( Navigator.pop(context);
context);
}, },
), ),
], ],
@ -345,39 +304,27 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Column( Column(
children: [ children: [
ExpansionTile( ExpansionTile(
title: Texts( title: Texts(TranslationBase.of(context).categorise),
TranslationBase.of(
context)
.categorise),
children: [ children: [
ProcedureListWidget( ProcedureListWidget(
model: model, model: model,
masterList: model masterList: model.subCategorise,
.subCategorise, removeHistory: (item) {
removeHistory:
(item) {
setState(() { setState(() {
entityList entityList.remove(item);
.remove(
item);
}); });
}, },
addHistory: addHistory: (history) {
(history) {
setState(() { setState(() {
entityList.add( entityList.add(history);
history);
}); });
}, },
addSelectedHistories: addSelectedHistories: () {
() {
//TODO build your fun herr //TODO build your fun herr
// widget.addSelectedHistories(); // widget.addSelectedHistories();
}, },
isEntityListSelected: isEntityListSelected: (master) =>
(master) => isEntityListSelected(master),
isEntityListSelected(
master),
) )
], ],
), ),
@ -386,40 +333,27 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: Texts( title: Texts(TranslationBase.of(context).brands),
TranslationBase.of(
context)
.brands),
children: [ children: [
ProcedureListWidget( ProcedureListWidget(
model: model, model: model,
masterList: model masterList: model.brandsList,
.brandsList, removeHistory: (item) {
removeHistory:
(item) {
setState(() { setState(() {
entityListBrands entityListBrands.remove(item);
.remove(
item);
}); });
}, },
addHistory: addHistory: (history) {
(history) {
setState(() { setState(() {
entityListBrands entityListBrands.add(history);
.add(
history);
}); });
}, },
addSelectedHistories: addSelectedHistories: () {
() {
//TODO build your fun herr //TODO build your fun herr
// widget.addSelectedHistories(); // widget.addSelectedHistories();
}, },
isEntityListSelected: isEntityListSelected: (master) =>
(master) => isEntityListSelectedBrands(master),
isEntityListSelectedBrands(
master),
) )
], ],
), ),
@ -428,69 +362,43 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
ExpansionTile( ExpansionTile(
title: Texts( title: Texts(TranslationBase.of(context).price),
TranslationBase.of(
context)
.price),
children: [ children: [
Container( Container(
color: Color( color: Color(0xffEEEEEE),
0xffEEEEEE),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceAround,
MainAxisAlignment
.spaceAround,
children: [ children: [
Column( Column(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment
.start,
children: [ children: [
Texts( Texts('Min'),
'Min'),
Container( Container(
color: Colors color: Colors.white,
.white, width: 200,
width: height: 40,
200, child: TextFormField(
height: decoration: InputDecoration(
40, border: OutlineInputBorder(),
child:
TextFormField(
decoration:
InputDecoration(
border:
OutlineInputBorder(),
), ),
controller: controller: minField,
minField,
), ),
), ),
], ],
), ),
Column( Column(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment
.start,
children: [ children: [
Texts( Texts('Max'),
'Max'),
Container( Container(
color: Colors color: Colors.white,
.white, width: 200,
width: height: 40,
200, child: TextFormField(
height: decoration: InputDecoration(
40, border: OutlineInputBorder(),
child:
TextFormField(
decoration:
InputDecoration(
border:
OutlineInputBorder(),
), ),
controller: controller: maxField,
maxField,
), ),
), ),
], ],
@ -505,31 +413,20 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
color: Colors.black12, color: Colors.black12,
), ),
SizedBox( SizedBox(
height: MediaQuery.of( height: MediaQuery.of(context).size.height * 0.4,
context)
.size
.height *
0.4,
), ),
Padding( Padding(
padding: padding: EdgeInsets.all(8.0),
EdgeInsets.all(8.0),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceEvenly,
MainAxisAlignment
.spaceEvenly,
children: [ children: [
Expanded( Expanded(
child: Container( child: Container(
width: 100, width: 100,
child: Button( child: Button(
label: TranslationBase.of( label: TranslationBase.of(context).reset,
context)
.reset,
// 'Reset', // 'Reset',
backgroundColor: backgroundColor: Colors.red,
Colors
.red,
), ),
), ),
), ),
@ -539,66 +436,37 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
Container( Container(
width: 200, width: 200,
child: Button( child: Button(
onTap: onTap: () async {
() async { String categoriesId = "";
String for (CategoriseParentModel category in entityList) {
categoriesId = if (categoriesId == "") {
""; categoriesId = category.id;
for (CategoriseParentModel category
in entityList) {
if (categoriesId ==
"") {
categoriesId =
category
.id;
} else { } else {
categoriesId = categoriesId = "$categoriesId,${category.id}";
"$categoriesId,${category.id}";
} }
} }
String String brandIds = "";
brandIds =
"";
for (CategoriseParentModel brand for (CategoriseParentModel brand
in entityListBrands) { in entityListBrands) {
if (brandIds == if (brandIds == "") {
"") { brandIds = brand.id;
brandIds =
brand
.id;
} else { } else {
brandIds = brandIds = "$brandIds,${brand.id}";
"$brandIds,${brand.id}";
} }
} }
GifLoaderDialogUtils GifLoaderDialogUtils.showMyDialog(context);
.showMyDialog(
context);
await model.getFilteredSubProducts( await model.getFilteredSubProducts(
min: minField min: minField.text.toString(),
.text max: maxField.text.toString(),
.toString(), categoryId: categoriesId,
max: maxField brandId: brandIds);
.text GifLoaderDialogUtils.hideDialog(context);
.toString(), Navigator.pop(context);
categoryId:
categoriesId,
brandId:
brandIds);
GifLoaderDialogUtils
.hideDialog(
context);
Navigator.pop(
context);
}, },
label: TranslationBase.of( label: TranslationBase.of(context).apply,
context)
.apply,
// 'Apply', // 'Apply',
backgroundColor: backgroundColor: Colors.green,
Colors
.green,
), ),
), ),
], ],
@ -983,8 +851,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
} }
bool isEntityListSelected(CategoriseParentModel masterKey) { bool isEntityListSelected(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history = Iterable<CategoriseParentModel> history = entityList.where((element) => masterKey.id == element.id);
entityList.where((element) => masterKey.id == element.id);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }
@ -992,8 +859,7 @@ class _SubCategorisePageState extends State<SubCategorisePage> {
} }
bool isEntityListSelectedBrands(CategoriseParentModel masterKey) { bool isEntityListSelectedBrands(CategoriseParentModel masterKey) {
Iterable<CategoriseParentModel> history = Iterable<CategoriseParentModel> history = entityListBrands.where((element) => masterKey.id == element.id);
entityListBrands.where((element) => masterKey.id == element.id);
if (history.length > 0) { if (history.length > 0) {
return true; return true;
} }

Loading…
Cancel
Save