From ba6e3e51fff21ae137a5b12a301a5bcb25c35815 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Fri, 2 Apr 2021 11:26:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E6=8A=95=E7=A5=A8=E7=99=BE=E5=88=86=E6=AF=94=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E6=B4=BB=E5=8A=A8=E6=8A=95=E7=A5=A8=20?= =?UTF-8?q?=E6=80=BB=E6=95=B0=E4=B8=BA0=E6=97=B6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=BA=A2=E5=87=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event_activity/voting_detail_page.dart | 30 ++++++++++++------- lib/pages/life_pay/life_pay_page.dart | 3 +- lib/pages/life_pay/life_pay_record_page.dart | 3 +- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/lib/pages/event_activity/voting_detail_page.dart b/lib/pages/event_activity/voting_detail_page.dart index b41e03dd..a4ae9439 100644 --- a/lib/pages/event_activity/voting_detail_page.dart +++ b/lib/pages/event_activity/voting_detail_page.dart @@ -16,6 +16,7 @@ import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/buttons/bee_single_check.dart'; import 'package:akuCommunity/widget/buttons/bottom_button.dart'; +import 'package:velocity_x/velocity_x.dart'; class VotingDetailPage extends StatefulWidget { final int id; @@ -33,8 +34,8 @@ class _VotingDetailPageState extends State { // List _select = []; int _selectId; bool _hasVoted = false; - bool get isVoted { - if ((_model.status == 4) || _hasVoted) { + bool get finishVoted { + if ((_model.status == 4) || _hasVoted || (_model.status == 3)) { return true; } return false; @@ -76,16 +77,24 @@ class _VotingDetailPageState extends State { ); } + double _getPercent(num numerator, num denominator) { + if (denominator == 0) { + return 0; + } else { + return (numerator / denominator) * 100; + } + } + Widget _buildVoteCard(AppVoteCandidateVos model) { - double _percent = (model.total.toDouble()) / (_model.totals.toDouble()); + double _percent = _getPercent(model.total, _model.totals); return Container( padding: EdgeInsets.symmetric(vertical: 40.w), - constraints: BoxConstraints(maxHeight: 230.w), + // constraints: BoxConstraints(maxHeight: 230.w), child: Row( children: [ Container( alignment: Alignment.center, - width: 88.w, + width: 58.w, height: 150.w, //多选 // child: BeeCheckBox( @@ -104,7 +113,7 @@ class _VotingDetailPageState extends State { // // //暂时用单选 - child: _model.status == 3 || _model.status == 1 + child: finishVoted ? _unCheck() : GestureDetector( onTap: () { @@ -139,21 +148,22 @@ class _VotingDetailPageState extends State { // 10.w.heightBox, model.name.text.black.size(32.sp).make(), 33.w.heightBox, - isVoted && _model.status != 3 + finishVoted ? Row( children: [ SizedBox( - width: 280.w, + width: 290.w, child: LinearProgressIndicator( value: _percent, ), ), 8.w.widthBox, - '$_percent%' + '${_percent.toStringAsFixed(2)}%' .text .color(ktextSubColor) .size(24.sp) - .make(), + .make() + .expand(), ], ) : SizedBox() diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index a6c04725..c84b44aa 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -238,7 +238,8 @@ class _LifePayPageState extends State { controller: _controller, extraParams: {'estateId': appProvider.selectedHouse.estateId}, convert: (model) { - _selectPay = List.generate(model.tableList.length, + _selectPay = List.generate( + (_selectPay.length ?? 0) + model.tableList.length, (index) => SelectPay(payCount: 0, payTotal: 0.0)); return model.tableList .map((e) => LifePayModel.fromJson(e)) diff --git a/lib/pages/life_pay/life_pay_record_page.dart b/lib/pages/life_pay/life_pay_record_page.dart index 6fc01950..cf3e8374 100644 --- a/lib/pages/life_pay/life_pay_record_page.dart +++ b/lib/pages/life_pay/life_pay_record_page.dart @@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class LifePayRecordPage extends StatefulWidget { LifePayRecordPage({Key key}) : super(key: key); @@ -80,7 +81,7 @@ class _LifePayRecordPageState extends State { .bold .make(), Spacer(), - '人才智慧社区 ${model.roomName}' + '${S.of(context).tempPlotName} ${model.roomName}' .text .size(24.sp) .color(Color(0xFF999999))