设备已预约进度条显示

pull/1/head
戴余标 3 years ago
parent 0acbfd595e
commit daefd362ee

@ -63,12 +63,12 @@ class _FacilityPreorderPageState extends State<FacilityPreorderPage> {
),
onTap: () => Get.to(() => AdviceHousePage()),
title: Text(
UserTool.userProvider.userInfoModel!.name!,
UserTool.userProvider.userInfoModel!.name??'请先选择房屋',
style: TextStyle(
fontSize: 30.sp,
),
),
subtitle: Text(
subtitle: userProvider.defaultHouse!=null?Text(
'租户 ' +
userProvider.defaultHouse!.communityName +
userProvider.defaultHouseString,
@ -76,7 +76,7 @@ class _FacilityPreorderPageState extends State<FacilityPreorderPage> {
color: Colors.black.withOpacity(0.45),
fontSize: 26.sp,
),
),
):SizedBox(),
trailing: Icon(
CupertinoIcons.chevron_forward,
size: 35.w,
@ -252,7 +252,7 @@ class _FacilityPreorderPageState extends State<FacilityPreorderPage> {
DateTime getDate(int dateNum) {
DateTime startDate = DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day, 0, 0, 0);
return startDate.add(Duration(minutes: 30 * (dateNum - 1)));
return startDate.add(Duration(minutes: 30 * (dateNum)));
}
String dateString(List<int> dates){

@ -7,19 +7,52 @@ import 'package:get/get.dart';
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/utils/headers.dart';
import '../../../constants/saas_api.dart';
import '../../../models/facility/facility_type_detail_model.dart';
import '../../../models/facility/facility_type_model.dart';
import '../../../utils/network/base_model.dart';
import '../../../utils/network/net_util.dart';
import '../../../widget/bee_image_network.dart';
import 'facility_preorder_page.dart';
class FacilityTypeDetailCard extends StatelessWidget {
class FacilityTypeDetailCard extends StatefulWidget {
final FacilityTypeDetailModel model;
final FacilityTypeModel facilityModel;
const FacilityTypeDetailCard(
FacilityTypeDetailCard(
{Key? key, required this.model, required this.facilityModel})
: super(key: key);
@override
_FacilityTypeDetailCardState createState() => _FacilityTypeDetailCardState();
}
class _FacilityTypeDetailCardState extends State<FacilityTypeDetailCard> {
List datesNum = [];
@override
void initState() {
Future.delayed(
Duration.zero,
() => setState(() {
_load();
}));
super.initState();
}
_load() async {
BaseModel model =
await NetUtil().get(SAASAPI.facilities.allAppointmentPeriod, params: {
'facilitiesManageId': widget.model.id,
'todayDate': DateTime.now(),
});
if (model.success) {
datesNum = (model.data as List);
print(datesNum);
}
setState(() {
});
}
@override
Widget build(BuildContext context) {
return MaterialButton(
@ -38,7 +71,7 @@ class FacilityTypeDetailCard extends StatelessWidget {
borderRadius: BorderRadius.circular(10.w),
clipBehavior: Clip.antiAliasWithSaveLayer,
child: BeeImageNetwork(
imgs: model.imgList ?? [],
imgs: widget.model.imgList ?? [],
height: 150.h,
width: 200.w,
fit: BoxFit.cover,
@ -56,19 +89,19 @@ class FacilityTypeDetailCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
model.name,
widget.model.name,
style: TextStyle(
fontSize: 28.sp,
fontWeight: FontWeight.bold,
),
),
15.hb,
'${DateUtil.formatDate(model.openStartDT, format: 'HH:mm')}-${DateUtil.formatDate(model.openEndDT, format: 'HH:mm')} 开放'
'${DateUtil.formatDate(widget.model.openStartDT, format: 'HH:mm')}-${DateUtil.formatDate(widget.model.openEndDT, format: 'HH:mm')} 开放'
.text
.size(20.sp)
.make(),
12.hb,
'${model.address}'
'${widget.model.address}'
.text
.size(20.sp)
.color(BaseStyle.color474747)
@ -78,47 +111,72 @@ class FacilityTypeDetailCard extends StatelessWidget {
],
),
30.hb,
// Container(
// height: 30.h,
// width: double.infinity,
// decoration: BoxDecoration(
// border: Border.all(
// color: Color(0xFF979797),
// width: 3.w,
// ),
// ),
// child: CustomPaint(
// painter: MyPainter(),
// ),
// )
Wrap(
spacing: 7.5.sp,
children: <Widget>[
for (int i = 0; i < 25; i++)
Text(
'${i}',
style: TextStyle(
fontSize: 19.sp,
),
),
],
),
10.hb,
Container(
padding: EdgeInsets.only(left: 2.w, right: 2.w),
alignment: Alignment.centerLeft,
width: 615.w,
height: 40.h,
decoration: BoxDecoration(
border: Border.all(
width: 1,
color: Colors.black12,
),
),
child: CustomPaint(
foregroundPainter: MyPainter(datesNum),
),
),
],
),
onPressed: () {
Get.off(() => FacilityPreorderPage(
facilityModel: facilityModel,
typeModel: model,
));
Get.off(
() => FacilityPreorderPage(
facilityModel: widget.facilityModel,
typeModel: widget.model,
),
);
},
);
}
}
class MyPainter extends CustomPainter {
Path path = new Path();
List? dates;
MyPainter(List dates) {
this.dates = dates;
}
@override
void paint(Canvas canvas, Size size) {
for (int i = 0; i < 48; i++) {
Paint _paint = Paint()
..color = Colors.redAccent
..strokeWidth = 20;
//
canvas.drawPoints(PointMode.points, [Offset(0, 0)], _paint);
canvas.translate(200, 200);
//
canvas.drawPoints(PointMode.points, [Offset(0, 0)], _paint);
..color = dates!.contains(i) ? kPrimaryColor : ktextThirdColor
..strokeWidth = 40.h;
if (dates!.contains(i)) {
canvas.translate(0, 0);
canvas.drawLine(
Offset(12.7.w * i - 1, 0), Offset(12.7.w * (i + 1), 0), _paint);
}
}
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
throw UnimplementedError();
return true;
}
}

Loading…
Cancel
Save