add house head card

hmxc
张萌 4 years ago
parent 013cf1dfd8
commit c954ef2a42

@ -1,13 +1,19 @@
// Flutter imports: // Flutter imports:
import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/manager/life_pay_model.dart'; import 'package:akuCommunity/model/manager/life_pay_model.dart';
import 'package:akuCommunity/pages/personal/widget/order_card.dart'; import 'package:akuCommunity/pages/personal/widget/order_card.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.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:akuCommunity/widget/buttons/bee_check_box.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.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: // Package imports:
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
@ -38,25 +44,49 @@ class _LifePayPageState extends State<LifePayPage> {
super.dispose(); super.dispose();
} }
String _getCustomYears(int year) { Widget _buildHouseCard(
int dif = year - DateTime.now().year; String title,
if (dif < 0) { String detail,
if (dif == -1) { ) {
return '去年'; return Padding(
} else if (dif == -2) { padding: EdgeInsets.all(32.w),
return '前年'; child: Column(
} else { crossAxisAlignment: CrossAxisAlignment.start,
return '${-dif}年前'; children: [
} '报修房屋'.text.black.size(28.sp).make(),
} else if (dif == 0) { 32.w.heightBox,
return '今年'; GestureDetector(
} else { onTap: () {},
if (dif == 1) { child: Row(
return '明年'; children: [
} else { Image.asset(
return '$dif年后'; 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) { Widget _buildCard(LifePayMolde model) {
@ -64,12 +94,15 @@ class _LifePayPageState extends State<LifePayPage> {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w), color: kForeGroundColor), borderRadius: BorderRadius.circular(8.w), color: kForeGroundColor),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
BeeCheckBox.round(), BeeCheckBox.round(
onChange: (value) {},
),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'${_getCustomYears(model.years)}(${model.years})' '${BeeParse.getCustomYears(model.years)}(${model.years})'
.text .text
.color(ktextSubColor) .color(ktextSubColor)
.size(28.sp) .size(28.sp)
@ -98,6 +131,23 @@ class _LifePayPageState extends State<LifePayPage> {
])) ]))
], ],
), ),
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<LifePayPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
UserProvider userProvider = Provider.of<UserProvider>(context);
return BeeScaffold( return BeeScaffold(
title: '生活缴费', title: '生活缴费',
actions: [ actions: [
@ -128,15 +179,19 @@ class _LifePayPageState extends State<LifePayPage> {
.toList(); .toList();
}, },
builder: (items) { builder: (items) {
return Column( return
Column(
children: [ children: [
// _buildHouseCard(kEstateName, userProvider.userDetailModel.estateNames.isEmpty
// ? ''
// : BeeParse.getEstateName(
// userProvider.userDetailModel.estateNames[0])),
ListView.builder( ListView.builder(
itemBuilder: (context, index) { itemBuilder: (context, index) {
// return _buildCard(items[index]);
return _buildCard(items[index]); return _buildCard(items[index]);
}, },
itemCount: 1, itemCount: items.length,
), ).expand(),
], ],
); );
}), }),

@ -84,10 +84,10 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
], ],
), ),
), ),
// Icon( Icon(
// CupertinoIcons.chevron_forward, CupertinoIcons.chevron_forward,
// size: 40.w, size: 40.w,
// ), ),
], ],
), ),
), ),

@ -3,7 +3,26 @@ class BeeParse{
int a = int.parse(estateName.split('|')[0]); int a = int.parse(estateName.split('|')[0]);
return a; return a;
} }
static String getEstateName(String estateNmae) { static String getEstateName(String estateNmae) {
return estateNmae.split('|')[1]; return estateNmae.split('|')[1];
} }
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年后';
// }
}
}
} }
Loading…
Cancel
Save