133 lines
4.7 KiB
Dart
Raw Normal View History

2023-11-13 09:47:19 +08:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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/lowBatteryReminder/lowBatteryReminder_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 LowBatteryReminderPage extends StatefulWidget {
const LowBatteryReminderPage({Key? key}) : super(key: key);
@override
State<LowBatteryReminderPage> createState() => _LowBatteryReminderPageState();
}
class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
final logic = Get.put(LowBatteryReminderLogic());
final state = Get.find<LowBatteryReminderLogic>().state;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '低电量提醒',
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Container(
padding: EdgeInsets.all(30.w),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Text(
"打开提醒后当锁电量低于20%、10%和5%系统会给指定对象发送提醒消息。电量读取方式网关读取或APP读取。",
style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
)),
],
),
SizedBox(
height: 20.h,
),
CommonItem(
leftTitel: '低电量提醒',
rightTitle: '',
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: _unOpenDoorSwitch(),
action: () {}),
Visibility(
visible: state.isLowBatteryNotify.value,
child: Column(
children: [
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.isLowBatteryNotify.value,
onChanged: (value) {
setState(() {
state.isLowBatteryNotify.value = value;
});
},
);
}
}