parent
614c66483a
commit
f910d38daa
@ -0,0 +1,84 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
part 'passed_house_list_model.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class PassedHouseListModel extends Equatable {
|
||||
final int id;
|
||||
final int estateId;
|
||||
final String roomName;
|
||||
final int type;
|
||||
final String? effectiveTimeStart;
|
||||
final String? effectiveTimeEnd;
|
||||
PassedHouseListModel({
|
||||
required this.id,
|
||||
required this.estateId,
|
||||
required this.roomName,
|
||||
required this.type,
|
||||
this.effectiveTimeStart,
|
||||
this.effectiveTimeEnd,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props {
|
||||
return [
|
||||
id,
|
||||
estateId,
|
||||
roomName,
|
||||
type,
|
||||
effectiveTimeStart,
|
||||
effectiveTimeEnd,
|
||||
];
|
||||
}
|
||||
|
||||
factory PassedHouseListModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$PassedHouseListModelFromJson(json);
|
||||
|
||||
String get houseStatus {
|
||||
if (type == 1) return '业主';
|
||||
if (type == 2) return '亲属';
|
||||
if (type == 3) return '租客';
|
||||
return '';
|
||||
}
|
||||
Color get houseStatusColor {
|
||||
// if (status != 4) return Color(0xFF666666);
|
||||
if (type == 1) return Color(0xFF333333);
|
||||
return Colors.white;
|
||||
}
|
||||
|
||||
///我的房屋页面背景颜色
|
||||
///
|
||||
List<Color> get backgroundColor {
|
||||
//TODO 未通过状态
|
||||
// if (status != 4)
|
||||
// return [
|
||||
// Color(0xFFF5F5F5),
|
||||
// Color(0xFFEFEEEE),
|
||||
// Color(0xFFE8E8E8),
|
||||
// ];
|
||||
if (type == 1)
|
||||
return [
|
||||
Color(0xFFFFDF7D),
|
||||
Color(0xFFFFD654),
|
||||
Color(0xFFFFC40C),
|
||||
];
|
||||
if (type == 2)
|
||||
return [
|
||||
Color(0xFFFFA446),
|
||||
Color(0xFFFFA547),
|
||||
Color(0xFFFF8200),
|
||||
];
|
||||
if (type == 3)
|
||||
return [
|
||||
Color(0xFF9ADE79),
|
||||
Color(0xFF91DE6B),
|
||||
Color(0xFF6ECB41),
|
||||
];
|
||||
return [
|
||||
Color(0xFFF5F5F5),
|
||||
Color(0xFFEFEEEE),
|
||||
Color(0xFFE8E8E8),
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'passed_house_list_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
PassedHouseListModel _$PassedHouseListModelFromJson(Map<String, dynamic> json) {
|
||||
return PassedHouseListModel(
|
||||
id: json['id'] as int,
|
||||
estateId: json['estateId'] as int,
|
||||
roomName: json['roomName'] as String,
|
||||
type: json['type'] as int,
|
||||
effectiveTimeStart: json['effectiveTimeStart'] as String?,
|
||||
effectiveTimeEnd: json['effectiveTimeEnd'] as String?,
|
||||
);
|
||||
}
|
@ -1,12 +1,21 @@
|
||||
import 'package:aku_community/constants/api.dart';
|
||||
import 'package:aku_community/model/user/house_model.dart';
|
||||
import 'package:aku_community/models/user/passed_house_list_model.dart';
|
||||
import 'package:aku_community/utils/network/base_model.dart';
|
||||
import 'package:aku_community/utils/network/net_util.dart';
|
||||
|
||||
class HouseFunc {
|
||||
static Future<List<HouseModel>> get houses async {
|
||||
BaseModel model = await NetUtil().get(API.user.houseList);
|
||||
///查询所有的房屋审核信息
|
||||
static Future<List<HouseModel>> get examineHouses async {
|
||||
BaseModel model = await NetUtil().get(API.user.examineHouseList);
|
||||
if (!model.status!) return [];
|
||||
return (model.data as List).map((e) => HouseModel.fromJson(e)).toList();
|
||||
}
|
||||
|
||||
///查询用户所拥有的房屋信息
|
||||
static Future get passedHouses async{
|
||||
BaseModel model = await NetUtil().get(API.user.passedHouseList);
|
||||
if (!model.status!) return [];
|
||||
return (model.data as List).map((e) => PassedHouseListModel.fromJson(e)).toList();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,115 @@
|
||||
import 'package:aku_community/base/base_style.dart';
|
||||
import 'package:aku_community/model/user/house_model.dart';
|
||||
import 'package:aku_community/ui/profile/house/house_func.dart';
|
||||
import 'package:aku_community/widget/bee_divider.dart';
|
||||
import 'package:aku_community/widget/bee_scaffold.dart';
|
||||
import 'package:aku_community/widget/others/bee_row_tile.dart';
|
||||
import 'package:flustars/flustars.dart';
|
||||
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:aku_community/const/resource.dart';
|
||||
|
||||
class MyHouseList extends StatefulWidget {
|
||||
MyHouseList({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MyHouseListState createState() => _MyHouseListState();
|
||||
}
|
||||
|
||||
class _MyHouseListState extends State<MyHouseList> {
|
||||
late EasyRefreshController _refreshController;
|
||||
|
||||
List<HouseModel> models = [];
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_refreshController = EasyRefreshController();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_refreshController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: '审核记录',
|
||||
body: EasyRefresh(
|
||||
firstRefresh: true,
|
||||
header: MaterialHeader(),
|
||||
controller: _refreshController,
|
||||
onRefresh: () async {
|
||||
models = await HouseFunc.examineHouses;
|
||||
print(models);
|
||||
setState(() {});
|
||||
},
|
||||
child: models.isEmpty
|
||||
? Container()
|
||||
: ListView.separated(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
|
||||
itemBuilder: (context, index) {
|
||||
return _buildCard(models[index]);
|
||||
},
|
||||
separatorBuilder: (_, __) {
|
||||
return 24.w.heightBox;
|
||||
},
|
||||
itemCount: models.length)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCard(HouseModel model) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(24.w),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: model.backgroundColor,
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter),
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
model.roomName!.text.size(32.sp).color(ktextPrimary).bold.make(),
|
||||
Spacer(),
|
||||
// model.houseStatus.text
|
||||
// .size(30.sp)
|
||||
// .color(model.houseStatusColor)
|
||||
// .make()
|
||||
],
|
||||
),
|
||||
16.w.heightBox,
|
||||
BeeDivider.horizontal(),
|
||||
20.w.heightBox,
|
||||
BeeRowTile(
|
||||
assetPath: R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
|
||||
titile: '房屋状态',
|
||||
content: model.houseStatus.text
|
||||
.size(30.sp)
|
||||
.color(model.houseStatusColor)
|
||||
.make()),
|
||||
12.w.heightBox,
|
||||
model.effectiveTimeStart == null
|
||||
? SizedBox()
|
||||
: BeeRowTile(
|
||||
assetPath: R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
|
||||
titile: '生效时间',
|
||||
content:
|
||||
('${DateUtil.formatDate(model.effectiveStartDate, format: 'yyyy-MM-dd HH:mm')}-${DateUtil.formatDate(model.effectiveEndDate, format: 'HH:mm')}')
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(ktextPrimary)
|
||||
.make())
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
import 'package:aku_community/base/base_style.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class BeeRowTile extends StatelessWidget {
|
||||
final String assetPath;
|
||||
final String titile;
|
||||
final Widget content;
|
||||
const BeeRowTile(
|
||||
{Key? key,
|
||||
required this.assetPath,
|
||||
required this.titile,
|
||||
required this.content})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
assetPath,
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
),
|
||||
12.w.widthBox,
|
||||
titile.text.size(24.sp).color(ktextSubColor).make(),
|
||||
Spacer(),
|
||||
content,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue