设备已预约进度条显示

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

@ -63,12 +63,12 @@ class _FacilityPreorderPageState extends State<FacilityPreorderPage> {
), ),
onTap: () => Get.to(() => AdviceHousePage()), onTap: () => Get.to(() => AdviceHousePage()),
title: Text( title: Text(
UserTool.userProvider.userInfoModel!.name!, UserTool.userProvider.userInfoModel!.name??'请先选择房屋',
style: TextStyle( style: TextStyle(
fontSize: 30.sp, fontSize: 30.sp,
), ),
), ),
subtitle: Text( subtitle: userProvider.defaultHouse!=null?Text(
'租户 ' + '租户 ' +
userProvider.defaultHouse!.communityName + userProvider.defaultHouse!.communityName +
userProvider.defaultHouseString, userProvider.defaultHouseString,
@ -76,7 +76,7 @@ class _FacilityPreorderPageState extends State<FacilityPreorderPage> {
color: Colors.black.withOpacity(0.45), color: Colors.black.withOpacity(0.45),
fontSize: 26.sp, fontSize: 26.sp,
), ),
), ):SizedBox(),
trailing: Icon( trailing: Icon(
CupertinoIcons.chevron_forward, CupertinoIcons.chevron_forward,
size: 35.w, size: 35.w,
@ -252,7 +252,7 @@ class _FacilityPreorderPageState extends State<FacilityPreorderPage> {
DateTime getDate(int dateNum) { DateTime getDate(int dateNum) {
DateTime startDate = DateTime( DateTime startDate = DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day, 0, 0, 0); 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){ 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/base/base_style.dart';
import 'package:aku_new_community/utils/headers.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_detail_model.dart';
import '../../../models/facility/facility_type_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 '../../../widget/bee_image_network.dart';
import 'facility_preorder_page.dart'; import 'facility_preorder_page.dart';
class FacilityTypeDetailCard extends StatelessWidget { class FacilityTypeDetailCard extends StatefulWidget {
final FacilityTypeDetailModel model; final FacilityTypeDetailModel model;
final FacilityTypeModel facilityModel; final FacilityTypeModel facilityModel;
const FacilityTypeDetailCard( FacilityTypeDetailCard(
{Key? key, required this.model, required this.facilityModel}) {Key? key, required this.model, required this.facilityModel})
: super(key: key); : 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialButton( return MaterialButton(
@ -38,7 +71,7 @@ class FacilityTypeDetailCard extends StatelessWidget {
borderRadius: BorderRadius.circular(10.w), borderRadius: BorderRadius.circular(10.w),
clipBehavior: Clip.antiAliasWithSaveLayer, clipBehavior: Clip.antiAliasWithSaveLayer,
child: BeeImageNetwork( child: BeeImageNetwork(
imgs: model.imgList ?? [], imgs: widget.model.imgList ?? [],
height: 150.h, height: 150.h,
width: 200.w, width: 200.w,
fit: BoxFit.cover, fit: BoxFit.cover,
@ -56,19 +89,19 @@ class FacilityTypeDetailCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
model.name, widget.model.name,
style: TextStyle( style: TextStyle(
fontSize: 28.sp, fontSize: 28.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
15.hb, 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 .text
.size(20.sp) .size(20.sp)
.make(), .make(),
12.hb, 12.hb,
'${model.address}' '${widget.model.address}'
.text .text
.size(20.sp) .size(20.sp)
.color(BaseStyle.color474747) .color(BaseStyle.color474747)
@ -78,47 +111,72 @@ class FacilityTypeDetailCard extends StatelessWidget {
], ],
), ),
30.hb, 30.hb,
// Container( Wrap(
// height: 30.h, spacing: 7.5.sp,
// width: double.infinity, children: <Widget>[
// decoration: BoxDecoration( for (int i = 0; i < 25; i++)
// border: Border.all( Text(
// color: Color(0xFF979797), '${i}',
// width: 3.w, style: TextStyle(
// ), fontSize: 19.sp,
// ), ),
// child: CustomPaint( ),
// painter: MyPainter(), ],
// ), ),
// ) 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: () { onPressed: () {
Get.off(() => FacilityPreorderPage( Get.off(
facilityModel: facilityModel, () => FacilityPreorderPage(
typeModel: model, facilityModel: widget.facilityModel,
)); typeModel: widget.model,
),
);
}, },
); );
} }
} }
class MyPainter extends CustomPainter { class MyPainter extends CustomPainter {
Path path = new Path();
List? dates;
MyPainter(List dates) {
this.dates = dates;
}
@override @override
void paint(Canvas canvas, Size size) { void paint(Canvas canvas, Size size) {
for (int i = 0; i < 48; i++) {
Paint _paint = Paint() Paint _paint = Paint()
..color = Colors.redAccent ..color = dates!.contains(i) ? kPrimaryColor : ktextThirdColor
..strokeWidth = 20; ..strokeWidth = 40.h;
if (dates!.contains(i)) {
// canvas.translate(0, 0);
canvas.drawPoints(PointMode.points, [Offset(0, 0)], _paint); canvas.drawLine(
canvas.translate(200, 200); Offset(12.7.w * i - 1, 0), Offset(12.7.w * (i + 1), 0), _paint);
// }
canvas.drawPoints(PointMode.points, [Offset(0, 0)], _paint); }
} }
@override @override
bool shouldRepaint(covariant CustomPainter oldDelegate) { bool shouldRepaint(covariant CustomPainter oldDelegate) {
throw UnimplementedError(); return true;
} }
} }

Loading…
Cancel
Save