|
|
@ -37,20 +37,19 @@ class SelectList {
|
|
|
|
|
|
|
|
|
|
|
|
class _LifePayPageState extends State<LifePayPage> {
|
|
|
|
class _LifePayPageState extends State<LifePayPage> {
|
|
|
|
EasyRefreshController _controller;
|
|
|
|
EasyRefreshController _controller;
|
|
|
|
List<SelectList> selectItems = [];
|
|
|
|
// List<SelectList> selectItems = [];
|
|
|
|
List<int> _selectYears = [];
|
|
|
|
List<int> _selectYears = [];
|
|
|
|
List<LifePayModel> _models;
|
|
|
|
List<LifePayModel> _models = [];
|
|
|
|
bool get isAllSelect => _models.length == _selectYears.length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int _getLength(LifePayModel model) {
|
|
|
|
// int _getLength(LifePayModel model) {
|
|
|
|
int count = 0;
|
|
|
|
// int count = 0;
|
|
|
|
model.dailyPaymentTypeVos.forEach((element) {
|
|
|
|
// model.dailyPaymentTypeVos.forEach((element) {
|
|
|
|
element.detailedVoList.forEach((element) {
|
|
|
|
// element.detailedVoList.forEach((element) {
|
|
|
|
count++;
|
|
|
|
// count++;
|
|
|
|
});
|
|
|
|
// });
|
|
|
|
});
|
|
|
|
// });
|
|
|
|
return count;
|
|
|
|
// return count;
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
@ -125,29 +124,35 @@ class _LifePayPageState extends State<LifePayPage> {
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
GestureDetector(
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
if (selectItems[index].selected.length ==
|
|
|
|
// if (selectItems[index].selected.length ==
|
|
|
|
_getLength(model)) {
|
|
|
|
// _getLength(model)) {
|
|
|
|
selectItems[index].value = false;
|
|
|
|
// selectItems[index].value = false;
|
|
|
|
selectItems[index].selected.clear();
|
|
|
|
// selectItems[index].selected.clear();
|
|
|
|
|
|
|
|
// _selectYears.remove(index);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// selectItems[index].value = true;
|
|
|
|
|
|
|
|
// _selectYears.add(index);
|
|
|
|
|
|
|
|
// for (var i = 0; i < model.dailyPaymentTypeVos.length; i++) {
|
|
|
|
|
|
|
|
// for (var j = 0;
|
|
|
|
|
|
|
|
// i <
|
|
|
|
|
|
|
|
// model
|
|
|
|
|
|
|
|
// .dailyPaymentTypeVos[i].detailedVoList.length;
|
|
|
|
|
|
|
|
// i++) {
|
|
|
|
|
|
|
|
// String id = model.dailyPaymentTypeVos[i].id.toString() +
|
|
|
|
|
|
|
|
// model.dailyPaymentTypeVos[i].detailedVoList[j]
|
|
|
|
|
|
|
|
// .groupId
|
|
|
|
|
|
|
|
// .toString();
|
|
|
|
|
|
|
|
// if (!selectItems[index].selected.contains(id)) {
|
|
|
|
|
|
|
|
// selectItems[index].selected.add(id);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// setState(() {});
|
|
|
|
|
|
|
|
if (_selectYears.contains(index)) {
|
|
|
|
_selectYears.remove(index);
|
|
|
|
_selectYears.remove(index);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
selectItems[index].value = true;
|
|
|
|
|
|
|
|
_selectYears.add(index);
|
|
|
|
_selectYears.add(index);
|
|
|
|
for (var i = 0; i < model.dailyPaymentTypeVos.length; i++) {
|
|
|
|
|
|
|
|
for (var j = 0;
|
|
|
|
|
|
|
|
i <
|
|
|
|
|
|
|
|
model
|
|
|
|
|
|
|
|
.dailyPaymentTypeVos[i].detailedVoList.length;
|
|
|
|
|
|
|
|
i++) {
|
|
|
|
|
|
|
|
String id = model.dailyPaymentTypeVos[i].id.toString() +
|
|
|
|
|
|
|
|
model.dailyPaymentTypeVos[i].detailedVoList[j]
|
|
|
|
|
|
|
|
.groupId
|
|
|
|
|
|
|
|
.toString();
|
|
|
|
|
|
|
|
if (!selectItems[index].selected.contains(id)) {
|
|
|
|
|
|
|
|
selectItems[index].selected.add(id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -220,7 +225,7 @@ class _LifePayPageState extends State<LifePayPage> {
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
LifePayDetailPage(
|
|
|
|
LifePayDetailPage(
|
|
|
|
model: _models[index],
|
|
|
|
model: _models[index],
|
|
|
|
selectItems: selectItems[index].selected,
|
|
|
|
// selectItems: selectItems[index].selected,
|
|
|
|
).to();
|
|
|
|
).to();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
@ -313,7 +318,7 @@ class _LifePayPageState extends State<LifePayPage> {
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
GestureDetector(
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
if (isAllSelect) {
|
|
|
|
if (_models.length == _selectYears.length) {
|
|
|
|
_selectYears.clear();
|
|
|
|
_selectYears.clear();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
for (var i = 0; i < _models.length; i++) {
|
|
|
|
for (var i = 0; i < _models.length; i++) {
|
|
|
@ -329,13 +334,17 @@ class _LifePayPageState extends State<LifePayPage> {
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(
|
|
|
|
border: Border.all(
|
|
|
|
width: 1.w,
|
|
|
|
width: 1.w,
|
|
|
|
color: isAllSelect ? kPrimaryColor : kDarkSubColor),
|
|
|
|
color: _models.length == _selectYears.length
|
|
|
|
color: isAllSelect ? kPrimaryColor : Colors.transparent,
|
|
|
|
? kPrimaryColor
|
|
|
|
|
|
|
|
: kDarkSubColor),
|
|
|
|
|
|
|
|
color: _models.length == _selectYears.length
|
|
|
|
|
|
|
|
? kPrimaryColor
|
|
|
|
|
|
|
|
: Colors.transparent,
|
|
|
|
borderRadius: BorderRadius.circular(20.w)),
|
|
|
|
borderRadius: BorderRadius.circular(20.w)),
|
|
|
|
curve: Curves.easeInOutCubic,
|
|
|
|
curve: Curves.easeInOutCubic,
|
|
|
|
width: 40.w,
|
|
|
|
width: 40.w,
|
|
|
|
height: 40.w,
|
|
|
|
height: 40.w,
|
|
|
|
child: isAllSelect
|
|
|
|
child: _models.length == _selectYears.length
|
|
|
|
? Icon(
|
|
|
|
? Icon(
|
|
|
|
CupertinoIcons.check_mark,
|
|
|
|
CupertinoIcons.check_mark,
|
|
|
|
size: 25.w,
|
|
|
|
size: 25.w,
|
|
|
|