Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
This commit is contained in:
commit
6bdc2aae12
@ -150,10 +150,8 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
_aliyunPush.getDeviceId().then((deviceId) async {
|
||||
final data = await Storage.getString('userLoginData');
|
||||
if (data!.isNotEmpty) {
|
||||
if (Platform.isIOS) {
|
||||
XSAliyunPushProvider()
|
||||
.pushBindDeviceID(deviceId, Platform.isAndroid ? 10 : 20);
|
||||
}
|
||||
XSAliyunPushProvider()
|
||||
.pushBindDeviceID(deviceId, Platform.isAndroid ? 10 : 20);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ class AuthorizedAdminSendEntity {
|
||||
}
|
||||
|
||||
class Data {
|
||||
String? receiverUid;
|
||||
int? receiverUid;
|
||||
ReceiverUser? receiverUser;
|
||||
int? keyId;
|
||||
|
||||
|
||||
@ -157,4 +157,36 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
|
||||
]);
|
||||
return RichText(text: tipsPreviewSpan);
|
||||
}
|
||||
|
||||
//显示底部弹框的功能
|
||||
void showBottomSheet(BuildContext context) {
|
||||
//用于在底部打开弹框的效果
|
||||
showModalBottomSheet(
|
||||
builder: (BuildContext context) {
|
||||
//构建弹框中的内容
|
||||
return _buildBottomSheetWidget(context);
|
||||
},
|
||||
context: context);
|
||||
}
|
||||
|
||||
_buildBottomSheetWidget(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'省电模式',
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w500),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +1,6 @@
|
||||
import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_state.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
class VideoSlotLogic extends BaseGetXController {
|
||||
final VideoSlotState state = VideoSlotState();
|
||||
}
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/catEyeSet/catEyeSet_logic.dart';
|
||||
import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_logic.dart';
|
||||
import 'package:star_lock/tools/pickers/pickers.dart';
|
||||
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
@ -14,26 +17,35 @@ class VideoSlotPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _VideoSlotPageState extends State<VideoSlotPage> {
|
||||
bool isCheck = false;
|
||||
List boolList = [true, false, false, false];
|
||||
|
||||
final logic = Get.put(CatEyeSetLogic());
|
||||
final state = Get.find<CatEyeSetLogic>().state;
|
||||
final logic = Get.put(VideoSlotLogic());
|
||||
final state = Get.find<VideoSlotLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: '录像时段',
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
barTitle: '录像时段',
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.save!.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
_buildTipsView('全天', '', 0, boolList[0]),
|
||||
_buildTipsView('全天', 0),
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
@ -42,45 +54,45 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
|
||||
));
|
||||
}
|
||||
|
||||
Widget _buildTipsView(
|
||||
String titleStr, String subTitle, int clickIndex, bool isClick) {
|
||||
//全天
|
||||
Widget _buildTipsView(String titleStr, int clickIndex) {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
width: ScreenUtil().screenWidth - 40.w,
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.greyBackgroundColor,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
height: 14.w,
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
Expanded(
|
||||
child: _buildRichText(titleStr, subTitle, false),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
child: Obx(() => Container(
|
||||
width: ScreenUtil().screenWidth - 40.w,
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
|
||||
decoration: BoxDecoration(
|
||||
color: state.isCustom.value == true
|
||||
? AppColors.greyBackgroundColor
|
||||
: AppColors.blueViewBgColor,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
|
||||
child: Row(
|
||||
children: [
|
||||
state.isCustom.value == false
|
||||
? Image.asset(
|
||||
'images/mine/icon_mine_blueSelect.png',
|
||||
width: 20.w,
|
||||
height: 14.w,
|
||||
)
|
||||
: SizedBox(
|
||||
width: 20.w,
|
||||
height: 14.w,
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
Expanded(
|
||||
child: _buildRichText(titleStr, false),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
],
|
||||
)),
|
||||
)),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
for (int i = 0; i < boolList.length; i++) {
|
||||
if (clickIndex == i) {
|
||||
boolList[clickIndex] = true;
|
||||
} else {
|
||||
boolList[i] = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
state.isCustom.value = !state.isCustom.value;
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -88,53 +100,76 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
|
||||
//自定义时间
|
||||
Widget _buildCustomTimeView(String leftStr, String rightStr, int isEndTIme) {
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
width: ScreenUtil().screenWidth - 40.w,
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.blueViewBgColor,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
child: Obx(() => Container(
|
||||
width: ScreenUtil().screenWidth - 40.w,
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
|
||||
decoration: BoxDecoration(
|
||||
color: state.isCustom.value == false
|
||||
? AppColors.greyBackgroundColor
|
||||
: AppColors.blueViewBgColor,
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
'images/mine/icon_mine_blueSelect.png',
|
||||
width: 20.w,
|
||||
height: 14.w,
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
Expanded(
|
||||
child: _buildRichText('自定义时间', '', true),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
Row(
|
||||
children: [
|
||||
state.isCustom.value == true
|
||||
? Image.asset(
|
||||
'images/mine/icon_mine_blueSelect.png',
|
||||
width: 20.w,
|
||||
height: 14.w,
|
||||
)
|
||||
: SizedBox(
|
||||
width: 20.w,
|
||||
height: 14.w,
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
Expanded(
|
||||
child: _buildRichText('自定义时间', state.isCustom.value),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
],
|
||||
),
|
||||
//如果选中了全天模式,就不显示下面的时间选择
|
||||
state.isCustom.value == false
|
||||
? Container()
|
||||
: Container(
|
||||
height: 1,
|
||||
margin: EdgeInsets.only(
|
||||
left: 20.w,
|
||||
right: 20.w,
|
||||
top: 20.h,
|
||||
bottom: 20.h),
|
||||
color: state.isCustom.value == true
|
||||
? AppColors.blueTextTipsColor
|
||||
: Colors.black,
|
||||
),
|
||||
state.isCustom.value == false
|
||||
? Container()
|
||||
: startAndEndTimeRow(false),
|
||||
state.isCustom.value == false
|
||||
? Container()
|
||||
: SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
state.isCustom.value == false
|
||||
? Container()
|
||||
: startAndEndTimeRow(true),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 1,
|
||||
margin: EdgeInsets.only(
|
||||
left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
|
||||
color: AppColors.blueTextTipsColor,
|
||||
),
|
||||
startAndEndTimeRow(false),
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
startAndEndTimeRow(true),
|
||||
],
|
||||
)),
|
||||
),
|
||||
onTap: () {},
|
||||
)),
|
||||
)),
|
||||
onTap: () {
|
||||
state.isCustom.value = !state.isCustom.value;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
//开始时间、结束时间
|
||||
Widget startAndEndTimeRow(bool isEndTime) {
|
||||
return GestureDetector(
|
||||
child: Row(
|
||||
@ -144,18 +179,26 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
|
||||
),
|
||||
Text(
|
||||
isEndTime == false ? '开始时间' : '结束时间',
|
||||
style:
|
||||
TextStyle(color: AppColors.blueTextTipsColor, fontSize: 22.sp),
|
||||
style: TextStyle(
|
||||
color: state.isCustom.value == true
|
||||
? AppColors.blueTextTipsColor
|
||||
: Colors.black,
|
||||
fontSize: 22.sp),
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 20.w,
|
||||
)),
|
||||
Text(
|
||||
isEndTime == false ? '当日22:00' : '次日08:00',
|
||||
style:
|
||||
TextStyle(color: AppColors.blueTextTipsColor, fontSize: 22.sp),
|
||||
),
|
||||
Obx(() => Text(
|
||||
isEndTime == false
|
||||
? '当日${state.startDate.value}'
|
||||
: '次日${state.endDate.value}',
|
||||
style: TextStyle(
|
||||
color: state.isCustom.value == true
|
||||
? AppColors.blueTextTipsColor
|
||||
: Colors.black,
|
||||
fontSize: 22.sp),
|
||||
)),
|
||||
SizedBox(
|
||||
width: 10.w,
|
||||
),
|
||||
@ -166,27 +209,33 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
|
||||
)
|
||||
],
|
||||
),
|
||||
onTap: () {},
|
||||
onTap: () {
|
||||
Pickers.showDatePicker(context, mode: DateMode.HM, onConfirm: (p) {
|
||||
if (isEndTime == false) {
|
||||
state.startDate.value =
|
||||
'${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
} else {
|
||||
state.endDate.value = '${intToStr(p.hour!)}:${intToStr(p.minute!)}';
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRichText(String titleStr, String subTitle, bool isClick) {
|
||||
Widget _buildRichText(String titleStr, bool isClick) {
|
||||
//高亮样式
|
||||
final TextStyle titleStyle = TextStyle(
|
||||
color: isClick ? AppColors.blueTextTipsColor : Colors.black,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w500);
|
||||
//默认样式
|
||||
final TextStyle subTipsStyle = TextStyle(
|
||||
color: isClick
|
||||
? AppColors.blueTextTipsColor
|
||||
: AppColors.placeholderTextColor,
|
||||
fontSize: 20.sp);
|
||||
|
||||
late InlineSpan tipsPreviewSpan = TextSpan(children: [
|
||||
TextSpan(text: titleStr, style: titleStyle),
|
||||
TextSpan(text: subTitle, style: subTipsStyle),
|
||||
]);
|
||||
return RichText(text: tipsPreviewSpan);
|
||||
}
|
||||
|
||||
String intToStr(int v) {
|
||||
return (v < 10) ? "0$v" : "$v";
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class VideoSlotState {
|
||||
var isCustom = false.obs; //是否自定义
|
||||
DateTime dateTime = DateTime.now();
|
||||
final startDateTime = DateTime.now().obs; //开始时间:当日
|
||||
final endDateTime = DateTime.now().obs; //结束时间:次日
|
||||
|
||||
var startDate =
|
||||
'${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
||||
var endDate = '${DateTime.now().hour}:${DateTime.now().minute}'.obs; //默认为当前时间
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user