155 lines
5.5 KiB
Dart
155 lines
5.5 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_pickers/pickers.dart';
|
|
import 'package:flutter_pickers/style/default_style.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:star_lock/appRouters.dart';
|
|
import 'package:star_lock/main/lockDetail/lcokSet/nDaysUnopened/nDaysUnopened_logic.dart';
|
|
import 'package:star_lock/tools/commonItem.dart';
|
|
import 'package:star_lock/tools/submitBtn.dart';
|
|
|
|
import '../../../../../app_settings/app_colors.dart';
|
|
import '../../../../../tools/titleAppBar.dart';
|
|
|
|
class NDaysUnopenedPage extends StatefulWidget {
|
|
const NDaysUnopenedPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<NDaysUnopenedPage> createState() => _NDaysUnopenedPageState();
|
|
}
|
|
|
|
class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
|
|
final logic = Get.put(NDaysUnopenedLogic());
|
|
final state = Get.find<NDaysUnopenedLogic>().state;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
appBar: TitleAppBar(
|
|
barTitle: 'N天未开门',
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor),
|
|
body: Container(
|
|
padding: EdgeInsets.all(30.w),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
"经过以上设定的时间,锁没有被开启,系统会给指定对象发送提醒消息,该功能需要锁联网",
|
|
style: TextStyle(
|
|
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
|
|
)),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 20.h,
|
|
),
|
|
CommonItem(
|
|
leftTitel: 'N天未开门提醒',
|
|
rightTitle: '',
|
|
isHaveLine: true,
|
|
isHaveDirection: false,
|
|
isHaveRightWidget: true,
|
|
rightWidget: _unOpenDoorSwitch(),
|
|
action: () {}),
|
|
Visibility(
|
|
visible: state.isunOpenNotice.value,
|
|
child: Column(
|
|
children: [
|
|
Obx(() => CommonItem(
|
|
leftTitel: '门未开时间',
|
|
rightTitle: state.unOpenDoorTime.value,
|
|
isHaveLine: true,
|
|
isHaveRightWidget: false,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
_openBottomItemSheet(
|
|
context, state.unopenDoorTimeList);
|
|
},
|
|
)),
|
|
SizedBox(
|
|
height: 20.h,
|
|
),
|
|
Container(
|
|
color: Colors.white,
|
|
margin: EdgeInsets.only(bottom: 10.h),
|
|
child: Column(
|
|
children: [
|
|
CommonItem(
|
|
leftTitel: '提醒方式',
|
|
rightTitle: "",
|
|
isHaveLine: false,
|
|
isHaveRightWidget: false,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Get.toNamed(Routers.notificationModePage);
|
|
},
|
|
),
|
|
Container(
|
|
padding: EdgeInsets.only(
|
|
left: 10.w,
|
|
right: 10.w,
|
|
top: 12.h,
|
|
bottom: 12.h),
|
|
margin: EdgeInsets.only(bottom: 20.h, top: 10.h),
|
|
decoration: BoxDecoration(
|
|
color: AppColors.mainBackgroundColor,
|
|
borderRadius: BorderRadius.circular(6.0.w),
|
|
),
|
|
child: Text(
|
|
'APP推送 管理员',
|
|
style: TextStyle(
|
|
color: Colors.black, fontSize: 20.sp),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
)),
|
|
Expanded(
|
|
child: SizedBox(
|
|
height: 20.h,
|
|
)),
|
|
SubmitBtn(
|
|
btnName: '保存',
|
|
onClick: () {},
|
|
),
|
|
SizedBox(
|
|
height: 60.h,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
CupertinoSwitch _unOpenDoorSwitch() {
|
|
return CupertinoSwitch(
|
|
activeColor: CupertinoColors.activeBlue,
|
|
trackColor: CupertinoColors.systemGrey5,
|
|
thumbColor: CupertinoColors.white,
|
|
value: state.isunOpenNotice.value,
|
|
onChanged: (value) {
|
|
setState(() {
|
|
state.isunOpenNotice.value = value;
|
|
});
|
|
},
|
|
);
|
|
}
|
|
|
|
//底部选择pickerView
|
|
_openBottomItemSheet(BuildContext context, List dataList) {
|
|
Pickers.showSinglePicker(context,
|
|
data: dataList,
|
|
pickerStyle: DefaultPickerStyle(), onConfirm: (p, position) {
|
|
state.unOpenDoorTime.value = p;
|
|
}, onChanged: (p, position) {});
|
|
}
|
|
}
|