fix some issues

hmxc
张萌 3 years ago
parent 633946636f
commit 74b267541c

@ -1,114 +1,116 @@
import 'package:flutter/material.dart';
import 'package:flustars/flustars.dart';
class HouseModel {
int? id;
String? roomName;
int? estateId;
///1.3.4.
int? status;
///1 23
int? type;
String? effectiveTimeStart;
String? effectiveTimeEnd;
DateTime? get effectiveStartDate => DateUtil.getDateTime(effectiveTimeStart!);
DateTime? get effectiveEndDate => DateUtil.getDateTime(effectiveTimeEnd!);
//
bool get reviewed => status == 4;
String get typeValue {
switch (type) {
case 1:
return '业主';
case 2:
return '租客';
case 3:
return '亲属';
}
return '';
}
String get houseStatus {
if (status == 1) return '审核中';
if (status == 3) return '未通过';
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 {
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),
];
}
HouseModel({
this.id,
this.roomName,
this.status,
this.type,
this.effectiveTimeStart,
this.effectiveTimeEnd,
this.estateId,
});
HouseModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
roomName = json['roomName'];
status = json['status'];
type = json['type'];
effectiveTimeStart = json['effectiveTimeStart'];
effectiveTimeEnd = json['effectiveTimeEnd'];
estateId = json['estateId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['roomName'] = this.roomName;
data['status'] = this.status;
data['effectiveTimeStart'] = this.effectiveTimeStart;
data['effectiveTimeEnd'] = this.effectiveTimeEnd;
return data;
}
}
// import 'package:flustars/flustars.dart';
// import 'package:flutter/material.dart';
//
// class HouseModel {
// int? id;
// String? roomName;
//
// int? estateId;
//
// ///1.3.4.
// int? status;
//
// ///1 23
// int? type;
// String? effectiveTimeStart;
// String? effectiveTimeEnd;
// int? sysLeaseId;
//
// DateTime? get effectiveStartDate => DateUtil.getDateTime(effectiveTimeStart!);
// DateTime? get effectiveEndDate => DateUtil.getDateTime(effectiveTimeEnd!);
//
// //
// bool get reviewed => status == 4;
// String get typeValue {
// switch (type) {
// case 1:
// return '业主';
// case 2:
// return '租客';
// case 3:
// return '亲属';
// }
// return '';
// }
//
// String get houseStatus {
// if (status == 1) return '审核中';
// if (status == 3) return '未通过';
// 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 {
// 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),
// ];
// }
//
// HouseModel(
// {this.id,
// this.roomName,
// this.status,
// this.type,
// this.effectiveTimeStart,
// this.effectiveTimeEnd,
// this.estateId,
// this.sysLeaseId});
//
// HouseModel.fromJson(Map<String, dynamic> json) {
// id = json['id'];
// roomName = json['roomName'];
// status = json['status'];
// type = json['type'];
// effectiveTimeStart = json['effectiveTimeStart'];
// effectiveTimeEnd = json['effectiveTimeEnd'];
// estateId = json['estateId'];
// sysLeaseId = json['sysLeaseId'];
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// data['id'] = this.id;
// data['roomName'] = this.roomName;
// data['status'] = this.status;
// data['effectiveTimeStart'] = this.effectiveTimeStart;
// data['effectiveTimeEnd'] = this.effectiveTimeEnd;
// data['sysLeaseId'] = this.sysLeaseId;
// return data;
// }
// }

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:equatable/equatable.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
part 'passed_house_list_model.g.dart';
@ -39,6 +39,9 @@ class PassedHouseListModel extends Equatable {
factory PassedHouseListModel.fromJson(Map<String, dynamic> json) =>
_$PassedHouseListModelFromJson(json);
DateTime? get effectiveStartDate => DateUtil.getDateTime(effectiveTimeStart!);
DateTime? get effectiveEndDate => DateUtil.getDateTime(effectiveTimeEnd!);
String get houseStatus {
if (type == 1) return '业主';
if (type == 2) return '亲属';

@ -8,13 +8,13 @@ part 'user_info_model.g.dart';
class UserInfoModel {
int id;
List<ImgModel> imgUrls;
String name;
String? name;
String nickName;
String tel;
/// 1. 2.
int? sex;
String birthday;
String? birthday;
String get sexValue {
if (sex == null) return '未设置';
@ -23,7 +23,7 @@ class UserInfoModel {
return '未设置';
}
DateTime? get birthdayDate => DateUtil.getDateTime(birthday);
DateTime? get birthdayDate => DateUtil.getDateTime(birthday ?? '');
String get birthdayValue {
if (TextUtil.isEmpty(birthday))
@ -38,10 +38,10 @@ class UserInfoModel {
UserInfoModel({
required this.id,
required this.imgUrls,
required this.name,
this.name,
required this.nickName,
required this.tel,
this.sex,
required this.birthday,
this.birthday,
});
}

@ -12,10 +12,10 @@ UserInfoModel _$UserInfoModelFromJson(Map<String, dynamic> json) {
imgUrls: (json['imgUrls'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
name: json['name'] as String,
name: json['name'] as String?,
nickName: json['nickName'] as String,
tel: json['tel'] as String,
sex: json['sex'] as int?,
birthday: json['birthday'] as String,
birthday: json['birthday'] as String?,
);
}

@ -74,7 +74,7 @@ class _PersonalIndexState extends State<PersonalIndex>
image: API.image(userProvider
.userInfoModel!.imgUrls.isNotEmpty
? userProvider
.userInfoModel?.imgUrls.first.url
.userInfoModel!.imgUrls.first.url
: ''),
height: 106.w,
width: 106.w,

@ -1,14 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/constants/api.dart';
@ -27,6 +16,15 @@ import 'package:aku_community/widget/bee_back_button.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:aku_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
///
class GoodsDetailPage extends StatefulWidget {
@ -55,7 +53,9 @@ class _GoodsDetailPageState extends State<GoodsDetailPage> {
final userProvider = Provider.of<UserProvider>(context, listen: false);
_refreshController = EasyRefreshController();
_pageController = PageController();
_nameController.text = userProvider.userInfoModel?.name ?? '';
_nameController.text = userProvider.userInfoModel?.name ??
userProvider.userInfoModel?.nickName ??
'';
_phoneController.text = userProvider.userInfoModel?.tel ?? '';
}

@ -25,7 +25,7 @@ class _AddHousePageState extends State<AddHousePage> {
TextEditingController _idController = TextEditingController();
GlobalKey<FormState> _formKey = GlobalKey<FormState>();
HouseItem? _item;
int? _roleType;
int _roleType = 1;
DateTimeRange? _range;
TextStyle get _hintStyle => TextStyle(
@ -44,7 +44,6 @@ class _AddHousePageState extends State<AddHousePage> {
_nameController.text.isNotEmpty &&
_idController.text.isNotEmpty &&
_item != null &&
_roleType != null &&
_rentCheck;
_renderTile({

@ -1,12 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flustars/flustars.dart';
import 'package:get/get.dart';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/models/user/passed_house_list_model.dart';
import 'package:aku_community/ui/profile/house/pick_my_house_page.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
enum CardAuthType {
FAIL,
@ -28,13 +26,13 @@ class HouseCard extends StatelessWidget {
Key? key,
required this.model,
required this.isOwner,
}) : type = CardAuthType.FAIL,
}) : type = CardAuthType.FAIL,
super(key: key);
const HouseCard.success({
Key? key,
required this.model,
required this.isOwner,
}) : type = CardAuthType.SUCCESS,
}) : type = CardAuthType.SUCCESS,
super(key: key);
String get _assetPath {
@ -48,7 +46,7 @@ class HouseCard extends StatelessWidget {
}
String get _roleName {
switch (model!.type) {
switch (model?.type ?? 2) {
case 1:
return '业主';
case 2:
@ -130,7 +128,7 @@ class HouseCard extends StatelessWidget {
),
10.hb,
Text(
model!.roomName,
model?.roomName ?? '',
style: Theme.of(context).textTheme.subtitle1,
),
Spacer(),
@ -158,7 +156,7 @@ class HouseCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'到期时间:${_isOverDate(DateUtil.getDateTime(model!.effectiveTimeEnd ?? ''))}',
'到期时间:${_isOverDate(DateUtil.getDateTime(model?.effectiveTimeEnd ?? ''))}',
style:
Theme.of(context).textTheme.subtitle2!.copyWith(
color: Color(0xFF666666),
@ -166,7 +164,7 @@ class HouseCard extends StatelessWidget {
),
Text(
DateUtil.formatDateStr(
model!.effectiveTimeEnd ?? '',
model?.effectiveTimeEnd ?? '',
format: 'yyyy-MM-dd'),
style: Theme.of(context).textTheme.subtitle1,
),

@ -1,10 +1,7 @@
import 'dart:io';
import 'dart:typed_data';
import 'package:bot_toast/bot_toast.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/user/house_model.dart';
import 'package:aku_community/models/house/lease_detail_model.dart';
import 'package:aku_community/models/house/lease_echo_model.dart';
import 'package:aku_community/models/house/submit_model.dart';
@ -12,13 +9,16 @@ import 'package:aku_community/models/user/passed_house_list_model.dart';
import 'package:aku_community/utils/network/base_file_model.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
class HouseFunc {
///
static Future<List<HouseModel>> get examineHouses async {
static Future<List<PassedHouseListModel>> 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();
return (model.data as List)
.map((e) => PassedHouseListModel.fromJson(e))
.toList();
}
///

@ -149,7 +149,7 @@ class _HouseOwnersPageState extends State<HouseOwnersPage> {
},
child: ListView(
children: [
_emptyHouse
UserTool.appProveider.selectedHouse == null
? 280.hb
: Padding(
padding: EdgeInsets.all(32.w),

@ -26,7 +26,6 @@ class _UserIdentifyPageState extends State<UserIdentifyPage> {
TextEditingController _nameController = TextEditingController();
TextEditingController _indentifyCodeController = TextEditingController();
String _sex = '请选择性别';
String _identify = '请选择身份';
String _tel = '';
@override
void initState() {

@ -1,19 +1,17 @@
import 'package:flutter/material.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/const/resource.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/ui/profile/house/add_house_page.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:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class MyHouseList extends StatefulWidget {
MyHouseList({Key? key}) : super(key: key);
@ -25,7 +23,7 @@ class MyHouseList extends StatefulWidget {
class _MyHouseListState extends State<MyHouseList> {
late EasyRefreshController _refreshController;
List<HouseModel> models = [];
List<PassedHouseListModel> models = [];
@override
void initState() {
super.initState();
@ -74,7 +72,7 @@ class _MyHouseListState extends State<MyHouseList> {
);
}
Widget _buildCard(HouseModel model) {
Widget _buildCard(PassedHouseListModel model) {
return Container(
padding: EdgeInsets.all(24.w),
width: double.infinity,
@ -90,7 +88,7 @@ class _MyHouseListState extends State<MyHouseList> {
children: [
Row(
children: [
model.roomName!.text.size(32.sp).color(ktextPrimary).bold.make(),
model.roomName.text.size(32.sp).color(ktextPrimary).bold.make(),
Spacer(),
// model.houseStatus.text
// .size(30.sp)

@ -2,7 +2,7 @@ name: aku_community
description: A new Flutter project.
publish_to: "none"
version: 1.6.0-dev+42
version: 1.7.0-dev+43
environment:
sdk: ">=2.12.0 <3.0.0"

Loading…
Cancel
Save