From d702d938cc5fb7fe202d12df3c4b6654f62e7d4e Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 29 Jan 2021 16:22:41 +0800 Subject: [PATCH 01/14] update fixed page animate --- .../goods_deto_page/goods_deto_page.dart | 3 +- lib/pages/things_page/fixed_submit_page.dart | 37 +++++++++++++------ 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/lib/pages/goods_deto_page/goods_deto_page.dart b/lib/pages/goods_deto_page/goods_deto_page.dart index f3cd34bc..a7bbca85 100644 --- a/lib/pages/goods_deto_page/goods_deto_page.dart +++ b/lib/pages/goods_deto_page/goods_deto_page.dart @@ -50,8 +50,9 @@ class _GoodsDetoPageState extends State { return AnimatedPositioned( bottom: 0, top: 0, - left: (_canSkew(4) && _isEdit) ? 80.w : 0.w, + left: (_canSkew(model.status) && _isEdit) ? 80.w : 0.w, duration: Duration(milliseconds: 300), + curve: Curves.easeInOutCubic, width: 750.w, child: GoodsInfoCard( model: model, diff --git a/lib/pages/things_page/fixed_submit_page.dart b/lib/pages/things_page/fixed_submit_page.dart index 064a5fa0..677e8e10 100644 --- a/lib/pages/things_page/fixed_submit_page.dart +++ b/lib/pages/things_page/fixed_submit_page.dart @@ -1,4 +1,5 @@ // Flutter imports: +import 'package:akuCommunity/widget/buttons/radio_button.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -84,7 +85,7 @@ class _FixedSubmitPageState extends State { Widget _buildCard(FixedSubmitModel model) { return AnimatedPositioned( top: 0, - left: (_canSkew(model.status) && _isEdit) ? 55.w : 0, + left: (_canSkew(4) && _isEdit) ? 55.w : 0, bottom: 0, duration: Duration(milliseconds: 300), curve: Curves.easeInOutCubic, @@ -158,19 +159,31 @@ class _FixedSubmitPageState extends State { } Widget _buildCheckBox(FixedSubmitModel model) { - return Container( + return GestureDetector( + onTap: () { + if (_selected.contains(model.id)) { + _selected.remove(model.id); + } else { + _selected.add(model.id); + } + setState(() {}); + }, + child: Container( alignment: Alignment.centerLeft, constraints: BoxConstraints(minHeight: 384.w, minWidth: 686.w), - child: FixedCheckBox( - onChanged: (isSelect) { - if (isSelect) { - _selected.add(model.id); - } else { - _selected.remove(model.id); - } - setState(() {}); - }, - )); + // child: FixedCheckBox( + // onChanged: (isSelect) { + // if (isSelect) { + // _selected.add(model.id); + // } else { + // _selected.remove(model.id); + // } + // setState(() {}); + // }, + // ), + child: BeeRadio(value: model.id, groupValues: _selected), + ), + ); } Widget _showDeletDialog() { From df2bc557be1a5917e1d7a1d29485848e0daa7f4c Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 29 Jan 2021 16:52:01 +0800 Subject: [PATCH 02/14] update animate --- .../goods_deto_page/goods_deto_page.dart | 8 ++- lib/pages/things_page/fixed_submit_page.dart | 53 ++++++++++--------- .../things_page/widget/fixed_check_box.dart | 6 ++- 3 files changed, 40 insertions(+), 27 deletions(-) diff --git a/lib/pages/goods_deto_page/goods_deto_page.dart b/lib/pages/goods_deto_page/goods_deto_page.dart index a7bbca85..d8ad6199 100644 --- a/lib/pages/goods_deto_page/goods_deto_page.dart +++ b/lib/pages/goods_deto_page/goods_deto_page.dart @@ -1,12 +1,15 @@ // Flutter imports: import 'package:akuCommunity/pages/manager_func.dart'; +import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/widget/buttons/bottom_button.dart'; import 'package:akuCommunity/widget/buttons/radio_button.dart'; +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; // Package imports: import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:provider/provider.dart'; import 'package:velocity_x/velocity_x.dart'; // Project imports: @@ -62,6 +65,7 @@ class _GoodsDetoPageState extends State { @override Widget build(BuildContext context) { + UserProvider userProvider = Provider.of(context); return BeeScaffold( title: '物品出户', actions: [ @@ -124,7 +128,9 @@ class _GoodsDetoPageState extends State { _refreshController.callRefresh(); } : () { - DetoCreatePage().to(); + userProvider.isLogin + ? DetoCreatePage().to() + : BotToast.showText(text: '请先登录!'); }, child: _isEdit ? '删除'.text.size(32.sp).bold.make() diff --git a/lib/pages/things_page/fixed_submit_page.dart b/lib/pages/things_page/fixed_submit_page.dart index 677e8e10..a3bfd174 100644 --- a/lib/pages/things_page/fixed_submit_page.dart +++ b/lib/pages/things_page/fixed_submit_page.dart @@ -85,7 +85,7 @@ class _FixedSubmitPageState extends State { Widget _buildCard(FixedSubmitModel model) { return AnimatedPositioned( top: 0, - left: (_canSkew(4) && _isEdit) ? 55.w : 0, + left: (_canSkew(model.status) && _isEdit) ? 55.w : 0, bottom: 0, duration: Duration(milliseconds: 300), curve: Curves.easeInOutCubic, @@ -159,30 +159,33 @@ class _FixedSubmitPageState extends State { } Widget _buildCheckBox(FixedSubmitModel model) { - return GestureDetector( - onTap: () { - if (_selected.contains(model.id)) { - _selected.remove(model.id); - } else { - _selected.add(model.id); - } - setState(() {}); - }, - child: Container( + return + // GestureDetector( + // onTap: () { + // if (_selected.contains(model.id)) { + // _selected.remove(model.id); + // } else { + // _selected.add(model.id); + // } + // setState(() {}); + // }, + // child: + Container( alignment: Alignment.centerLeft, constraints: BoxConstraints(minHeight: 384.w, minWidth: 686.w), - // child: FixedCheckBox( - // onChanged: (isSelect) { - // if (isSelect) { - // _selected.add(model.id); - // } else { - // _selected.remove(model.id); - // } - // setState(() {}); - // }, - // ), - child: BeeRadio(value: model.id, groupValues: _selected), - ), + child: FixedCheckBox( + key:ValueKey(model.id), + onChanged: (isSelect) { + if (isSelect) { + _selected.add(model.id); + } else { + _selected.remove(model.id); + } + setState(() {}); + }, + ), + // child: BeeRadio(value: model.id, groupValues: _selected), + // ), ); } @@ -259,8 +262,8 @@ class _FixedSubmitPageState extends State { }, ).expand(), MaterialButton( - disabledColor: kDarkSubColor, - disabledTextColor: ktextSubColor, + disabledColor: Colors.white.withOpacity(0.5), + disabledTextColor: ktextSubColor.withOpacity(0.8), textColor: ktextPrimary, onPressed: _isEdit ? _selected.isEmpty diff --git a/lib/pages/things_page/widget/fixed_check_box.dart b/lib/pages/things_page/widget/fixed_check_box.dart index 3972a270..582a5403 100644 --- a/lib/pages/things_page/widget/fixed_check_box.dart +++ b/lib/pages/things_page/widget/fixed_check_box.dart @@ -17,6 +17,8 @@ class FixedCheckBox extends StatefulWidget { class _FixedCheckBoxState extends State { bool _isSelected = false; + + @override Widget build(BuildContext context) { return GestureDetector( @@ -28,6 +30,7 @@ class _FixedCheckBoxState extends State { }, child: AnimatedContainer( duration: Duration(milliseconds: 300), + curve: Curves.easeInOutCubic, alignment: Alignment.center, width: 40.w, height: 40.w, @@ -39,11 +42,12 @@ class _FixedCheckBoxState extends State { ), child: AnimatedContainer( duration: Duration(milliseconds: 300), + curve: Curves.easeInOutCubic, width: 24.w, height: 24.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular(24.w), - color: _isSelected ? kPrimaryColor : Colors.transparent, + color: kPrimaryColor.withOpacity(_isSelected?1:0) ), ), ), From 6d9f8f40fbbeeec94f550e1acf84995b05a2220f Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Fri, 29 Jan 2021 17:46:31 +0800 Subject: [PATCH 03/14] fixed some issues --- lib/model/manager/goods_out_model.dart | 41 ++++++++++++++++++- .../deto_create_page/deto_create_page.dart | 9 ++-- .../widget/goods_info_card.dart | 11 +++-- 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/lib/model/manager/goods_out_model.dart b/lib/model/manager/goods_out_model.dart index de53666b..9f326fec 100644 --- a/lib/model/manager/goods_out_model.dart +++ b/lib/model/manager/goods_out_model.dart @@ -6,6 +6,7 @@ class GoodsOutModel { int approach; int status; String movingCompanyTel; + List imgUrl; GoodsOutModel( {this.id, @@ -14,7 +15,8 @@ class GoodsOutModel { this.expectedTime, this.approach, this.status, - this.movingCompanyTel}); + this.movingCompanyTel, + this.imgUrl}); GoodsOutModel.fromJson(Map json) { id = json['id']; @@ -24,6 +26,12 @@ class GoodsOutModel { approach = json['approach']; status = json['status']; movingCompanyTel = json['movingCompanyTel']; + if (json['imgUrl'] != null) { + imgUrl = new List(); + json['imgUrl'].forEach((v) { + imgUrl.add(new ImgUrl.fromJson(v)); + }); + } } Map toJson() { @@ -35,6 +43,37 @@ class GoodsOutModel { data['approach'] = this.approach; data['status'] = this.status; data['movingCompanyTel'] = this.movingCompanyTel; + if (this.imgUrl != null) { + data['imgUrl'] = this.imgUrl.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ImgUrl { + String url; + String size; + int longs; + int paragraph; + int sort; + + ImgUrl({this.url, this.size, this.longs, this.paragraph, this.sort}); + + ImgUrl.fromJson(Map json) { + url = json['url']; + size = json['size']; + longs = json['longs']; + paragraph = json['paragraph']; + sort = json['sort']; + } + + Map toJson() { + final Map data = new Map(); + data['url'] = this.url; + data['size'] = this.size; + data['longs'] = this.longs; + data['paragraph'] = this.paragraph; + data['sort'] = this.sort; return data; } } diff --git a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart index 119b1a6d..51ff6971 100644 --- a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart +++ b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart @@ -340,7 +340,7 @@ class _DetoCreatePageState extends State { setState(() {}); } - Widget _getMovingCompany(String movingCompany) { + Widget _getMovingCompany() { return Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -350,12 +350,15 @@ class _DetoCreatePageState extends State { InkWell( onTap: () async { _selectTel = await SelectMoveCompanyPage().to(); + setState(() { + + }); }, child: Padding( padding: EdgeInsets.symmetric(vertical: 30.w), child: Row( children: [ - (movingCompany.isEmptyOrNull ? '请选择搬家公司' : movingCompany) + (_selectTel.isEmptyOrNull ? '请选择搬家公司' : _selectTel) .text .color(ktextSubColor) .size(36.sp) @@ -412,7 +415,7 @@ class _DetoCreatePageState extends State { _showItmePicker(); }), _getApproach(), - _selectApproach == 0 ? SizedBox() : _getMovingCompany(''), + _selectApproach == 0 ? SizedBox() : _getMovingCompany(), Container( margin: EdgeInsets.only(top: 54.w, bottom: 24.w), child: Text( diff --git a/lib/pages/goods_deto_page/widget/goods_info_card.dart b/lib/pages/goods_deto_page/widget/goods_info_card.dart index f7988b0a..3d6dcce8 100644 --- a/lib/pages/goods_deto_page/widget/goods_info_card.dart +++ b/lib/pages/goods_deto_page/widget/goods_info_card.dart @@ -2,6 +2,7 @@ import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/model/manager/goods_out_model.dart'; import 'package:akuCommunity/utils/bee_map.dart'; +import 'package:akuCommunity/widget/views/horizontal_image_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -36,7 +37,7 @@ class GoodsInfoCard extends StatelessWidget { ); } -Color _getColor(int state) { + Color _getColor(int state) { switch (state) { case 1: case 2: @@ -51,6 +52,7 @@ Color _getColor(int state) { return kDangerColor; } } + @override Widget build(BuildContext context) { return Container( @@ -135,14 +137,15 @@ Color _getColor(int state) { children: [ Container( alignment: Alignment.centerLeft, - margin: EdgeInsets.only(bottom: 25.w), + margin: EdgeInsets.only(bottom: 8.w), child: Text( '图片信息', style: TextStyle( fontSize: 28.sp, color: Color(0xff333333)), ), ), - ImageHorizontalList(imageUrl: []), + HorizontalImageView( + model.imgUrl.map((e) => e.url).toList()), ], ), ), @@ -150,7 +153,7 @@ Color _getColor(int state) { ), ), GoodsInfoCardButton( - id:model.id, + id: model.id, tel: model.movingCompanyTel, ) ], From 4394139404bf8a976c8b6e587c8ea0664edad8c0 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Mon, 1 Feb 2021 10:27:42 +0800 Subject: [PATCH 04/14] =?UTF-8?q?update=20goods=20borrow=20page=20?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=20=E5=80=9F=E8=BF=98=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 6 + .../goods_manage_page/goods_manage_page.dart | 133 ++++++++-------- .../mine_goods_page/mine_goods_page.dart | 150 +++++++----------- lib/pages/manager_func.dart | 1 + lib/utils/bee_map.dart | 8 +- 5 files changed, 132 insertions(+), 166 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 86d9534b..4517dca6 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -130,6 +130,12 @@ class _Manager { ///物品出户:app批量删除物品出户信息 String get articleOutDelete => '/user/articleOut/falseDelete'; + + ///借还管理:查询所有可借物品信息 + String get articleBorrow => '/user/articleBorrow/list'; + + ///借还管理:查询该用户的所有物品借还信息 + String get articleBorrowMylist => '/user/articleBorrow/myList'; } class _Community { diff --git a/lib/pages/goods_manage_page/goods_manage_page.dart b/lib/pages/goods_manage_page/goods_manage_page.dart index 356b6df7..12f69d72 100644 --- a/lib/pages/goods_manage_page/goods_manage_page.dart +++ b/lib/pages/goods_manage_page/goods_manage_page.dart @@ -1,6 +1,12 @@ // Flutter imports: +import 'package:akuCommunity/constants/api.dart'; +import 'package:akuCommunity/model/manager/article_borrow_model.dart'; +import 'package:akuCommunity/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart'; +import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; +import 'package:akuCommunity/widget/buttons/bottom_button.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; // Package imports: import 'package:velocity_x/velocity_x.dart'; @@ -8,8 +14,7 @@ import 'package:velocity_x/velocity_x.dart'; // Project imports: import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; -import 'package:akuCommunity/widget/bottom_button.dart'; -import 'package:akuCommunity/widget/cached_image_wrapper.dart'; +import 'package:akuCommunity/const/resource.dart'; class GoodsManagePage extends StatefulWidget { GoodsManagePage({Key key}) : super(key: key); @@ -19,46 +24,9 @@ class GoodsManagePage extends StatefulWidget { } class _GoodsManagePageState extends State { - List> _listGoods = [ - { - 'imagePath': - 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=409315131,2212208097&fm=26&gp=0.jpg', - 'title': '榔头', - 'goodsNum': 4 - }, - { - 'imagePath': - 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600315000206&di=d63920cce862ea3143b94f5efd9ee48f&imgtype=0&src=http%3A%2F%2Fimg009.hc360.cn%2Fy3%2FM06%2F97%2F52%2FwKhQh1T9gwqEG8-EAAAAADtr0hA725.jpg', - 'title': '梯子', - 'goodsNum': 2 - }, - { - 'imagePath': - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=742033541,898484766&fm=26&gp=0.jpg', - 'title': '电钻', - 'goodsNum': 10 - }, - { - 'imagePath': - 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=655760492,2421981969&fm=26&gp=0.jpg', - 'title': '多功能螺丝刀', - 'goodsNum': 7 - }, - { - 'imagePath': - 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600315263467&di=87b7fa8cd8bc03f5bd320f29efd00418&imgtype=0&src=http%3A%2F%2Ftu.ossfiles.cn%3A9186%2Fgroup3%2FM00%2F08%2FB6%2FrBpVfl8H3XuAOUA-AAFkF36vtNY168.jpg', - 'title': '手电筒', - 'goodsNum': 5 - }, - { - 'imagePath': - 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1922842359,3407397182&fm=26&gp=0.jpg', - 'title': '胶带', - 'goodsNum': 6 - } - ]; + EasyRefreshController _easyRefreshController; - Container _goodsCard(String imagePath, title, int goodsNum) { + Container _goodsCard(ArticleBorrowModel model) { return Container( margin: EdgeInsets.only( top: 20.w, @@ -73,28 +41,28 @@ class _GoodsManagePageState extends State { ), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(6)), + borderRadius: BorderRadius.all(Radius.circular(6.w)), ), child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( + height: 120.w, + width: 160.w, margin: EdgeInsets.only(right: 20.w), child: ClipRRect( - child: CachedImageWrapper( - url: imagePath, - width: 160.w, - height: 120.w, - ), - ), + child: FadeInImage.assetNetwork( + placeholder: R.ASSETS_IMAGES_LOGO_PNG, + image: API.image( + model.imgUrls.isEmpty ? '' : model.imgUrls.first.url))), ), Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ Text( - '物品名称:$title', + '物品名称:${model.name}', style: TextStyle( fontSize: 28.sp, color: Color(0xff4a4b51), @@ -102,7 +70,7 @@ class _GoodsManagePageState extends State { ), SizedBox(height: 20.w), Text( - '数量剩余:$goodsNum个', + '数量剩余:${model.quantity}', style: TextStyle( fontSize: 24.sp, color: Color(0xff999999), @@ -121,31 +89,56 @@ class _GoodsManagePageState extends State { title: '借还管理', actions: [ InkWell( - onTap: () {}, + onTap: () { + MineGoodsPage().to(); + }, child: Container( padding: EdgeInsets.fromLTRB(32.w, 28.w, 32.w, 20.w), alignment: Alignment.center, child: '我的借还物品'.text.black.size(28.sp).make())) ], - body: Stack( - children: [ - Column( - children: _listGoods - .map((item) => _goodsCard( - item['imagePath'], - item['title'], - item['goodsNum'], - )) - .toList(), - ), - Positioned( - bottom: 0, - child: BottomButton( - title: '扫一扫出借', - fun: () {}, - ), - ), - ], + // body: Stack( + // children: [ + // Column( + // children: _listGoods + // .map((item) => _goodsCard( + // item['imagePath'], + // item['title'], + // item['goodsNum'], + // )) + // .toList(), + // ), + // Positioned( + // bottom: 0, + // child: BottomButton( + // title: '扫一扫出借', + // fun: () {}, + // ), + // ), + // ], + // ), + + body: BeeListView( + path: API.manager.articleBorrow, + controller: _easyRefreshController, + convert: (models) { + return models.tableList + .map((e) => ArticleBorrowModel.fromJson(e)) + .toList(); + }, + builder: (items) { + return ListView.separated( + itemBuilder: (context, index) { + return _goodsCard(items[index]); + }, + separatorBuilder: (_, __) { + return 16.w.heightBox; + }, + itemCount: items.length); + }), + bottomNavi: BottomButton( + child: '扫一扫出借'.text.black.size(32.sp).bold.make(), + onPressed: () {}, ), ); } diff --git a/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart b/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart index f51e7e55..5e84ef71 100644 --- a/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart +++ b/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart @@ -1,9 +1,11 @@ // Flutter imports: +import 'package:akuCommunity/constants/api.dart'; +import 'package:akuCommunity/model/manager/mine_goods_model.dart'; +import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; +import 'package:akuCommunity/utils/bee_map.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - -// Package imports: -import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; // Project imports: import 'package:akuCommunity/utils/headers.dart'; @@ -17,76 +19,18 @@ class MineGoodsPage extends StatefulWidget { } class _MineGoodsPageState extends State { - List> _listGoods = [ - { - 'title': '榔头', - 'goodsNum': 6, - 'borrowTime': '2020.09.18 12:00', - 'timeLength': '7', - 'status': '未还' - }, - { - 'title': '梯子', - 'goodsNum': 1, - 'borrowTime': '2020.08.28 12:00', - 'timeLength': '3', - 'status': '已还' - }, - { - 'title': '电钻', - 'goodsNum': 1, - 'borrowTime': '2020.07.04 12:00', - 'timeLength': '6', - 'status': '未还' - }, - { - 'title': '多功能螺丝刀', - 'goodsNum': 4, - 'borrowTime': '2020.04.06 12:00', - 'timeLength': '4', - 'status': '已还' - }, - { - 'title': '手电筒', - 'goodsNum': 2, - 'borrowTime': '2020.02.19 12:00', - 'timeLength': '2', - 'status': '已还' - }, - { - 'title': '胶带', - 'goodsNum': 3, - 'borrowTime': '2020.01.14 12:00', - 'timeLength': '8', - 'status': '未还' - }, - ]; - - RefreshController _refreshController = - RefreshController(initialRefresh: false); + EasyRefreshController _controller; @override void initState() { super.initState(); - } - - void _onRefresh() async { - await Future.delayed(Duration(milliseconds: 1500)); - - _refreshController.refreshCompleted(); - } - - void _onLoading() async { - await Future.delayed(Duration(milliseconds: 1500)); - - if (mounted) setState(() {}); - _refreshController.loadComplete(); + _controller = EasyRefreshController(); } @override void dispose() { super.dispose(); - _refreshController.dispose(); + _controller.dispose(); } InkWell _frmLoss() { @@ -109,8 +53,15 @@ class _MineGoodsPageState extends State { ); } - Container _goodsCard( - String title, borrowTime, timeLength, status, int goodsNum) { + String _getDatelength(int date) { + if (date >= 24) { + return '${date / 24}' + '${date % 24}'; + } else { + return '$date'; + } + } + + Container _goodsCard(MineGoodsModel model) { return Container( margin: EdgeInsets.only( top: 20.w, @@ -136,7 +87,7 @@ class _MineGoodsPageState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ Text( - '物品名称:$title', + '物品名称:${model.name}', style: TextStyle( fontSize: 28.sp, color: Color(0xff4a4b51), @@ -145,7 +96,7 @@ class _MineGoodsPageState extends State { Container( margin: EdgeInsets.only(top: 16.w), child: Text( - '借还数量:$goodsNum个', + '借还数量:10个', style: TextStyle( fontSize: 24.sp, color: Color(0xff333333), @@ -155,7 +106,7 @@ class _MineGoodsPageState extends State { Container( margin: EdgeInsets.only(top: 16.w), child: Text( - '借用时间: $borrowTime', + '借用时间: ${model.beginDate}', style: TextStyle( fontSize: 24.sp, color: Color(0xff999999), @@ -165,7 +116,7 @@ class _MineGoodsPageState extends State { Container( margin: EdgeInsets.only(top: 16.w), child: Text( - '借用时长: $timeLength日', + '借用时长: ${_getDatelength(model.borrowDate)}', style: TextStyle( fontSize: 24.sp, color: Color(0xff999999), @@ -178,7 +129,7 @@ class _MineGoodsPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - '借用状态: $status', + '借用状态: ${BeeMap.borrowStatus}', style: TextStyle( fontSize: 24.sp, color: Color(0xff999999), @@ -190,11 +141,11 @@ class _MineGoodsPageState extends State { ), SizedBox(height: 12.w), Divider(color: Color(0xfff9f9f9)), - status == '未还' + model.borrowStatus == 1 ? Container( margin: EdgeInsets.only(bottom: 9.w), child: Text( - '温馨提示:您的物品已借用$timeLength天,如果用完,请及时归还', + '温馨提示:您的物品已借用${_getDatelength(model.borrowDate)},如果用完,请及时归还', style: TextStyle( fontSize: 22.sp, color: Color(0xff999999), @@ -214,26 +165,39 @@ class _MineGoodsPageState extends State { Widget build(BuildContext context) { return BeeScaffold( title: '我的借还物品', - body: RefreshConfiguration( - child: SmartRefresher( - controller: _refreshController, - header: WaterDropHeader(), - footer: ClassicFooter(), - onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullUp: true, - child: ListView.builder( - itemBuilder: (BuildContext context, int index) => _goodsCard( - _listGoods[index]['title'], - _listGoods[index]['borrowTime'], - _listGoods[index]['timeLength'], - _listGoods[index]['status'], - _listGoods[index]['goodsNum'], - ), - itemCount: _listGoods.length, - ), - ), - ), + // body: RefreshConfiguration( + // child: SmartRefresher( + // controller: _refreshController, + // header: WaterDropHeader(), + // footer: ClassicFooter(), + // onRefresh: _onRefresh, + // onLoading: _onLoading, + // enablePullUp: true, + // child: ListView.builder( + // itemBuilder: (BuildContext context, int index) => _goodsCard( + // _listGoods[index]['title'], + // _listGoods[index]['borrowTime'], + // _listGoods[index]['timeLength'], + // _listGoods[index]['status'], + // _listGoods[index]['goodsNum'], + // ), + // itemCount: _listGoods.length, + // ), + // ), + // ), + body: BeeListView( + path: API.manager.articleBorrowMylist, + controller: _controller, + convert: (model) { + return model.tableList + .map((e) => MineGoodsModel.fromJson(e)) + .toList(); + }, + builder: (items) { + return ListView.builder(itemBuilder: (context, index) { + return _goodsCard(items[index]); + }); + }), ); } } diff --git a/lib/pages/manager_func.dart b/lib/pages/manager_func.dart index 9c418fe9..1b86ea40 100644 --- a/lib/pages/manager_func.dart +++ b/lib/pages/manager_func.dart @@ -147,4 +147,5 @@ class ManagerFunc { ); return baseModel; } + } diff --git a/lib/utils/bee_map.dart b/lib/utils/bee_map.dart index 25c21f30..c5a54dc2 100644 --- a/lib/utils/bee_map.dart +++ b/lib/utils/bee_map.dart @@ -32,8 +32,10 @@ class BeeMap { 2: '50kg-100kg', 3: '> 100kg', }; - Map goodsOutApproach={ - 1:'自己搬运', - 2:'搬家公司', + Map goodsOutApproach = { + 1: '自己搬运', + 2: '搬家公司', }; + + static Map borrowStatus = {1: '出借中', 2: '已归还'}; } From e34ef21ad0a3139d3369a6541ea945717e30cfc3 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Mon, 1 Feb 2021 10:39:57 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=EF=BC=9A=E5=80=9F?= =?UTF-8?q?=E8=BF=98=E7=AE=A1=E7=90=86=EF=BC=9A=E6=9F=A5=E8=AF=A2=E8=AF=A5?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9A=84=E6=89=80=E6=9C=89=E7=89=A9=E5=93=81?= =?UTF-8?q?=E5=80=9F=E8=BF=98=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/model/manager/article_borrow_model.dart | 33 +++++++++++++++ lib/model/manager/mine_goods_model.dart | 40 +++++++++++++++++++ .../goods_manage_page/goods_manage_page.dart | 20 ---------- .../mine_goods_page/mine_goods_page.dart | 9 +++-- 4 files changed, 79 insertions(+), 23 deletions(-) create mode 100644 lib/model/manager/article_borrow_model.dart create mode 100644 lib/model/manager/mine_goods_model.dart diff --git a/lib/model/manager/article_borrow_model.dart b/lib/model/manager/article_borrow_model.dart new file mode 100644 index 00000000..3aaf202f --- /dev/null +++ b/lib/model/manager/article_borrow_model.dart @@ -0,0 +1,33 @@ +import 'package:akuCommunity/model/common/img_model.dart'; + +class ArticleBorrowModel { + int id; + String name; + int quantity; + List imgUrls; + + ArticleBorrowModel({this.id, this.name, this.quantity, this.imgUrls}); + + ArticleBorrowModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + quantity = json['quantity']; + if (json['imgUrls'] != null) { + imgUrls = new List(); + json['imgUrls'].forEach((v) { + imgUrls.add(new ImgModel.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['quantity'] = this.quantity; + if (this.imgUrls != null) { + data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + } + return data; + } +} diff --git a/lib/model/manager/mine_goods_model.dart b/lib/model/manager/mine_goods_model.dart new file mode 100644 index 00000000..6f77f281 --- /dev/null +++ b/lib/model/manager/mine_goods_model.dart @@ -0,0 +1,40 @@ +class MineGoodsModel { + int id; + String name; + int code; + String beginDate; + String endDate; + int borrowDate; + int borrowStatus; + + MineGoodsModel( + {this.id, + this.name, + this.code, + this.beginDate, + this.endDate, + this.borrowDate, + this.borrowStatus}); + + MineGoodsModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + code = json['code']; + beginDate = json['beginDate']; + endDate = json['endDate']; + borrowDate = json['borrowDate']; + borrowStatus = json['borrowStatus']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['code'] = this.code; + data['beginDate'] = this.beginDate; + data['endDate'] = this.endDate; + data['borrowDate'] = this.borrowDate; + data['borrowStatus'] = this.borrowStatus; + return data; + } +} diff --git a/lib/pages/goods_manage_page/goods_manage_page.dart b/lib/pages/goods_manage_page/goods_manage_page.dart index 12f69d72..f42b194f 100644 --- a/lib/pages/goods_manage_page/goods_manage_page.dart +++ b/lib/pages/goods_manage_page/goods_manage_page.dart @@ -97,26 +97,6 @@ class _GoodsManagePageState extends State { alignment: Alignment.center, child: '我的借还物品'.text.black.size(28.sp).make())) ], - // body: Stack( - // children: [ - // Column( - // children: _listGoods - // .map((item) => _goodsCard( - // item['imagePath'], - // item['title'], - // item['goodsNum'], - // )) - // .toList(), - // ), - // Positioned( - // bottom: 0, - // child: BottomButton( - // title: '扫一扫出借', - // fun: () {}, - // ), - // ), - // ], - // ), body: BeeListView( path: API.manager.articleBorrow, diff --git a/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart b/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart index 5e84ef71..6fd9cb5b 100644 --- a/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart +++ b/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart @@ -194,9 +194,12 @@ class _MineGoodsPageState extends State { .toList(); }, builder: (items) { - return ListView.builder(itemBuilder: (context, index) { - return _goodsCard(items[index]); - }); + return ListView.builder( + itemBuilder: (context, index) { + return _goodsCard(items[index]); + }, + itemCount: items.length, + ); }), ); } From 7fc9cd8aba943842973afa4750ab64bdc8ec10ff Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Mon, 1 Feb 2021 10:48:33 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=EF=BC=9A=E6=8A=A5?= =?UTF-8?q?=E6=8D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 3 +++ .../mine_goods_page/mine_goods_page.dart | 9 ++++++--- lib/pages/manager_func.dart | 10 ++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 4517dca6..3482c98d 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -136,6 +136,9 @@ class _Manager { ///借还管理:查询该用户的所有物品借还信息 String get articleBorrowMylist => '/user/articleBorrow/myList'; + + ///借还管理:报损 + String get fromLoss => '/user/articleBorrow/frmLoss'; } class _Community { diff --git a/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart b/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart index 6fd9cb5b..3d091341 100644 --- a/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart +++ b/lib/pages/goods_manage_page/mine_goods_page/mine_goods_page.dart @@ -1,6 +1,7 @@ // Flutter imports: import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/model/manager/mine_goods_model.dart'; +import 'package:akuCommunity/pages/manager_func.dart'; import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; import 'package:akuCommunity/utils/bee_map.dart'; import 'package:flutter/cupertino.dart'; @@ -33,9 +34,11 @@ class _MineGoodsPageState extends State { _controller.dispose(); } - InkWell _frmLoss() { + InkWell _frmLoss(int id) { return InkWell( - onTap: () {}, + onTap: () async { + await ManagerFunc.fromLoss(id); + }, child: Container( width: 120.w, height: 44.w, @@ -135,7 +138,7 @@ class _MineGoodsPageState extends State { color: Color(0xff999999), ), ), - _frmLoss(), + _frmLoss(model.id), ], ), ), diff --git a/lib/pages/manager_func.dart b/lib/pages/manager_func.dart index 1b86ea40..9e1a2155 100644 --- a/lib/pages/manager_func.dart +++ b/lib/pages/manager_func.dart @@ -148,4 +148,14 @@ class ManagerFunc { return baseModel; } + static Future fromLoss(int id)async{ + BaseModel baseModel = await NetUtil().post( + API.manager.fromLoss, + params: { + 'articleBorrowId':id + }, + showMessage: true, + ); + return baseModel; + } } From 5c08941e3490cd451e6e31569867faff64a368a9 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Mon, 1 Feb 2021 14:57:28 +0800 Subject: [PATCH 07/14] dock interface:dailyPayment/list --- lib/constants/api.dart | 3 + lib/model/manager/life_pay_model.dart | 138 ++++++++++++++++++++++ lib/pages/life_pay/life_pay_page.dart | 119 ++++++++++++------- lib/pages/life_pay/widget/order_card.dart | 19 ++- 4 files changed, 225 insertions(+), 54 deletions(-) create mode 100644 lib/model/manager/life_pay_model.dart diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 3482c98d..0da0fa35 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -139,6 +139,9 @@ class _Manager { ///借还管理:报损 String get fromLoss => '/user/articleBorrow/frmLoss'; + + ///生活缴费:查询生活缴费信息list + String get dailyPaymentList => '/user/dailyPayment/list'; } class _Community { diff --git a/lib/model/manager/life_pay_model.dart b/lib/model/manager/life_pay_model.dart new file mode 100644 index 00000000..fc23dbb2 --- /dev/null +++ b/lib/model/manager/life_pay_model.dart @@ -0,0 +1,138 @@ +class LifePayMolde { + int years; + int paymentNum; + List dailyPaymentTypeVos; + + LifePayMolde({this.years, this.paymentNum, this.dailyPaymentTypeVos}); + + LifePayMolde.fromJson(Map json) { + years = json['years']; + paymentNum = json['paymentNum']; + if (json['dailyPaymentTypeVos'] != null) { + dailyPaymentTypeVos = new List(); + json['dailyPaymentTypeVos'].forEach((v) { + dailyPaymentTypeVos.add(new DailyPaymentTypeVos.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['years'] = this.years; + data['paymentNum'] = this.paymentNum; + if (this.dailyPaymentTypeVos != null) { + data['dailyPaymentTypeVos'] = + this.dailyPaymentTypeVos.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class DailyPaymentTypeVos { + int id; + String name; + List detailedVoList; + + DailyPaymentTypeVos({this.id, this.name, this.detailedVoList}); + + DailyPaymentTypeVos.fromJson(Map json) { + id = json['id']; + name = json['name']; + if (json['detailedVoList'] != null) { + detailedVoList = new List(); + json['detailedVoList'].forEach((v) { + detailedVoList.add(new DetailedVoList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + if (this.detailedVoList != null) { + data['detailedVoList'] = + this.detailedVoList.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class DetailedVoList { + int groupId; + int paymentPrice; + List detailsVoList; + + DetailedVoList({this.groupId, this.paymentPrice, this.detailsVoList}); + + DetailedVoList.fromJson(Map json) { + groupId = json['groupId']; + paymentPrice = json['paymentPrice']; + if (json['detailsVoList'] != null) { + detailsVoList = new List(); + json['detailsVoList'].forEach((v) { + detailsVoList.add(new DetailsVoList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['groupId'] = this.groupId; + data['paymentPrice'] = this.paymentPrice; + if (this.detailsVoList != null) { + data['detailsVoList'] = + this.detailsVoList.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class DetailsVoList { + int id; + String month; + int costPrice; + int paidPrice; + int totalPrice; + String beginDate; + String endDate; + String unitPriceType; + int num; + + DetailsVoList( + {this.id, + this.month, + this.costPrice, + this.paidPrice, + this.totalPrice, + this.beginDate, + this.endDate, + this.unitPriceType, + this.num}); + + DetailsVoList.fromJson(Map json) { + id = json['id']; + month = json['month']; + costPrice = json['costPrice']; + paidPrice = json['paidPrice']; + totalPrice = json['totalPrice']; + beginDate = json['beginDate']; + endDate = json['endDate']; + unitPriceType = json['unitPriceType']; + num = json['num']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['month'] = this.month; + data['costPrice'] = this.costPrice; + data['paidPrice'] = this.paidPrice; + data['totalPrice'] = this.totalPrice; + data['beginDate'] = this.beginDate; + data['endDate'] = this.endDate; + data['unitPriceType'] = this.unitPriceType; + data['num'] = this.num; + return data; + } +} diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index 1a825d83..bad4699e 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -1,18 +1,20 @@ // Flutter imports: +import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/constants/api.dart'; +import 'package:akuCommunity/model/manager/life_pay_model.dart'; +import 'package:akuCommunity/pages/personal/widget/order_card.dart'; +import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; // Package imports: import 'package:velocity_x/velocity_x.dart'; // Project imports: -import 'package:akuCommunity/pages/life_pay/life_pay_info_page/life_pay_info_page.dart'; import 'package:akuCommunity/pages/life_pay/life_pay_record_page/life_pay_record_page.dart'; -import 'package:akuCommunity/routers/page_routers.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; -import 'widget/order_card.dart'; -import 'widget/submit_bar.dart'; class LifePayPage extends StatefulWidget { LifePayPage({Key key}) : super(key: key); @@ -22,6 +24,21 @@ class LifePayPage extends StatefulWidget { } class _LifePayPageState extends State { + EasyRefreshController _controller; + @override + void initState() { + super.initState(); + _controller = EasyRefreshController(); + } + + @override + void dispose() { + _controller?.dispose(); + super.dispose(); + } + + + @override Widget build(BuildContext context) { return BeeScaffold( @@ -38,45 +55,61 @@ class _LifePayPageState extends State { ), ), ], - body: Stack( - children: [ - ListView( - padding: EdgeInsets.only(bottom: 130.w), - children: [ - Container( - margin: EdgeInsets.only( - top: 32.w, - left: 32.w, - right: 32.w, - ), - child: RichText( - text: TextSpan( - style: - TextStyle(fontSize: 28.sp, color: Color(0xff666666)), - children: [ - TextSpan( - text: '深圳华茂悦峰', - ), - TextSpan( - text: '1幢-1单元-702室', - style: TextStyle(fontWeight: FontWeight.bold), - ), - ]), - ), - ), - OrderCard( - fun: LifePayInfoPage( - bundle: Bundle() - ..putMap('commentMap', {'title': '明细', 'isActions': false}), - ).to), - ], - ), - Positioned( - bottom: 0, - child: SubmitBar(title: '去缴费'), - ), - ], - ), + // body: Stack( + // children: [ + // ListView( + // padding: EdgeInsets.only(bottom: 130.w), + // children: [ + // Container( + // margin: EdgeInsets.only( + // top: 32.w, + // left: 32.w, + // right: 32.w, + // ), + // child: RichText( + // text: TextSpan( + // style: + // TextStyle(fontSize: 28.sp, color: Color(0xff666666)), + // children: [ + // TextSpan( + // text: '深圳华茂悦峰', + // ), + // TextSpan( + // text: '1幢-1单元-702室', + // style: TextStyle(fontWeight: FontWeight.bold), + // ), + // ]), + // ), + // ), + // OrderCard( + // fun: LifePayInfoPage( + // bundle: Bundle() + // ..putMap('commentMap', {'title': '明细', 'isActions': false}), + // ).to), + // ], + // ), + // Positioned( + // bottom: 0, + // child: SubmitBar(title: '去缴费'), + // ), + // ], + // ), + body: BeeListView( + path: API.manager.dailyPaymentList, + controller: _controller, + convert: (model) { + return model.tableList + .map((e) => LifePayMolde.fromJson(e)) + .toList(); + }, + builder: (items){ + return ListView.builder(itemBuilder: (context, index){ + // return _buildCard(items[index]); + return OrderCard(); + }, + // itemCount: items.length, + ) ; + }), ); } } diff --git a/lib/pages/life_pay/widget/order_card.dart b/lib/pages/life_pay/widget/order_card.dart index 959b4558..327df524 100644 --- a/lib/pages/life_pay/widget/order_card.dart +++ b/lib/pages/life_pay/widget/order_card.dart @@ -4,20 +4,17 @@ import 'package:flutter/material.dart'; // Project imports: import 'package:akuCommunity/base/base_style.dart'; -import 'package:akuCommunity/pages/life_pay/life_pay_info_page/life_pay_info_page.dart'; -import 'package:akuCommunity/routers/page_routers.dart'; import 'package:akuCommunity/utils/headers.dart'; class OrderCard extends StatefulWidget { - final Function fun; - OrderCard({Key key,this.fun}) : super(key: key); + OrderCard({Key key,}) : super(key: key); @override _OrderCardState createState() => _OrderCardState(); } class _OrderCardState extends State { - Container _orderInfo() { + Widget _orderInfo() { return Container( margin: EdgeInsets.only( top: 20.w, @@ -77,11 +74,11 @@ class _OrderCardState extends State { ); } - InkWell _checkInfo(Function fun) { + Widget _checkInfo() { return InkWell( onTap: (){ - LifePayInfoPage(bundle: Bundle() - ..putMap('detailMap', {'title': '去年(2019年)'}),).to; + // LifePayInfoPage(bundle: Bundle() + // ..putMap('detailMap', {'title': '去年(2019年)'}),).to; }, child: Container( margin: EdgeInsets.only(top: 20.w), @@ -115,7 +112,7 @@ class _OrderCardState extends State { padding: EdgeInsets.symmetric(horizontal: 32.w), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(6)), + borderRadius: BorderRadius.all(Radius.circular(8.w)), ), child: InkWell( onTap: () {}, @@ -132,8 +129,8 @@ class _OrderCardState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ - _orderInfo(), - _checkInfo(widget.fun), + // _orderInfo(), + // _checkInfo(), ], ), ) From 013cf1dfd86ddfbf1aaa42b1d3ded213e9583252 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Tue, 2 Feb 2021 13:56:24 +0800 Subject: [PATCH 08/14] update life pay page --- lib/pages/life_pay/life_pay_page.dart | 124 ++++++++++++++++---------- lib/widget/buttons/bee_check_box.dart | 23 +++-- 2 files changed, 92 insertions(+), 55 deletions(-) diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index bad4699e..bd14a809 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -4,6 +4,7 @@ import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/model/manager/life_pay_model.dart'; import 'package:akuCommunity/pages/personal/widget/order_card.dart'; import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; +import 'package:akuCommunity/widget/buttons/bee_check_box.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; @@ -37,7 +38,70 @@ class _LifePayPageState extends State { super.dispose(); } - + String _getCustomYears(int year) { + int dif = year - DateTime.now().year; + if (dif < 0) { + if (dif == -1) { + return '去年'; + } else if (dif == -2) { + return '前年'; + } else { + return '${-dif}年前'; + } + } else if (dif == 0) { + return '今年'; + } else { + if (dif == 1) { + return '明年'; + } else { + return '$dif年后'; + } + } + } + + Widget _buildCard(LifePayMolde model) { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), color: kForeGroundColor), + child: Row( + children: [ + BeeCheckBox.round(), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '${_getCustomYears(model.years)}(${model.years})' + .text + .color(ktextSubColor) + .size(28.sp) + .make(), + 24.w.heightBox, + '待缴:${model.paymentNum}项' + .text + .color(ktextPrimary) + .size(28.sp) + .make(), + 24.w.heightBox, + RichText( + text: TextSpan( + text: '合计:', + style: TextStyle( + color: ktextPrimary, + fontSize: 28.sp, + fontWeight: FontWeight.bold), + children: [ + TextSpan( + text: '¥', + style: TextStyle( + color: kDangerColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold)), + ])) + ], + ), + ], + ), + ); + } @override Widget build(BuildContext context) { @@ -55,45 +119,6 @@ class _LifePayPageState extends State { ), ), ], - // body: Stack( - // children: [ - // ListView( - // padding: EdgeInsets.only(bottom: 130.w), - // children: [ - // Container( - // margin: EdgeInsets.only( - // top: 32.w, - // left: 32.w, - // right: 32.w, - // ), - // child: RichText( - // text: TextSpan( - // style: - // TextStyle(fontSize: 28.sp, color: Color(0xff666666)), - // children: [ - // TextSpan( - // text: '深圳华茂悦峰', - // ), - // TextSpan( - // text: '1幢-1单元-702室', - // style: TextStyle(fontWeight: FontWeight.bold), - // ), - // ]), - // ), - // ), - // OrderCard( - // fun: LifePayInfoPage( - // bundle: Bundle() - // ..putMap('commentMap', {'title': '明细', 'isActions': false}), - // ).to), - // ], - // ), - // Positioned( - // bottom: 0, - // child: SubmitBar(title: '去缴费'), - // ), - // ], - // ), body: BeeListView( path: API.manager.dailyPaymentList, controller: _controller, @@ -102,13 +127,18 @@ class _LifePayPageState extends State { .map((e) => LifePayMolde.fromJson(e)) .toList(); }, - builder: (items){ - return ListView.builder(itemBuilder: (context, index){ - // return _buildCard(items[index]); - return OrderCard(); - }, - // itemCount: items.length, - ) ; + builder: (items) { + return Column( + children: [ + ListView.builder( + itemBuilder: (context, index) { + // return _buildCard(items[index]); + return _buildCard(items[index]); + }, + itemCount: 1, + ), + ], + ); }), ); } diff --git a/lib/widget/buttons/bee_check_box.dart b/lib/widget/buttons/bee_check_box.dart index 34cb0a1b..ec81d552 100644 --- a/lib/widget/buttons/bee_check_box.dart +++ b/lib/widget/buttons/bee_check_box.dart @@ -8,13 +8,19 @@ import 'package:akuCommunity/utils/headers.dart'; class BeeCheckBox extends StatefulWidget { final Function(bool) onChange; - BeeCheckBox({Key key, this.onChange}) : super(key: key); - + final bool isRound; + final double size; + BeeCheckBox({Key key, this.onChange, this.isRound, this.size}) + : super(key: key); + BeeCheckBox.round({Key key, this.onChange, this.size}) + : this.isRound = true, + super(key: key); @override _BeeCheckBoxState createState() => _BeeCheckBoxState(); } class _BeeCheckBoxState extends State { + double get boxSize => widget.size ?? 28.w; bool _isSelect = false; @override Widget build(BuildContext context) { @@ -27,13 +33,14 @@ class _BeeCheckBoxState extends State { child: AnimatedContainer( duration: Duration(milliseconds: 300), decoration: BoxDecoration( - border: Border.all( - width: 1.w, color: _isSelect ? kPrimaryColor : kDarkSubColor), - color: _isSelect ? kPrimaryColor : Colors.transparent, - ), + border: Border.all( + width: 1.w, color: _isSelect ? kPrimaryColor : kDarkSubColor), + color: _isSelect ? kPrimaryColor : Colors.transparent, + borderRadius: + BorderRadius.circular(widget.isRound ? boxSize / 2 : 0)), curve: Curves.easeInOutCubic, - width: 28.w, - height: 28.w, + width: boxSize, + height: boxSize, child: _isSelect ? Icon( CupertinoIcons.check_mark, From c954ef2a427004779c7fc91dcbeb651fede7a07f Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Tue, 2 Feb 2021 15:33:56 +0800 Subject: [PATCH 09/14] add house head card --- lib/pages/life_pay/life_pay_page.dart | 105 +++++++++++++----- .../widget/add_fixed_submit_page.dart | 8 +- lib/utils/bee_parse.dart | 23 +++- 3 files changed, 105 insertions(+), 31 deletions(-) diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index bd14a809..11f4792a 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -1,13 +1,19 @@ // Flutter imports: import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/const/resource.dart'; import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/model/manager/life_pay_model.dart'; import 'package:akuCommunity/pages/personal/widget/order_card.dart'; import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; +import 'package:akuCommunity/provider/user_provider.dart'; +import 'package:akuCommunity/utils/bee_parse.dart'; +import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/buttons/bee_check_box.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get_state_manager/get_state_manager.dart'; +import 'package:provider/provider.dart'; // Package imports: import 'package:velocity_x/velocity_x.dart'; @@ -38,25 +44,49 @@ class _LifePayPageState extends State { super.dispose(); } - String _getCustomYears(int year) { - int dif = year - DateTime.now().year; - if (dif < 0) { - if (dif == -1) { - return '去年'; - } else if (dif == -2) { - return '前年'; - } else { - return '${-dif}年前'; - } - } else if (dif == 0) { - return '今年'; - } else { - if (dif == 1) { - return '明年'; - } else { - return '$dif年后'; - } - } + Widget _buildHouseCard( + String title, + String detail, + ) { + return Padding( + padding: EdgeInsets.all(32.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '报修房屋'.text.black.size(28.sp).make(), + 32.w.heightBox, + GestureDetector( + onTap: () {}, + child: Row( + children: [ + Image.asset( + R.ASSETS_ICONS_HOUSE_PNG, + width: 60.w, + height: 60.w, + ), + 40.w.widthBox, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + title.text.black.size(32.sp).bold.make(), + 10.w.heightBox, + detail.text.black.size(32.sp).bold.make() + ], + ), + ), + Icon( + CupertinoIcons.chevron_forward, + size: 40.w, + ), + ], + ), + ), + 24.w.heightBox, + BeeDivider.horizontal(), + ], + ), + ); } Widget _buildCard(LifePayMolde model) { @@ -64,12 +94,15 @@ class _LifePayPageState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular(8.w), color: kForeGroundColor), child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ - BeeCheckBox.round(), + BeeCheckBox.round( + onChange: (value) {}, + ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - '${_getCustomYears(model.years)}(${model.years})' + '${BeeParse.getCustomYears(model.years)}(${model.years})' .text .color(ktextSubColor) .size(28.sp) @@ -98,6 +131,23 @@ class _LifePayPageState extends State { ])) ], ), + Column( + children: [ + GestureDetector( + onTap: () {}, + child: Container( + decoration: BoxDecoration( + color: Color(0xFF2A2A2A), + borderRadius: BorderRadius.circular(22.w), + ), + padding: + EdgeInsets.symmetric(horizontal: 20.w, vertical: 8.w), + child: '选择明细'.text.color(Colors.white).size(22.sp).make(), + ), + ), + Spacer(), + ], + ), ], ), ); @@ -105,6 +155,7 @@ class _LifePayPageState extends State { @override Widget build(BuildContext context) { + UserProvider userProvider = Provider.of(context); return BeeScaffold( title: '生活缴费', actions: [ @@ -128,15 +179,19 @@ class _LifePayPageState extends State { .toList(); }, builder: (items) { - return Column( + return + Column( children: [ + // _buildHouseCard(kEstateName, userProvider.userDetailModel.estateNames.isEmpty + // ? '' + // : BeeParse.getEstateName( + // userProvider.userDetailModel.estateNames[0])), ListView.builder( itemBuilder: (context, index) { - // return _buildCard(items[index]); return _buildCard(items[index]); }, - itemCount: 1, - ), + itemCount: items.length, + ).expand(), ], ); }), diff --git a/lib/pages/things_page/widget/add_fixed_submit_page.dart b/lib/pages/things_page/widget/add_fixed_submit_page.dart index aa48d944..189cd7a4 100644 --- a/lib/pages/things_page/widget/add_fixed_submit_page.dart +++ b/lib/pages/things_page/widget/add_fixed_submit_page.dart @@ -84,10 +84,10 @@ class _AddFixedSubmitPageState extends State { ], ), ), - // Icon( - // CupertinoIcons.chevron_forward, - // size: 40.w, - // ), + Icon( + CupertinoIcons.chevron_forward, + size: 40.w, + ), ], ), ), diff --git a/lib/utils/bee_parse.dart b/lib/utils/bee_parse.dart index 655d9343..46c0bac4 100644 --- a/lib/utils/bee_parse.dart +++ b/lib/utils/bee_parse.dart @@ -1,9 +1,28 @@ -class BeeParse{ +class BeeParse { static int getEstateNameId(String estateName) { int a = int.parse(estateName.split('|')[0]); return a; } + static String getEstateName(String estateNmae) { return estateNmae.split('|')[1]; } -} \ No newline at end of file + + static String getCustomYears(int year) { + int dif = year - DateTime.now().year; + switch (dif) { + case -1: + return '去年'; + break; + case 0: + return '今年'; + case 1: + return '明年'; + default: + if (dif < 0) return '${-dif}年前'; + // } else { + return '$dif年后'; + // } + } + } +} From 1fe0e6277305d0f2de76b503c0099970663082a4 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Tue, 2 Feb 2021 16:17:38 +0800 Subject: [PATCH 10/14] add bottom button --- lib/pages/life_pay/life_pay_page.dart | 163 ++++++++++++++++++-------- 1 file changed, 113 insertions(+), 50 deletions(-) diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index 11f4792a..d16598ab 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -48,43 +48,45 @@ class _LifePayPageState extends State { String title, String detail, ) { - return Padding( - padding: EdgeInsets.all(32.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - '报修房屋'.text.black.size(28.sp).make(), - 32.w.heightBox, - GestureDetector( - onTap: () {}, - child: Row( - children: [ - Image.asset( - R.ASSETS_ICONS_HOUSE_PNG, - width: 60.w, - height: 60.w, - ), - 40.w.widthBox, - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - title.text.black.size(32.sp).bold.make(), - 10.w.heightBox, - detail.text.black.size(32.sp).bold.make() - ], + return Material( + color: kForeGroundColor, + child: Padding( + padding: EdgeInsets.all(32.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '当前房屋'.text.black.size(28.sp).make(), + 32.w.heightBox, + GestureDetector( + onTap: () {}, + child: Row( + children: [ + Image.asset( + R.ASSETS_ICONS_HOUSE_PNG, + width: 60.w, + height: 60.w, ), - ), - Icon( - CupertinoIcons.chevron_forward, - size: 40.w, - ), - ], + 40.w.widthBox, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + title.text.black.size(32.sp).bold.make(), + 10.w.heightBox, + detail.text.black.size(32.sp).bold.make() + ], + ), + ), + Icon( + CupertinoIcons.chevron_forward, + size: 40.w, + ), + ], + ), ), - ), - 24.w.heightBox, - BeeDivider.horizontal(), - ], + 24.w.heightBox, + ], + ), ), ); } @@ -96,11 +98,17 @@ class _LifePayPageState extends State { child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ - BeeCheckBox.round( - onChange: (value) {}, + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + BeeCheckBox.round( + onChange: (value) {}, + ), + ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ '${BeeParse.getCustomYears(model.years)}(${model.years})' .text @@ -132,6 +140,8 @@ class _LifePayPageState extends State { ], ), Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, children: [ GestureDetector( onTap: () {}, @@ -145,7 +155,6 @@ class _LifePayPageState extends State { child: '选择明细'.text.color(Colors.white).size(22.sp).make(), ), ), - Spacer(), ], ), ], @@ -179,22 +188,76 @@ class _LifePayPageState extends State { .toList(); }, builder: (items) { - return - Column( + return Column( children: [ - // _buildHouseCard(kEstateName, userProvider.userDetailModel.estateNames.isEmpty - // ? '' - // : BeeParse.getEstateName( - // userProvider.userDetailModel.estateNames[0])), - ListView.builder( - itemBuilder: (context, index) { - return _buildCard(items[index]); - }, - itemCount: items.length, - ).expand(), + _buildHouseCard( + kEstateName, + userProvider.userDetailModel.estateNames.isEmpty + ? '' + : BeeParse.getEstateName( + userProvider.userDetailModel.estateNames[0])), + 16.w.heightBox, + Container( + padding: EdgeInsets.all(32.w), + width: double.infinity, + color: kForeGroundColor, + constraints: BoxConstraints(minHeight: 20.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '缴费账单'.text.color(ktextPrimary).size(28.sp).make(), + ...List.generate( + items.length, (index) => _buildCard(items[index])), + ], + ), + ), ], ); }), + bottomNavi: Container( + padding: EdgeInsets.fromLTRB( + 32.w, 16.w, 32.w, 12.w + MediaQuery.of(context).padding.bottom), + child: Row( + children: [ + BeeCheckBox.round( + onChange: (value) {}, + size: 40.w, + ), + Spacer(), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + RichText( + text: TextSpan( + text: '合计:', + style: TextStyle( + color: ktextPrimary, + fontSize: 32.sp, + fontWeight: FontWeight.bold), + children: [ + TextSpan( + text: '¥3009.84', + style: TextStyle( + color: kDangerColor, + fontSize: 32.sp, + fontWeight: FontWeight.bold)), + ])), + '已选10项'.text.color(ktextSubColor).size(20.sp).make(), + ], + ), + MaterialButton( + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(37.w)), + color: kPrimaryColor, + padding: EdgeInsets.symmetric(horizontal: 50.w, vertical: 15.w), + onPressed: () {}, + child: '去缴费'.text.black.size(32.sp).bold.make(), + ), + ], + ), + ), ); } } From 1257b68c04414d812b3e6fac5df8c5b7ac72d2d4 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Tue, 2 Feb 2021 17:47:57 +0800 Subject: [PATCH 11/14] add select my house page --- .gitignore | 4 +- lib/pages/life_pay/life_pay_page.dart | 5 +- lib/pages/life_pay/widget/my_house_page.dart | 84 ++++++++++++++++++++ 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 lib/pages/life_pay/widget/my_house_page.dart diff --git a/.gitignore b/.gitignore index 62531705..69906469 100644 --- a/.gitignore +++ b/.gitignore @@ -58,4 +58,6 @@ coverage/ !**/ios/**/default.mode2v3 !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages \ No newline at end of file +!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +commit.csv +.~lock.commit.csv# diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index d16598ab..913564a4 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -3,6 +3,7 @@ import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/const/resource.dart'; import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/model/manager/life_pay_model.dart'; +import 'package:akuCommunity/pages/life_pay/widget/my_house_page.dart'; import 'package:akuCommunity/pages/personal/widget/order_card.dart'; import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; import 'package:akuCommunity/provider/user_provider.dart'; @@ -58,7 +59,9 @@ class _LifePayPageState extends State { '当前房屋'.text.black.size(28.sp).make(), 32.w.heightBox, GestureDetector( - onTap: () {}, + onTap: () { + MyHousePage().to(); + }, child: Row( children: [ Image.asset( diff --git a/lib/pages/life_pay/widget/my_house_page.dart b/lib/pages/life_pay/widget/my_house_page.dart new file mode 100644 index 00000000..c9f73687 --- /dev/null +++ b/lib/pages/life_pay/widget/my_house_page.dart @@ -0,0 +1,84 @@ +import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/pages/goods_deto_page/deto_create_page/widget/common_radio.dart'; +import 'package:akuCommunity/widget/bee_divider.dart'; +import 'package:akuCommunity/widget/bee_scaffold.dart'; +import 'package:akuCommunity/widget/buttons/radio_button.dart'; +import 'package:flutter/material.dart'; +import 'package:akuCommunity/utils/headers.dart'; + +class MyHousePage extends StatefulWidget { + final List estateNames; + MyHousePage({Key key, this.estateNames}) : super(key: key); + + @override + _MyHousePageState createState() => _MyHousePageState(); +} + +Widget _currentHouseTag() { + return Container( + padding: EdgeInsets.symmetric(vertical: 12.w, horizontal: 20.w), + constraints: BoxConstraints(minWidth: 120.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(36.w), + color: Color(0xFFFFF4D3), + border: Border.all(width: 2.w, color: Color(0xFFFFC40C))), + child: '当前房屋'.text.color(ktextPrimary).size(20.sp).make(), + ); +} + +Widget _unPaidTag() { + return Container( + padding: EdgeInsets.symmetric(vertical: 12.w, horizontal: 20.w), + constraints: BoxConstraints(minWidth: 120.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(36.w), + color: Color(0xFFFFEBE8), + border: Border.all(width: 2.w, color: Color(0xFFFC361D))), + child: '当前房屋'.text.color(Color(0xFFFC361D)).size(20.sp).make(), + ); +} + +class _MyHousePageState extends State { + int _select; + Widget _buildCard(bool currentHouse, {bool paid = false}) { + return Container( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w), + child: Row( + children: [ + CommonRadio( + value: 1, + groupValue: _select, + size: 32.w, + ), + 24.w.widthBox, + Column( + mainAxisSize: MainAxisSize.min, + children: [ + kEstateName.text.size(24.sp).color(ktextSubColor).bold.make(), + 16.w.heightBox, + ''.text.color(ktextPrimary).size(28.sp).bold.make(), + ], + ), + Spacer(), + currentHouse + ? _currentHouseTag() + : paid + ? _unPaidTag() + : SizedBox() + ], + ), + ); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '我的房屋', + body: ListView( + children: [ + _buildCard(true), + ].sepWidget(separate: BeeDivider.horizontal()), + ), + ); + } +} From acc1ab915f3390581cc9629d66039888ee4bdc0f Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Tue, 2 Feb 2021 18:10:27 +0800 Subject: [PATCH 12/14] =?UTF-8?q?add=20=E9=BB=98=E8=AE=A4=E6=88=BF?= =?UTF-8?q?=E5=B1=8B=E7=8A=B6=E6=80=81=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/life_pay/widget/my_house_page.dart | 1 - lib/provider/user_provider.dart | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/pages/life_pay/widget/my_house_page.dart b/lib/pages/life_pay/widget/my_house_page.dart index c9f73687..ee2aacc2 100644 --- a/lib/pages/life_pay/widget/my_house_page.dart +++ b/lib/pages/life_pay/widget/my_house_page.dart @@ -2,7 +2,6 @@ import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/pages/goods_deto_page/deto_create_page/widget/common_radio.dart'; import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; -import 'package:akuCommunity/widget/buttons/radio_button.dart'; import 'package:flutter/material.dart'; import 'package:akuCommunity/utils/headers.dart'; diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 9120b584..2285d891 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -133,4 +133,13 @@ class UserProvider extends ChangeNotifier { await updateProfile(); } } + + ///设置默认房屋 + String _currentHouse = + await SignFunc.getUserDetail().then((value) => value.estateNames.first); + String get currentHouse => _currentHouse; + setCurrentHouse(String house) { + _currentHouse = house; + notifyListeners(); + } } From 09d982d355f0bfce36aebf6ee5e3c8b8fc788b36 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Wed, 3 Feb 2021 10:57:21 +0800 Subject: [PATCH 13/14] add my house select page --- .../deto_create_page/deto_create_page.dart | 97 ++++++++++--------- lib/pages/life_pay/life_pay_page.dart | 6 +- lib/pages/life_pay/widget/my_house_page.dart | 36 ++++--- .../widget/add_fixed_submit_page.dart | 5 +- lib/provider/user_provider.dart | 4 +- 5 files changed, 83 insertions(+), 65 deletions(-) diff --git a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart index 51ff6971..e9bfc1cb 100644 --- a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart +++ b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart @@ -6,6 +6,7 @@ import 'dart:io'; // Flutter imports: import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/pages/goods_deto_page/select_move_company_page.dart'; +import 'package:akuCommunity/pages/life_pay/widget/my_house_page.dart'; import 'package:akuCommunity/pages/manager_func.dart'; import 'package:akuCommunity/utils/bee_parse.dart'; import 'package:akuCommunity/utils/network/base_model.dart'; @@ -44,7 +45,8 @@ class _DetoCreatePageState extends State { String _itemName; DateTime _date; - String get datetime=>DateUtil.formatDate(_date, format: "yyyy-MM-dd HH:mm:ss"); + String get datetime => + DateUtil.formatDate(_date, format: "yyyy-MM-dd HH:mm:ss"); int _selectWeight; String _selectTel; List _listWeight = [ @@ -67,7 +69,7 @@ class _DetoCreatePageState extends State { bool needMoveCompany = false; - Widget _houseAddress(String title, subtitle) { + Widget _houseAddress(String subtitle) { return Container( padding: EdgeInsets.only(bottom: 24.w), margin: EdgeInsets.only(bottom: 40.w), @@ -88,41 +90,51 @@ class _DetoCreatePageState extends State { ), ), ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(right: 42.w), - child: Image.asset( - R.ASSETS_IMAGES_HOUSE_ATTESTATION_PNG, - height: 59.w, - width: 59.w, - ), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - title, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 32.sp, - color: Color(0xff333333), - ), + GestureDetector( + onTap: () { + MyHousePage().to(); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only(right: 42.w), + child: Image.asset( + R.ASSETS_IMAGES_HOUSE_ATTESTATION_PNG, + height: 59.w, + width: 59.w, ), - SizedBox(height: 10.w), - Text( - subtitle, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 32.sp, - color: Color(0xff333333), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + kEstateName, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 32.sp, + color: Color(0xff333333), + ), ), - ) - ], - ), - ], + SizedBox(height: 10.w), + Text( + BeeParse.getEstateName(subtitle), + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 32.sp, + color: Color(0xff333333), + ), + ) + ], + ), + Spacer(), + Icon( + CupertinoIcons.chevron_forward, + size: 40.w, + ), + ], + ).material(color: Colors.transparent), ), ], ), @@ -350,9 +362,7 @@ class _DetoCreatePageState extends State { InkWell( onTap: () async { _selectTel = await SelectMoveCompanyPage().to(); - setState(() { - - }); + setState(() {}); }, child: Padding( padding: EdgeInsets.symmetric(vertical: 30.w), @@ -398,16 +408,9 @@ class _DetoCreatePageState extends State { body: ListView( padding: EdgeInsets.all(32.w), children: [ - _houseAddress( - kEstateName, - userProvider.userDetailModel.estateNames.isEmpty - ? '' - : BeeParse.getEstateName( - userProvider.userDetailModel.estateNames[0])), + _houseAddress(userProvider.currentHouse), _getWeight(), - _itemPicker( - '出户时间', datetime, - () async { + _itemPicker('出户时间', datetime, () async { _date = await BeeDatePicker.timePicker(DateTime.now()); setState(() {}); }), diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index 913564a4..c18d1d8b 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -4,18 +4,16 @@ import 'package:akuCommunity/const/resource.dart'; import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/model/manager/life_pay_model.dart'; import 'package:akuCommunity/pages/life_pay/widget/my_house_page.dart'; -import 'package:akuCommunity/pages/personal/widget/order_card.dart'; import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/utils/bee_parse.dart'; -import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/buttons/bee_check_box.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:get/get_state_manager/get_state_manager.dart'; import 'package:provider/provider.dart'; + // Package imports: import 'package:velocity_x/velocity_x.dart'; @@ -85,7 +83,7 @@ class _LifePayPageState extends State { size: 40.w, ), ], - ), + ).material(color: Colors.transparent), ), 24.w.heightBox, ], diff --git a/lib/pages/life_pay/widget/my_house_page.dart b/lib/pages/life_pay/widget/my_house_page.dart index ee2aacc2..169cb9df 100644 --- a/lib/pages/life_pay/widget/my_house_page.dart +++ b/lib/pages/life_pay/widget/my_house_page.dart @@ -1,13 +1,15 @@ import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/pages/goods_deto_page/deto_create_page/widget/common_radio.dart'; +import 'package:akuCommunity/provider/user_provider.dart'; +import 'package:akuCommunity/utils/bee_parse.dart'; import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:flutter/material.dart'; import 'package:akuCommunity/utils/headers.dart'; +import 'package:provider/provider.dart'; class MyHousePage extends StatefulWidget { - final List estateNames; - MyHousePage({Key key, this.estateNames}) : super(key: key); + MyHousePage({Key key}) : super(key: key); @override _MyHousePageState createState() => _MyHousePageState(); @@ -39,27 +41,35 @@ Widget _unPaidTag() { class _MyHousePageState extends State { int _select; - Widget _buildCard(bool currentHouse, {bool paid = false}) { + Widget _buildCard(String currentHouse, String estateName, int index, + {bool paid = false}) { return Container( padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w), child: Row( children: [ - CommonRadio( - value: 1, - groupValue: _select, - size: 32.w, + GestureDetector( + onTap: () { + _select = index; + setState(() {}); + }, + child: CommonRadio( + value: index, + groupValue: _select, + size: 32.w, + ), ), 24.w.widthBox, Column( + crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ kEstateName.text.size(24.sp).color(ktextSubColor).bold.make(), 16.w.heightBox, - ''.text.color(ktextPrimary).size(28.sp).bold.make(), + BeeParse.getEstateName(estateName).text.color(ktextPrimary).size(28.sp).bold.make(), ], ), Spacer(), - currentHouse + currentHouse == estateName ? _currentHouseTag() : paid ? _unPaidTag() @@ -71,11 +81,15 @@ class _MyHousePageState extends State { @override Widget build(BuildContext context) { + UserProvider userProvider = Provider.of(context); return BeeScaffold( title: '我的房屋', body: ListView( - children: [ - _buildCard(true), + children: [ + ...userProvider.userDetailModel.estateNames + .map((e) => _buildCard(userProvider.currentHouse, e, + userProvider.userDetailModel.estateNames.indexOf(e))) + .toList(), ].sepWidget(separate: BeeDivider.horizontal()), ), ); diff --git a/lib/pages/things_page/widget/add_fixed_submit_page.dart b/lib/pages/things_page/widget/add_fixed_submit_page.dart index 189cd7a4..6d975d22 100644 --- a/lib/pages/things_page/widget/add_fixed_submit_page.dart +++ b/lib/pages/things_page/widget/add_fixed_submit_page.dart @@ -2,6 +2,7 @@ import 'dart:io'; // Flutter imports: +import 'package:akuCommunity/pages/life_pay/widget/my_house_page.dart'; import 'package:akuCommunity/utils/bee_parse.dart'; import 'package:akuCommunity/widget/buttons/bottom_button.dart'; import 'package:flutter/cupertino.dart'; @@ -65,7 +66,9 @@ class _AddFixedSubmitPageState extends State { '报修房屋'.text.black.size(28.sp).make(), 32.w.heightBox, GestureDetector( - onTap: () {}, + onTap: () { + MyHousePage().to(); + }, child: Row( children: [ Image.asset( diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 2285d891..d34bc917 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -31,6 +31,7 @@ class UserProvider extends ChangeNotifier { HiveStore.appBox.put('login', true); await updateProfile(); await updateUserDetail(); + await setCurrentHouse(_userDetailModel?.estateNames?.first??''); notifyListeners(); } @@ -135,8 +136,7 @@ class UserProvider extends ChangeNotifier { } ///设置默认房屋 - String _currentHouse = - await SignFunc.getUserDetail().then((value) => value.estateNames.first); + String _currentHouse; String get currentHouse => _currentHouse; setCurrentHouse(String house) { _currentHouse = house; From 82766835da2414c9f35d076b184839960876a96b Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Wed, 3 Feb 2021 13:15:11 +0800 Subject: [PATCH 14/14] add life pay detail page --- .../life_pay/widget/life_pay_detail_page.dart | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 lib/pages/life_pay/widget/life_pay_detail_page.dart diff --git a/lib/pages/life_pay/widget/life_pay_detail_page.dart b/lib/pages/life_pay/widget/life_pay_detail_page.dart new file mode 100644 index 00000000..0032c99b --- /dev/null +++ b/lib/pages/life_pay/widget/life_pay_detail_page.dart @@ -0,0 +1,81 @@ +import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/model/manager/life_pay_model.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:flutter/material.dart'; +import 'package:akuCommunity/utils/headers.dart'; +import 'package:get/get.dart'; + +class LifePayDetailPage extends StatefulWidget { + final LifePayMolde model; + LifePayDetailPage({ + Key key, + this.model, + }) : super(key: key); + + @override + _LifePayDetailPageState createState() => _LifePayDetailPageState(); +} + +class _LifePayDetailPageState extends State { + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: + '${BeeParse.getCustomYears(widget.model.years)}-${widget.model.years}年明细', + body: ListView( + padding: EdgeInsets.only(top: 16.w), + children: [ + + ], + ), + bottomNavi: Container( + padding: EdgeInsets.fromLTRB( + 32.w, 16.w, 32.w, 12.w + MediaQuery.of(context).padding.bottom), + child: Row( + children: [ + BeeCheckBox.round( + onChange: (value) {}, + size: 40.w, + ), + Spacer(), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + RichText( + text: TextSpan( + text: '合计:', + style: TextStyle( + color: ktextPrimary, + fontSize: 32.sp, + fontWeight: FontWeight.bold), + children: [ + TextSpan( + text: '¥3009.84', + style: TextStyle( + color: kDangerColor, + fontSize: 32.sp, + fontWeight: FontWeight.bold)), + ])), + '已选10项'.text.color(ktextSubColor).size(20.sp).make(), + ], + ), + MaterialButton( + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(37.w)), + color: kPrimaryColor, + padding: EdgeInsets.symmetric(horizontal: 50.w, vertical: 15.w), + onPressed: () { + Get.back(); + }, + child: '选好了'.text.black.size(32.sp).bold.make(), + ), + ], + ), + ), + ); + } +}