|
|
|
|
@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_mo
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacies/product_detail.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
|
|
|
|
|
@ -24,8 +25,7 @@ class ParentCategorisePage extends StatefulWidget {
|
|
|
|
|
ParentCategorisePage({this.id, this.titleName});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_ParentCategorisePageState createState() =>
|
|
|
|
|
_ParentCategorisePageState(id: id, titleName: titleName);
|
|
|
|
|
_ParentCategorisePageState createState() => _ParentCategorisePageState(id: id, titleName: titleName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
@ -56,9 +56,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
return BaseView<PharmacyCategoriseViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getCategoriseParent(i: id),
|
|
|
|
|
builder: (BuildContext context, PharmacyCategoriseViewModel model,
|
|
|
|
|
Widget child) =>
|
|
|
|
|
PharmacyAppScaffold(
|
|
|
|
|
builder: (BuildContext context, PharmacyCategoriseViewModel model, Widget child) => PharmacyAppScaffold(
|
|
|
|
|
appBarTitle: titleName,
|
|
|
|
|
isBottomBar: false,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
@ -126,31 +124,20 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
scrollDirection:
|
|
|
|
|
Axis.vertical,
|
|
|
|
|
itemCount: model
|
|
|
|
|
.categoriseParent.length,
|
|
|
|
|
itemBuilder:
|
|
|
|
|
(BuildContext context,
|
|
|
|
|
int index) {
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
itemCount: model.categoriseParent.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return Container(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.all(4.0),
|
|
|
|
|
padding: EdgeInsets.all(4.0),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment
|
|
|
|
|
.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(model
|
|
|
|
|
.categoriseParent[
|
|
|
|
|
index]
|
|
|
|
|
.name),
|
|
|
|
|
Texts(model.categoriseParent[index].name),
|
|
|
|
|
Divider(
|
|
|
|
|
thickness: 0.6,
|
|
|
|
|
color: Colors
|
|
|
|
|
.black12,
|
|
|
|
|
color: Colors.black12,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -158,16 +145,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page:
|
|
|
|
|
SubCategorisePage(
|
|
|
|
|
title: model
|
|
|
|
|
.categoriseParent[
|
|
|
|
|
index]
|
|
|
|
|
.name,
|
|
|
|
|
id: model
|
|
|
|
|
.categoriseParent[
|
|
|
|
|
index]
|
|
|
|
|
.id,
|
|
|
|
|
page: SubCategorisePage(
|
|
|
|
|
title: model.categoriseParent[index].name,
|
|
|
|
|
id: model.categoriseParent[index].id,
|
|
|
|
|
parentId: id,
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
@ -201,28 +181,22 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
child: Center(
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
itemCount: model.categoriseParent.length > 8
|
|
|
|
|
? 8
|
|
|
|
|
: model.categoriseParent.length,
|
|
|
|
|
itemCount: model.categoriseParent.length > 8 ? 8 : model.categoriseParent.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(
|
|
|
|
|
@ -233,10 +207,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.197,
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.197,
|
|
|
|
|
// height: MediaQuery.of(context)
|
|
|
|
|
// .size
|
|
|
|
|
// .height *
|
|
|
|
|
@ -244,12 +215,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Texts(
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? model
|
|
|
|
|
.categoriseParent[index]
|
|
|
|
|
.namen
|
|
|
|
|
: model
|
|
|
|
|
.categoriseParent[index]
|
|
|
|
|
.name,
|
|
|
|
|
? model.categoriseParent[index].namen
|
|
|
|
|
: model.categoriseParent[index].name,
|
|
|
|
|
fontSize: 13.4,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
maxLines: 3,
|
|
|
|
|
@ -263,10 +230,8 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: SubCategorisePage(
|
|
|
|
|
title: model
|
|
|
|
|
.categoriseParent[index].name,
|
|
|
|
|
id: model
|
|
|
|
|
.categoriseParent[index].id,
|
|
|
|
|
title: model.categoriseParent[index].name,
|
|
|
|
|
id: model.categoriseParent[index].id,
|
|
|
|
|
parentId: id,
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
@ -312,21 +277,16 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
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(
|
|
|
|
|
@ -337,8 +297,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
'Refine',
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.w600,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 250.0,
|
|
|
|
|
@ -347,13 +306,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
child: Texts(
|
|
|
|
|
'Close',
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.w600,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.pop(
|
|
|
|
|
context);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -366,37 +323,27 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
ExpansionTile(
|
|
|
|
|
title:
|
|
|
|
|
Texts('Categorise'),
|
|
|
|
|
title: Texts('Categorise'),
|
|
|
|
|
children: [
|
|
|
|
|
ProcedureListWidget(
|
|
|
|
|
model: model,
|
|
|
|
|
masterList: model
|
|
|
|
|
.categoriseParent,
|
|
|
|
|
removeHistory:
|
|
|
|
|
(item) {
|
|
|
|
|
masterList: model.categoriseParent,
|
|
|
|
|
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),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -409,33 +356,23 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
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),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -447,63 +384,40 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
title: Texts('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(),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
width: 200,
|
|
|
|
|
height: 40,
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
|
),
|
|
|
|
|
controller:
|
|
|
|
|
minField,
|
|
|
|
|
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(),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
width: 200,
|
|
|
|
|
height: 40,
|
|
|
|
|
child: TextFormField(
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
|
),
|
|
|
|
|
controller:
|
|
|
|
|
maxField,
|
|
|
|
|
controller: maxField,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -518,26 +432,18 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
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: [
|
|
|
|
|
Container(
|
|
|
|
|
width: 100,
|
|
|
|
|
child: Button(
|
|
|
|
|
label: 'Reset',
|
|
|
|
|
backgroundColor:
|
|
|
|
|
Colors.red,
|
|
|
|
|
backgroundColor: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -546,54 +452,38 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
Container(
|
|
|
|
|
width: 200,
|
|
|
|
|
child: Button(
|
|
|
|
|
onTap: () {
|
|
|
|
|
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}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model.getFilteredProducts(
|
|
|
|
|
min: minField
|
|
|
|
|
.text
|
|
|
|
|
.toString(),
|
|
|
|
|
max: maxField
|
|
|
|
|
.text
|
|
|
|
|
.toString(),
|
|
|
|
|
categoryId:
|
|
|
|
|
categoriesId,
|
|
|
|
|
brandId:
|
|
|
|
|
brandIds);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
|
|
|
|
|
await model.getFilteredProducts(
|
|
|
|
|
min: minField.text.toString(),
|
|
|
|
|
max: maxField.text.toString(),
|
|
|
|
|
categoryId: categoriesId,
|
|
|
|
|
brandId: brandIds);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
label: 'Apply',
|
|
|
|
|
backgroundColor:
|
|
|
|
|
Colors
|
|
|
|
|
.green,
|
|
|
|
|
backgroundColor: Colors.green,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -659,13 +549,10 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
),
|
|
|
|
|
styleOne == true
|
|
|
|
|
? Container(
|
|
|
|
|
height: model.parentProducts.length *
|
|
|
|
|
MediaQuery.of(context).size.height *
|
|
|
|
|
0.15,
|
|
|
|
|
height: model.parentProducts.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,
|
|
|
|
|
@ -677,9 +564,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Card(
|
|
|
|
|
color: model.parentProducts[index]
|
|
|
|
|
.discountName !=
|
|
|
|
|
null
|
|
|
|
|
color: model.parentProducts[index].discountName != null
|
|
|
|
|
? Color(0xffFFFF00)
|
|
|
|
|
: Colors.white,
|
|
|
|
|
elevation: 0,
|
|
|
|
|
@ -712,111 +597,62 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
),
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 0),
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width /
|
|
|
|
|
3,
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 0),
|
|
|
|
|
width: MediaQuery.of(context).size.width / 3,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Stack(
|
|
|
|
|
children: [
|
|
|
|
|
if (model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.discountName !=
|
|
|
|
|
null)
|
|
|
|
|
if (model.parentProducts[index].discountName != null)
|
|
|
|
|
RotatedBox(
|
|
|
|
|
quarterTurns: 4,
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration:
|
|
|
|
|
BoxDecoration(),
|
|
|
|
|
decoration: BoxDecoration(),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.only(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
right: 5.0,
|
|
|
|
|
top: 20.0,
|
|
|
|
|
bottom: 5.0,
|
|
|
|
|
),
|
|
|
|
|
child: Texts(
|
|
|
|
|
'offer'
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
'offer'.toUpperCase(),
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight
|
|
|
|
|
.w900,
|
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
transform: new Matrix4
|
|
|
|
|
.rotationZ(
|
|
|
|
|
5.837200),
|
|
|
|
|
transform: new Matrix4.rotationZ(5.837200),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.fromLTRB(
|
|
|
|
|
0, 16, 0, 0),
|
|
|
|
|
alignment:
|
|
|
|
|
Alignment.center,
|
|
|
|
|
margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Image.network(
|
|
|
|
|
model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.images
|
|
|
|
|
.isNotEmpty
|
|
|
|
|
? model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.images[0]
|
|
|
|
|
.thumb
|
|
|
|
|
model.parentProducts[index].images.isNotEmpty
|
|
|
|
|
? model.parentProducts[index].images[0].thumb
|
|
|
|
|
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
height: 80,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessage !=
|
|
|
|
|
null
|
|
|
|
|
? MediaQuery.of(
|
|
|
|
|
context)
|
|
|
|
|
.size
|
|
|
|
|
.width /
|
|
|
|
|
5
|
|
|
|
|
width: model.parentProducts[index].rxMessage != null
|
|
|
|
|
? MediaQuery.of(context).size.width / 5
|
|
|
|
|
: 0,
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.all(4),
|
|
|
|
|
padding: EdgeInsets.all(4),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color:
|
|
|
|
|
Color(0xffb23838),
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.only(
|
|
|
|
|
topLeft: Radius
|
|
|
|
|
.circular(
|
|
|
|
|
6)),
|
|
|
|
|
color: Color(0xffb23838),
|
|
|
|
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
|
|
|
|
|
),
|
|
|
|
|
child: Texts(
|
|
|
|
|
model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessage !=
|
|
|
|
|
null
|
|
|
|
|
? model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessage
|
|
|
|
|
model.parentProducts[index].rxMessage != null
|
|
|
|
|
? model.parentProducts[index].rxMessage
|
|
|
|
|
: "",
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.w400,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -827,53 +663,32 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
vertical: 0,
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment
|
|
|
|
|
.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
if (model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.discountName !=
|
|
|
|
|
null)
|
|
|
|
|
if (model.parentProducts[index].discountName != null)
|
|
|
|
|
Container(
|
|
|
|
|
width:
|
|
|
|
|
double.infinity,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 13.0,
|
|
|
|
|
decoration:
|
|
|
|
|
BoxDecoration(
|
|
|
|
|
color: Color(
|
|
|
|
|
0xff5AB145),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(0xff5AB145),
|
|
|
|
|
),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Texts(
|
|
|
|
|
model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.discountName,
|
|
|
|
|
model.parentProducts[index].discountName,
|
|
|
|
|
regular: true,
|
|
|
|
|
color:
|
|
|
|
|
Colors.white,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 10.4,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.name,
|
|
|
|
|
model.parentProducts[index].name,
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.w700,
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets
|
|
|
|
|
.only(
|
|
|
|
|
top: 4,
|
|
|
|
|
bottom: 4),
|
|
|
|
|
padding: const EdgeInsets.only(top: 4, bottom: 4),
|
|
|
|
|
child: Texts(
|
|
|
|
|
"SAR ${model.parentProducts[index].price}",
|
|
|
|
|
bold: true,
|
|
|
|
|
@ -883,26 +698,21 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
StarRating(
|
|
|
|
|
totalAverage: model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.approvedRatingSum >
|
|
|
|
|
0
|
|
|
|
|
? (model.parentProducts[index].approvedRatingSum
|
|
|
|
|
.toDouble() /
|
|
|
|
|
model
|
|
|
|
|
.parentProducts[index]
|
|
|
|
|
.approvedRatingSum
|
|
|
|
|
.toDouble())
|
|
|
|
|
.toDouble()
|
|
|
|
|
: 0,
|
|
|
|
|
totalAverage:
|
|
|
|
|
model.parentProducts[index].approvedRatingSum > 0
|
|
|
|
|
? (model.parentProducts[index].approvedRatingSum
|
|
|
|
|
.toDouble() /
|
|
|
|
|
model.parentProducts[index]
|
|
|
|
|
.approvedRatingSum
|
|
|
|
|
.toDouble())
|
|
|
|
|
.toDouble()
|
|
|
|
|
: 0,
|
|
|
|
|
forceStars: true),
|
|
|
|
|
Texts(
|
|
|
|
|
"(${model.parentProducts[index].approvedTotalReviews})",
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.w400,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -917,8 +727,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: ProductDetailPage(model
|
|
|
|
|
.parentProducts[index]),
|
|
|
|
|
page: ProductDetailPage(model.parentProducts[index]),
|
|
|
|
|
)),
|
|
|
|
|
},
|
|
|
|
|
));
|
|
|
|
|
@ -926,14 +735,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
height: model.parentProducts.length *
|
|
|
|
|
MediaQuery.of(context).size.height *
|
|
|
|
|
0.122,
|
|
|
|
|
height: model.parentProducts.length * MediaQuery.of(context).size.height * 0.122,
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
itemCount: model.parentProducts.length,
|
|
|
|
|
itemBuilder:
|
|
|
|
|
(BuildContext context, int index) {
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
child: Card(
|
|
|
|
|
child: Row(
|
|
|
|
|
@ -943,11 +749,9 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
decoration:
|
|
|
|
|
BoxDecoration(),
|
|
|
|
|
decoration: BoxDecoration(),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.only(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
left: 9.0,
|
|
|
|
|
top: 8.0,
|
|
|
|
|
right: 10.0,
|
|
|
|
|
@ -955,22 +759,11 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
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
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.images
|
|
|
|
|
.isNotEmpty
|
|
|
|
|
? model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.images[0]
|
|
|
|
|
.thumb
|
|
|
|
|
model.parentProducts[index].images.isNotEmpty
|
|
|
|
|
? model.parentProducts[index].images[0].thumb
|
|
|
|
|
: 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/6c/No_image_3x4.svg/1200px-No_image_3x4.svg.png',
|
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
|
height: 80,
|
|
|
|
|
@ -981,44 +774,22 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessage !=
|
|
|
|
|
null
|
|
|
|
|
? MediaQuery.of(
|
|
|
|
|
context)
|
|
|
|
|
.size
|
|
|
|
|
.width /
|
|
|
|
|
5
|
|
|
|
|
width: model.parentProducts[index].rxMessage != null
|
|
|
|
|
? MediaQuery.of(context).size.width / 5
|
|
|
|
|
: 0,
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.all(4),
|
|
|
|
|
padding: EdgeInsets.all(4),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color:
|
|
|
|
|
Color(0xffb23838),
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.only(
|
|
|
|
|
topLeft: Radius
|
|
|
|
|
.circular(
|
|
|
|
|
6)),
|
|
|
|
|
color: Color(0xffb23838),
|
|
|
|
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(6)),
|
|
|
|
|
),
|
|
|
|
|
child: Texts(
|
|
|
|
|
model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessage !=
|
|
|
|
|
null
|
|
|
|
|
? model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.rxMessage
|
|
|
|
|
model.parentProducts[index].rxMessage != null
|
|
|
|
|
? model.parentProducts[index].rxMessage
|
|
|
|
|
: "",
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.w400,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -1031,29 +802,19 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
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
|
|
|
|
|
.parentProducts[index]
|
|
|
|
|
.name,
|
|
|
|
|
model.parentProducts[index].name,
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 13.2,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.w500,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
maxLines: 5,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -1061,9 +822,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
height: 8.0,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.only(
|
|
|
|
|
top: 4, bottom: 4),
|
|
|
|
|
padding: const EdgeInsets.only(top: 4, bottom: 4),
|
|
|
|
|
child: Texts(
|
|
|
|
|
"SAR ${model.parentProducts[index].price}",
|
|
|
|
|
bold: true,
|
|
|
|
|
@ -1073,30 +832,20 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
StarRating(
|
|
|
|
|
totalAverage: model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.approvedRatingSum >
|
|
|
|
|
0
|
|
|
|
|
? (model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.approvedRatingSum
|
|
|
|
|
.toDouble() /
|
|
|
|
|
model
|
|
|
|
|
.parentProducts[
|
|
|
|
|
index]
|
|
|
|
|
.approvedRatingSum
|
|
|
|
|
.toDouble())
|
|
|
|
|
.toDouble()
|
|
|
|
|
: 0,
|
|
|
|
|
totalAverage:
|
|
|
|
|
model.parentProducts[index].approvedRatingSum > 0
|
|
|
|
|
? (model.parentProducts[index].approvedRatingSum
|
|
|
|
|
.toDouble() /
|
|
|
|
|
model.parentProducts[index].approvedRatingSum
|
|
|
|
|
.toDouble())
|
|
|
|
|
.toDouble()
|
|
|
|
|
: 0,
|
|
|
|
|
forceStars: true),
|
|
|
|
|
Texts(
|
|
|
|
|
"(${model.parentProducts[index].approvedTotalReviews})",
|
|
|
|
|
regular: true,
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.w400,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -1110,8 +859,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: ProductDetailPage(
|
|
|
|
|
model.parentProducts[index]),
|
|
|
|
|
page: ProductDetailPage(model.parentProducts[index]),
|
|
|
|
|
)),
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@ -1125,8 +873,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
@ -1134,8 +881,7 @@ class _ParentCategorisePageState extends State<ParentCategorisePage> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|