parent
8aea4295a5
commit
fafa1623a4
@ -0,0 +1,145 @@
|
||||
import 'package:aku_community/base/base_style.dart';
|
||||
import 'package:aku_community/const/resource.dart';
|
||||
import 'package:aku_community/constants/api.dart';
|
||||
import 'package:aku_community/models/house_keeping/house_keeping_list_model.dart';
|
||||
import 'package:aku_community/widget/buttons/card_bottom_button.dart';
|
||||
import 'package:aku_community/widget/others/aku_chip_box.dart';
|
||||
import 'package:flustars/flustars.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class HouseKeepingCard extends StatelessWidget {
|
||||
final HouseKeepingListModel model;
|
||||
const HouseKeepingCard({Key? key, required this.model}) : super(key: key);
|
||||
String get dateStart =>
|
||||
DateUtil.formatDateStr(model.createDate, format: 'yyyy-MM-dd HH:mm:ss');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () async {},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(24.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
AkuChipBox(title: model.typeString),
|
||||
16.w.widthBox,
|
||||
Expanded(
|
||||
child: Text(
|
||||
dateStart,
|
||||
style: TextStyle(
|
||||
color: ktextSubColor,
|
||||
fontSize: 22.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
model.statusString,
|
||||
style: TextStyle(
|
||||
color:
|
||||
model.statusColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
24.w.heightBox,
|
||||
Text(
|
||||
model.content,
|
||||
overflow: TextOverflow.visible,
|
||||
style: TextStyle(
|
||||
color: ktextPrimary,
|
||||
fontSize: 28.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
16.w.heightBox,
|
||||
_buildImgs(),
|
||||
_getBottomCard(),
|
||||
],
|
||||
),
|
||||
margin: EdgeInsets.only(top: 16.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buildImgs() {
|
||||
return Container(
|
||||
height: 168.w,
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (context, index) {
|
||||
var imgObj = model.submitImgList[index].url;
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 8.w),
|
||||
height: 168.w,
|
||||
width: 168.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4.w),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: FadeInImage.assetNetwork(
|
||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
||||
image: API.image(imgObj ?? '')),
|
||||
);
|
||||
},
|
||||
itemCount: model.submitImgList.length,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_getBottomCard() {
|
||||
return Column(
|
||||
children: [
|
||||
Divider(height: 48.w),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: _getButtons())),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_getButtons() {
|
||||
switch (model.status) {
|
||||
case 1:
|
||||
return [
|
||||
CardBottomButton.white(onPressed: () async {}, text: ('取消服务')),
|
||||
];
|
||||
case 2:
|
||||
return [
|
||||
CardBottomButton.white(onPressed: () async {}, text: ('取消服务')),
|
||||
];
|
||||
case 3:
|
||||
return [
|
||||
CardBottomButton.white(onPressed: () async {}, text: ('查看详情')),
|
||||
];
|
||||
case 4:
|
||||
return [
|
||||
CardBottomButton.white(onPressed: () async {}, text: ('查看账单')),
|
||||
];
|
||||
case 5:
|
||||
return [
|
||||
CardBottomButton.white(onPressed: () async {}, text: ('查看详情')),
|
||||
];
|
||||
case 6:
|
||||
return [
|
||||
CardBottomButton.white(onPressed: () async {}, text: ('查看详情')),
|
||||
];
|
||||
case 9:
|
||||
return [
|
||||
CardBottomButton.white(onPressed: () async {}, text: ('查看详情')),
|
||||
];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
class AkuChipBox extends StatelessWidget {
|
||||
final String title;
|
||||
final Color? borderClor;
|
||||
final Color? textColor;
|
||||
const AkuChipBox(
|
||||
{Key? key, required this.title, this.borderClor, this.textColor})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: textColor ?? Color(0xFF3F8FFE),
|
||||
fontSize: 20.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.symmetric(vertical: 6.w, horizontal: 16.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(2.w),
|
||||
border: Border.all(width: 2.w, color: borderClor ?? Color(0xFF3F8FFE)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue