Merge branch 'master' of 192.168.2.201:laiiihz/akuCommunity

* 'master' of 192.168.2.201:laiiihz/akuCommunity:
  update radio box logical
hmxc
小赖 4 years ago
commit a87d6c9d69

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

@ -1,10 +1,8 @@
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/model/manager/life_pay_model.dart';
import 'package:akuCommunity/pages/life_pay/life_pay_page.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/utils/bee_parse.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/buttons/bee_check_box.dart';
import 'package:akuCommunity/widget/buttons/bee_check_radio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -14,11 +12,9 @@ import 'package:provider/provider.dart';
class LifePayDetailPage extends StatefulWidget {
final LifePayModel model;
final List<String> selectItems;
LifePayDetailPage({
Key key,
this.model,
this.selectItems,
}) : super(key: key);
@override
@ -26,6 +22,7 @@ class LifePayDetailPage extends StatefulWidget {
}
class _LifePayDetailPageState extends State<LifePayDetailPage> {
List<String> _selectItems=[];
int get listLength {
int count = 0;
widget.model.dailyPaymentTypeVos.forEach((element) {
@ -37,7 +34,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
}
bool get isAllSelect {
return listLength == widget.selectItems.length;
return listLength == _selectItems.length;
}
Widget _buildTile(int groupId, int id, int years, int price) {
@ -46,17 +43,17 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
GestureDetector(
onTap: () {
String item = id.toString() + groupId.toString();
if (widget.selectItems.contains(item)) {
widget.selectItems.remove(item);
if (_selectItems.contains(item)) {
_selectItems.remove(item);
} else {
widget.selectItems.add(item);
_selectItems.add(item);
}
setState(() {});
},
child: BeeCheckRadio(
value: id.toString() + groupId.toString(),
groupValue: widget.selectItems)),
groupValue: _selectItems)),
24.w.widthBox,
groupId == 1
? '$years上半年'.text.black.size(28.sp).make()
@ -120,7 +117,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
GestureDetector(
onTap: () {
if (isAllSelect) {
widget.selectItems.clear();
_selectItems.clear();
} else {
for (var i = 0;
i < widget.model.dailyPaymentTypeVos.length;
@ -135,8 +132,8 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
widget.model.dailyPaymentTypeVos[i]
.detailedVoList[j].groupId
.toString();
if (!widget.selectItems.contains(id)) {
widget.selectItems.add(id);
if (!_selectItems.contains(id)) {
_selectItems.add(id);
}
}
}

Loading…
Cancel
Save