parent
7e0da3ccf7
commit
14c196f071
@ -1,4 +1,4 @@
|
||||
{
|
||||
"flutterSdkVersion": "2.10.2",
|
||||
"flutterSdkVersion": "2.8.1",
|
||||
"flavors": {}
|
||||
}
|
@ -1,21 +1,39 @@
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../../model/common/img_model.dart';
|
||||
|
||||
part 'facility_type_detail_model.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class FacilityTypeDetailModel extends Equatable {
|
||||
final int id;
|
||||
final String code;
|
||||
final String address;
|
||||
final String name;
|
||||
final String openStartDate;
|
||||
final String openEndDate;
|
||||
final List<ImgModel>? imgList;
|
||||
|
||||
DateTime? get openStartDt => DateUtil.getDateTime(openStartDate);
|
||||
|
||||
DateTime? get openEndDt => DateUtil.getDateTime(openEndDate);
|
||||
|
||||
FacilityTypeDetailModel({
|
||||
required this.id,
|
||||
required this.code,
|
||||
required this.name,
|
||||
required this.address,
|
||||
required this.openStartDate,
|
||||
required this.openEndDate,
|
||||
required this.imgList,
|
||||
});
|
||||
|
||||
factory FacilityTypeDetailModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$FacilityTypeDetailModelFromJson(json);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id];
|
||||
List<Object?> get props =>
|
||||
[id, code, name, address, openStartDate, openEndDate, imgList];
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
import 'package:aku_new_community/constants/saas_api.dart';
|
||||
import 'package:aku_new_community/utils/headers.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import '../../../utils/network/net_util.dart';
|
||||
import '../../../widget/buttons/bee_check_radio.dart';
|
||||
|
||||
class FacilityPreorderDatePicker extends StatefulWidget {
|
||||
const FacilityPreorderDatePicker({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<FacilityPreorderDatePicker> createState() =>
|
||||
_FacilityPreorderDatePickerState();
|
||||
}
|
||||
|
||||
class _FacilityPreorderDatePickerState extends State<FacilityPreorderDatePicker> {
|
||||
List<int> get _num => List.generate(48, (index) => index + 1);
|
||||
List? _models;
|
||||
|
||||
@override
|
||||
void initState() async{
|
||||
var base =
|
||||
await NetUtil().get(SAASAPI.facilities.allAppointmentPeriod, params: {
|
||||
'facilitiesManageId': widget,
|
||||
'todayDate':DateTime.now(),
|
||||
});
|
||||
if (base.success) {
|
||||
_models = (base.data as List).toList();
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView(
|
||||
children: _num
|
||||
.map((e) => Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.w),
|
||||
child:
|
||||
Text(e.toString() + '年', textAlign: TextAlign.center),
|
||||
),
|
||||
))
|
||||
.toList());
|
||||
}
|
||||
|
||||
Widget _datesList() {
|
||||
DateTime date=DateTime.now();
|
||||
return Row(
|
||||
children: [
|
||||
BeeCheckRadio(
|
||||
value: _num,
|
||||
// groupValue: SAASAPI.facilities.allAppointmentPeriod,
|
||||
),
|
||||
Text('${date}~${date.add(Duration(minutes: 30))}'),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
import 'package:aku_new_community/base/base_style.dart';
|
||||
import 'package:aku_new_community/constants/saas_api.dart';
|
||||
import 'package:aku_new_community/model/common/img_model.dart';
|
||||
import 'package:aku_new_community/utils/headers.dart';
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../models/facility/facility_type_detail_model.dart';
|
||||
import '../../../models/facility/facility_type_model.dart';
|
||||
import 'facility_preorder_page.dart';
|
||||
import 'facility_type_detail_page.dart';
|
||||
|
||||
class FacilityTypeDetailCard extends StatelessWidget {
|
||||
final FacilityTypeDetailModel model;
|
||||
final FacilityTypeModel facilityModel;
|
||||
|
||||
const FacilityTypeDetailCard(
|
||||
{Key? key, required this.model, required this.facilityModel})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialButton(
|
||||
color: Colors.white,
|
||||
elevation: 0,
|
||||
padding: EdgeInsets.all(30.w),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Material(
|
||||
borderRadius: BorderRadius.circular(10.w),
|
||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
child: FadeInImage.assetNetwork(
|
||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
||||
image: SAASAPI.image(ImgModel.first(model.imgList)),
|
||||
height: 120.h,
|
||||
width: 150.w,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
model.name,
|
||||
style: TextStyle(
|
||||
fontSize: 28.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
15.hb,
|
||||
'${model.openStartDate.substring(0, model.openStartDate.length - 3)}-${model.openEndDate.substring(0, model.openEndDate.length - 3)} 开放'
|
||||
.text
|
||||
.size(20.sp)
|
||||
.make(),
|
||||
12.hb,
|
||||
'${model.address}'
|
||||
.text
|
||||
.size(20.sp)
|
||||
.color(BaseStyle.color474747)
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
onPressed: () {
|
||||
Get.off(() => FacilityPreorderPage(
|
||||
facilityModel: facilityModel,
|
||||
typeModel: model,
|
||||
));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:aku_new_community/utils/headers.dart';
|
||||
|
||||
class BeeChooseDatePicker extends StatefulWidget {
|
||||
final Widget? body;
|
||||
final VoidCallback? onPressed;
|
||||
final double? height;
|
||||
|
||||
BeeChooseDatePicker({Key? key, this.body, this.onPressed, this.height}) : super(key: key);
|
||||
|
||||
@override
|
||||
_BeeChooseDatePickerState createState() => _BeeChooseDatePickerState();
|
||||
}
|
||||
|
||||
class _BeeChooseDatePickerState extends State<BeeChooseDatePicker> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
child: Material(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(10)),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 48,
|
||||
child: NavigationToolbar(
|
||||
leading: Text(
|
||||
'选择日期',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 30.sp,
|
||||
),
|
||||
).paddingAll(25.w),
|
||||
trailing: TextButton(
|
||||
onPressed: widget.onPressed,
|
||||
child: '下一步'.text.color(Colors.blue).make(),
|
||||
),
|
||||
),
|
||||
),
|
||||
widget.body!,
|
||||
],
|
||||
),
|
||||
),
|
||||
height: widget.height??Get.height / 3,
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
import 'package:aku_new_community/models/facility/facility_type_detail_model.dart';
|
||||
import 'package:aku_new_community/ui/community/facility/facility_preorder_date_picker.dart';
|
||||
import 'package:aku_new_community/widget/picker/bee_choose_date_picker.dart';
|
||||
import 'package:aku_new_community/widget/picker/bee_month_pick_body.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
import 'package:aku_new_community/widget/picker/bee_custom_picker.dart';
|
||||
|
||||
class BeeDayPicker {
|
||||
|
||||
static Future<DateTime?> pick(
|
||||
DateTime initDate, {
|
||||
CupertinoDatePickerMode mode = CupertinoDatePickerMode.date,
|
||||
DateTime? min,
|
||||
DateTime? max,
|
||||
}) async {
|
||||
return await Get.bottomSheet(_BeeDayPicker(
|
||||
date: initDate,
|
||||
mode: mode,
|
||||
min: min ?? DateTime.now().subtract(Duration(days: 1)),
|
||||
max: max,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
class _BeeDayPicker extends StatefulWidget {
|
||||
final DateTime date;
|
||||
final bool use24H;
|
||||
final DateTime? max;
|
||||
final DateTime? min;
|
||||
final CupertinoDatePickerMode? mode;
|
||||
|
||||
_BeeDayPicker({
|
||||
Key? key,
|
||||
required this.date,
|
||||
this.use24H = false,
|
||||
this.max,
|
||||
this.min,
|
||||
this.mode,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
__BeeDayPickerState createState() => __BeeDayPickerState();
|
||||
}
|
||||
|
||||
class __BeeDayPickerState extends State<_BeeDayPicker> {
|
||||
DateTime _date = DateTime.now();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_date = widget.date;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeChooseDatePicker(
|
||||
onPressed: () async{
|
||||
Get.back();
|
||||
// await FacilityPreorderDatePicker();
|
||||
},
|
||||
body: CupertinoDatePicker(
|
||||
use24hFormat: widget.use24H,
|
||||
maximumDate: widget.max,
|
||||
minimumDate: widget.min,
|
||||
initialDateTime: _date,
|
||||
onDateTimeChanged: (date) => _date = date,
|
||||
mode: widget.mode ?? CupertinoDatePickerMode.date,
|
||||
).expand(),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue