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 {
|
_aliyunPush.getDeviceId().then((deviceId) async {
|
||||||
final data = await Storage.getString('userLoginData');
|
final data = await Storage.getString('userLoginData');
|
||||||
if (data!.isNotEmpty) {
|
if (data!.isNotEmpty) {
|
||||||
if (Platform.isIOS) {
|
XSAliyunPushProvider()
|
||||||
XSAliyunPushProvider()
|
.pushBindDeviceID(deviceId, Platform.isAndroid ? 10 : 20);
|
||||||
.pushBindDeviceID(deviceId, Platform.isAndroid ? 10 : 20);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ class AuthorizedAdminSendEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Data {
|
class Data {
|
||||||
String? receiverUid;
|
int? receiverUid;
|
||||||
ReceiverUser? receiverUser;
|
ReceiverUser? receiverUser;
|
||||||
int? keyId;
|
int? keyId;
|
||||||
|
|
||||||
|
|||||||
@ -157,4 +157,36 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
|
|||||||
]);
|
]);
|
||||||
return RichText(text: tipsPreviewSpan);
|
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/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.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 '../../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
import '../../../../../tools/titleAppBar.dart';
|
||||||
@ -14,26 +17,35 @@ class VideoSlotPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _VideoSlotPageState extends State<VideoSlotPage> {
|
class _VideoSlotPageState extends State<VideoSlotPage> {
|
||||||
bool isCheck = false;
|
final logic = Get.put(VideoSlotLogic());
|
||||||
List boolList = [true, false, false, false];
|
final state = Get.find<VideoSlotLogic>().state;
|
||||||
|
|
||||||
final logic = Get.put(CatEyeSetLogic());
|
|
||||||
final state = Get.find<CatEyeSetLogic>().state;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: '录像时段',
|
barTitle: '录像时段',
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: AppColors.mainColor,
|
||||||
|
actionsList: [
|
||||||
|
TextButton(
|
||||||
|
child: Text(
|
||||||
|
TranslationLoader.lanKeys!.save!.tr,
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30.h,
|
height: 30.h,
|
||||||
),
|
),
|
||||||
_buildTipsView('全天', '', 0, boolList[0]),
|
_buildTipsView('全天', 0),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30.h,
|
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(
|
return GestureDetector(
|
||||||
child: Container(
|
child: Obx(() => Container(
|
||||||
width: ScreenUtil().screenWidth - 40.w,
|
width: ScreenUtil().screenWidth - 40.w,
|
||||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
|
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColors.greyBackgroundColor,
|
color: state.isCustom.value == true
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
? AppColors.greyBackgroundColor
|
||||||
),
|
: AppColors.blueViewBgColor,
|
||||||
child: Padding(
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
padding: EdgeInsets.only(
|
),
|
||||||
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
|
child: Padding(
|
||||||
child: Row(
|
padding: EdgeInsets.only(
|
||||||
children: [
|
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
|
||||||
SizedBox(
|
child: Row(
|
||||||
width: 20.w,
|
children: [
|
||||||
height: 14.w,
|
state.isCustom.value == false
|
||||||
),
|
? Image.asset(
|
||||||
SizedBox(width: 10.w),
|
'images/mine/icon_mine_blueSelect.png',
|
||||||
Expanded(
|
width: 20.w,
|
||||||
child: _buildRichText(titleStr, subTitle, false),
|
height: 14.w,
|
||||||
),
|
)
|
||||||
SizedBox(
|
: SizedBox(
|
||||||
width: 10.w,
|
width: 20.w,
|
||||||
),
|
height: 14.w,
|
||||||
],
|
),
|
||||||
)),
|
SizedBox(width: 10.w),
|
||||||
),
|
Expanded(
|
||||||
|
child: _buildRichText(titleStr, false),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 10.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
state.isCustom.value = !state.isCustom.value;
|
||||||
for (int i = 0; i < boolList.length; i++) {
|
|
||||||
if (clickIndex == i) {
|
|
||||||
boolList[clickIndex] = true;
|
|
||||||
} else {
|
|
||||||
boolList[i] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -88,53 +100,76 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
|
|||||||
//自定义时间
|
//自定义时间
|
||||||
Widget _buildCustomTimeView(String leftStr, String rightStr, int isEndTIme) {
|
Widget _buildCustomTimeView(String leftStr, String rightStr, int isEndTIme) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
child: Container(
|
child: Obx(() => Container(
|
||||||
width: ScreenUtil().screenWidth - 40.w,
|
width: ScreenUtil().screenWidth - 40.w,
|
||||||
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
|
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppColors.blueViewBgColor,
|
color: state.isCustom.value == false
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
? AppColors.greyBackgroundColor
|
||||||
),
|
: AppColors.blueViewBgColor,
|
||||||
child: Padding(
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
padding: EdgeInsets.only(
|
),
|
||||||
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
|
child: Padding(
|
||||||
child: Column(
|
padding: EdgeInsets.only(
|
||||||
children: [
|
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
|
||||||
Row(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Row(
|
||||||
'images/mine/icon_mine_blueSelect.png',
|
children: [
|
||||||
width: 20.w,
|
state.isCustom.value == true
|
||||||
height: 14.w,
|
? Image.asset(
|
||||||
),
|
'images/mine/icon_mine_blueSelect.png',
|
||||||
SizedBox(width: 10.w),
|
width: 20.w,
|
||||||
Expanded(
|
height: 14.w,
|
||||||
child: _buildRichText('自定义时间', '', true),
|
)
|
||||||
),
|
: SizedBox(
|
||||||
SizedBox(
|
width: 20.w,
|
||||||
width: 10.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,
|
onTap: () {
|
||||||
margin: EdgeInsets.only(
|
state.isCustom.value = !state.isCustom.value;
|
||||||
left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
|
},
|
||||||
color: AppColors.blueTextTipsColor,
|
|
||||||
),
|
|
||||||
startAndEndTimeRow(false),
|
|
||||||
SizedBox(
|
|
||||||
height: 30.h,
|
|
||||||
),
|
|
||||||
startAndEndTimeRow(true),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
onTap: () {},
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//开始时间、结束时间
|
||||||
Widget startAndEndTimeRow(bool isEndTime) {
|
Widget startAndEndTimeRow(bool isEndTime) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
child: Row(
|
child: Row(
|
||||||
@ -144,18 +179,26 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
isEndTime == false ? '开始时间' : '结束时间',
|
isEndTime == false ? '开始时间' : '结束时间',
|
||||||
style:
|
style: TextStyle(
|
||||||
TextStyle(color: AppColors.blueTextTipsColor, fontSize: 22.sp),
|
color: state.isCustom.value == true
|
||||||
|
? AppColors.blueTextTipsColor
|
||||||
|
: Colors.black,
|
||||||
|
fontSize: 22.sp),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 20.w,
|
width: 20.w,
|
||||||
)),
|
)),
|
||||||
Text(
|
Obx(() => Text(
|
||||||
isEndTime == false ? '当日22:00' : '次日08:00',
|
isEndTime == false
|
||||||
style:
|
? '当日${state.startDate.value}'
|
||||||
TextStyle(color: AppColors.blueTextTipsColor, fontSize: 22.sp),
|
: '次日${state.endDate.value}',
|
||||||
),
|
style: TextStyle(
|
||||||
|
color: state.isCustom.value == true
|
||||||
|
? AppColors.blueTextTipsColor
|
||||||
|
: Colors.black,
|
||||||
|
fontSize: 22.sp),
|
||||||
|
)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 10.w,
|
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(
|
final TextStyle titleStyle = TextStyle(
|
||||||
color: isClick ? AppColors.blueTextTipsColor : Colors.black,
|
color: isClick ? AppColors.blueTextTipsColor : Colors.black,
|
||||||
fontSize: 24.sp,
|
fontSize: 24.sp,
|
||||||
fontWeight: FontWeight.w500);
|
fontWeight: FontWeight.w500);
|
||||||
//默认样式
|
|
||||||
final TextStyle subTipsStyle = TextStyle(
|
|
||||||
color: isClick
|
|
||||||
? AppColors.blueTextTipsColor
|
|
||||||
: AppColors.placeholderTextColor,
|
|
||||||
fontSize: 20.sp);
|
|
||||||
|
|
||||||
late InlineSpan tipsPreviewSpan = TextSpan(children: [
|
late InlineSpan tipsPreviewSpan = TextSpan(children: [
|
||||||
TextSpan(text: titleStr, style: titleStyle),
|
TextSpan(text: titleStr, style: titleStyle),
|
||||||
TextSpan(text: subTitle, style: subTipsStyle),
|
|
||||||
]);
|
]);
|
||||||
return RichText(text: tipsPreviewSpan);
|
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