我的房屋卡片

pull/1/head
张萌 3 years ago
parent 251be03960
commit 7c22fa8ac5

@ -14,7 +14,7 @@ class MyHouseModel {
final int identity;
final String name;
final String tel;
final String isDefault;
final int isDefault;
factory MyHouseModel.fromJson(Map<String, dynamic> json) =>
_$MyHouseModelFromJson(json);

@ -17,5 +17,5 @@ MyHouseModel _$MyHouseModelFromJson(Map<String, dynamic> json) => MyHouseModel(
identity: json['identity'] as int,
name: json['name'] as String,
tel: json['tel'] as String,
isDefault: json['isDefault'] as String,
isDefault: json['isDefault'] as int,
);

@ -1,9 +1,14 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/extensions/widget_list_ext.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/models/user/my_house_model.dart';
import 'package:aku_new_community/ui/profile/new_house/add_house_page.dart';
import 'package:aku_new_community/ui/profile/new_house/widgets/add_house_button.dart';
import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/dialog/certification_dialog.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:aku_new_community/widget/tag/bee_tag.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -24,7 +29,11 @@ class _MyHousePageState extends State<MyHousePage> {
body: SafeArea(
child: UserTool.userProvider.myHouses.isEmpty
? _emptyWidget()
: ListView()),
: ListView(
padding:
EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
children: <Widget>[].sepWidget(separate: 24.w.heightBox),
)),
bottomNavi: Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
child: AddHouseButton(
@ -41,7 +50,7 @@ class _MyHousePageState extends State<MyHousePage> {
);
}
Widget _houseCard() {
Widget _houseCard(MyHouseModel model) {
return Stack(
children: [
Container(
@ -50,9 +59,74 @@ class _MyHousePageState extends State<MyHousePage> {
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
child: Column(
children: [],
children: [
Row(
children: [
'${model.addressName} ${model.communityName}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
],
),
8.w.heightBox,
Row(
children: [
'${model.buildingName}${model.unitName}${model.estateName}'
.text
.size(36.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
24.w.widthBox,
model.isDefault == 1
? BeeTag.yellowSolid(
text: '${model.manageEstateTypeName}')
: BeeTag.blackSolid(
text: '${model.manageEstateTypeName}'),
],
),
24.w.heightBox,
BeeDivider.horizontal(),
24.w.heightBox,
Row(
children: [
model.isDefault == 1
? BeeTag.yellowHollow(
text: '${model.manageEstateTypeName}')
: BeeTag.blackHollow(
text: '${model.manageEstateTypeName}'),
10.w.widthBox,
'${model.name} ${model.tel}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
],
)
],
),
),
if (model.isDefault == 1)
Positioned(
top: 0,
right: 0,
child: ClipPath(
clipper: TriangleClipper(),
child: Container(
width: 120.w,
height: 80.w,
color: kPrimaryColor,
alignment: Alignment.topRight,
child: Padding(
padding: EdgeInsets.only(right: 10.w, top: 10.w),
child: Icon(
Icons.check,
size: 40.w,
color: Colors.white,
),
),
)),
),
],
);
}
@ -73,3 +147,20 @@ class _MyHousePageState extends State<MyHousePage> {
);
}
}
class TriangleClipper extends CustomClipper<Path> {
@override
getClip(Size size) {
var path = Path();
path.moveTo(0, 0);
path.lineTo(size.width, 0);
path.lineTo(size.width, size.height);
path.lineTo(0, 0);
return path;
}
@override
bool shouldReclip(covariant CustomClipper oldClipper) {
return false;
}
}

@ -0,0 +1,60 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class BeeTag extends StatelessWidget {
final String text;
final Color bgColor;
final bool hasBorder;
final Color? borderColor;
final Color textColor;
const BeeTag(
{Key? key,
required this.text,
required this.bgColor,
required this.hasBorder,
this.borderColor,
required this.textColor})
: super(key: key);
BeeTag.yellowSolid({
required this.text,
}) : this.bgColor = Color(0xFFFAC058).withOpacity(0.1),
this.borderColor = null,
this.hasBorder = false,
this.textColor = Color(0xFFFAC058);
BeeTag.yellowHollow({
required this.text,
}) : this.bgColor = Colors.white,
this.borderColor = Color(0xFFFAC058),
this.hasBorder = true,
this.textColor = Color(0xFFFAC058);
BeeTag.blackSolid({
required this.text,
}) : this.bgColor = Colors.black.withOpacity(0.06),
this.borderColor = null,
this.hasBorder = false,
this.textColor = Colors.black.withOpacity(0.45);
BeeTag.blackHollow({
required this.text,
}) : this.bgColor = Colors.white,
this.borderColor = Colors.black.withOpacity(0.45),
this.hasBorder = true,
this.textColor = Colors.black.withOpacity(0.45);
@override
Widget build(BuildContext context) {
return Container(
width: 96.w,
height: 42.w,
alignment: Alignment.center,
decoration: BoxDecoration(
border: hasBorder ? Border.all(color: borderColor!) : null,
color: bgColor,
borderRadius: BorderRadius.circular(21.w),
),
child: text.text.size(24.sp).color(textColor).make(),
);
}
}
Loading…
Cancel
Save