1,新增实时画面页面

2,新增猫眼其他模式查看页面
This commit is contained in:
Daisy 2024-01-17 13:52:45 +08:00
parent 6bdc2aae12
commit 485fac6b51
9 changed files with 275 additions and 54 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

View File

@ -12,6 +12,7 @@ import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/catEyeSet/catEyeSet_
import 'package:star_lock/main/lockDetail/lcokSet/catEyeSet/videoSlot/videoSlot_page.dart';
import 'package:star_lock/main/lockDetail/lcokSet/faceUnlock/faceUnlock_page.dart';
import 'package:star_lock/main/lockDetail/lcokSet/familyDetails/familyDetails_page.dart';
import 'package:star_lock/main/lockDetail/lcokSet/liveVideo/liveVideo_page.dart';
import 'package:star_lock/main/lockDetail/lcokSet/lockUser/lockUser_page.dart';
import 'package:star_lock/main/lockDetail/lcokSet/motorPower/motorPower_page.dart';
import 'package:star_lock/main/lockDetail/lcokSet/msgNotification/msgNotification/msgNotification_page.dart';
@ -414,6 +415,7 @@ abstract class Routers {
static const doorLockLogPage = '/doorLockLogPage'; //
static const catEyeCustomModePage = '/catEyeCustomModePage'; //
static const videoSlotPage = '/videoSlotPage'; //
static const liveVideoPage = '/liveVideoPage'; //
}
abstract class AppRouters {
@ -1005,5 +1007,6 @@ abstract class AppRouters {
name: Routers.catEyeCustomModePage,
page: () => const CatEyeCustomModePage()),
GetPage(name: Routers.videoSlotPage, page: (() => const VideoSlotPage())),
GetPage(name: Routers.liveVideoPage, page: (() => const LiveVideoPage()))
];
}

View File

@ -1,12 +1,8 @@
import 'package:aliyun_push/aliyun_push.dart';
import 'package:audioplayers/audioplayers.dart';
// import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_pcm_sound/flutter_pcm_sound.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_sound/flutter_sound.dart';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/talk/udp/udp_talkClass.dart';
@ -16,7 +12,6 @@ import 'package:star_lock/tools/device_info_service.dart';
import 'package:star_lock/tools/platform_info_services.dart';
import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/tools/xs_aliyunPush.dart';
// import 'package:star_lock/tools/store_service.dart';
import 'package:star_lock/translations/app_dept.dart';
import 'package:star_lock/translations/trans_lib.dart';
@ -54,12 +49,6 @@ class MyApp extends StatefulWidget {
// final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
final _aliyunPush = AliyunPush();
var _deviceId = "";
// final audioPlayer = AudioPlayer();
final FlutterSoundPlayer _audioPlayer = FlutterSoundPlayer();
late List<int> allDataBytes;
@override
Widget build(BuildContext context) {
return ScreenUtilInit(
@ -139,47 +128,31 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
//
void initAliyunPush() {
XSAliyunPushProvider().init(_aliyunPush);
final aliyunPush = AliyunPush();
XSAliyunPushProvider().init(aliyunPush);
XSAliyunPushProvider().initAliyunPush();
if (Platform.isAndroid) {
XSAliyunPushProvider().initAliyunThirdPush();
}
//使DeviceID推送
_aliyunPush.getDeviceId().then((deviceId) async {
//使DeviceID推送
aliyunPush.getDeviceId().then((deviceId) async {
// print('得到的DeviceId$deviceId');
final data = await Storage.getString('userLoginData');
if (data!.isNotEmpty) {
if (data!.isNotEmpty && deviceId.isNotEmpty) {
XSAliyunPushProvider()
.pushBindDeviceID(deviceId, Platform.isAndroid ? 10 : 20);
}
});
// //使userid根据账号推送
// _aliyunPush.bindAccount(Storage.getUid().toString()).then((value) {
// print("得到了value$value");
// });
}
@override
void dispose() {
WidgetsBinding.instance?.removeObserver(this);
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
void didChangeAppLifecycleState(AppLifecycleState state) {
if (state == AppLifecycleState.resumed) {
//
print("应用进入前台");
} else if (state == AppLifecycleState.paused) {
//
print("应用进入后台");
if (UDPTalkClass().isBeCall == true) {
UDPTalkClass().playLocalAudio();
}
}
}
}
//
Future _initTranslation() async => TranslationLoader.loadTranslation(

View File

@ -63,6 +63,9 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
isHaveLine: false,
isHaveDirection: true,
isHaveRightWidget: false,
action: () {
Get.toNamed(Routers.liveVideoPage);
},
)
],
));

View File

@ -2,6 +2,7 @@ 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/tools/submitBtn.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart';
@ -114,10 +115,12 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
),
),
onTap: () {
//
if (clickIndex == 3) {
Get.toNamed(Routers.catEyeCustomModePage);
} else {
// Get.toNamed(Routes.catEyeWorkModeDetailPage);
//
showBottomSheet(context, clickIndex);
}
},
),
@ -159,34 +162,119 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
}
//
void showBottomSheet(BuildContext context) {
//
void showBottomSheet(BuildContext context, int clickIndex) {
showModalBottomSheet(
builder: (BuildContext context) {
//
return _buildBottomSheetWidget(context);
if (clickIndex == 0) {
return _buildBottomSheetWidget(context, '省电模式', '有人按门铃或发生\n异常事件时',
'不录像', '/', '有人按门铃或发生\n异常事件时');
} else if (clickIndex == 1) {
return _buildBottomSheetWidget(context, '逗留抓拍模式',
'有人出现、按门铃\n或发生异常事件时', '逗留达到10秒', '约1.5米', '随时');
} else if (clickIndex == 2) {
return _buildBottomSheetWidget(
context, '实时监控模式', '有人出现、按门铃\n或发生异常事件时', '立即录像', '约1.5米', '随时');
} else {
return Container();
}
},
context: context);
}
_buildBottomSheetWidget(BuildContext context) {
_buildBottomSheetWidget(BuildContext context, String modeTitle, String tips1,
String tips2, String tips3, String tips4) {
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),
)
//
Expanded(
child: Center(
child: Text(
modeTitle,
style: TextStyle(
fontSize: 26.sp,
color: Colors.black,
fontWeight: FontWeight.w600),
),
),
),
],
)
),
SizedBox(
height: 40.h,
),
_buildRowWidget('录像时机', tips1),
_buildRowWidget('有人出现时录像', tips2),
_buildRowWidget('人体侦测距离', tips3),
_buildRowWidget('查看实时画面', tips4),
_buildIKnowBtn(),
],
),
);
}
_buildRowWidget(String titleStr, String subTitleStr) {
return Container(
margin: EdgeInsets.only(top: 26.h, bottom: 26.h),
child: Row(
//Row两端对齐的方法
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
titleStr,
style: TextStyle(
fontSize: 24.sp,
color: Colors.black,
fontWeight: FontWeight.w600),
),
Expanded(
child: SizedBox(
width: 20.sp,
),
),
Text(
subTitleStr,
textAlign: TextAlign.right,
style: TextStyle(
fontSize: 20.sp,
color: AppColors.placeholderTextColor,
),
),
SizedBox(
width: 20.sp,
),
],
),
);
}
_buildIKnowBtn() {
return GestureDetector(
child: Container(
width: ScreenUtil().screenWidth - 40.w,
height: 80.h,
margin: EdgeInsets.only(top: 40.h, bottom: 40.h),
decoration: BoxDecoration(
color: AppColors.btnDisableColor,
borderRadius: BorderRadius.circular(80.h / 2),
),
child: Center(
child: Text(
'我知道了',
style: TextStyle(
color: AppColors.darkGrayTextColor,
fontSize: 24.sp,
fontWeight: FontWeight.w500),
),
),
),
onTap: () {
Navigator.pop(context);
},
);
}
}

View File

@ -0,0 +1,6 @@
import 'package:star_lock/main/lockDetail/lcokSet/liveVideo/liveVideo_state.dart';
import 'package:star_lock/tools/baseGetXController.dart';
class LiveVideoLogic extends BaseGetXController {
final LiveVideoState state = LiveVideoState();
}

View File

@ -0,0 +1,144 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lcokSet/liveVideo/liveVideo_logic.dart';
import 'package:star_lock/translations/trans_lib.dart';
import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart';
class LiveVideoPage extends StatefulWidget {
const LiveVideoPage({Key? key}) : super(key: key);
@override
State<LiveVideoPage> createState() => _LiveVideoPageState();
}
class _LiveVideoPageState extends State<LiveVideoPage> {
final logic = Get.put(LiveVideoLogic());
final state = Get.find<LiveVideoLogic>().state;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
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: 80.h,
),
Image.asset(
'images/lockSet_liveVideo.png',
height: 541.h,
width: 255.w,
),
SizedBox(
height: 86.h,
),
_buildTipsView('发生事件时查看\n', '仅当门锁发生事件或有人按门铃时,才能在门锁首页查看实时画面。', 0),
SizedBox(
height: 16.h,
),
_buildTipsView('实时查看\n',
'指定时问内,无论门锁是否发生安全事件或有人按门铃,都能在门锁首页随时查看实时画面;电池续航时问将会缩短。', 1),
],
));
}
Widget _buildTipsView(String titleStr, String subTitle, int clickIndex) {
return Obx(() => GestureDetector(
child: Container(
width: ScreenUtil().screenWidth - 40.w,
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
decoration: BoxDecoration(
color: clickIndex == 0
? (state.isLiveView.value == false
? AppColors.blueViewBgColor
: AppColors.greyBackgroundColor)
: (state.isLiveView.value == true
? AppColors.blueViewBgColor
: 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: [
clickIndex == 0
? (state.isLiveView.value == false
? Image.asset(
'images/mine/icon_mine_blueSelect.png',
width: 20.w,
height: 14.w,
)
: SizedBox(
width: 20.w,
height: 14.w,
))
: (state.isLiveView.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(
titleStr,
subTitle,
clickIndex == 0
? (state.isLiveView.value == false ? true : false)
: (state.isLiveView.value == true
? true
: false)),
),
],
)),
),
onTap: () {
state.isLiveView.value = !state.isLiveView.value;
},
));
}
Widget _buildRichText(String titleStr, String subTitle, 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);
}
}

View File

@ -0,0 +1,5 @@
import 'package:get/get.dart';
class LiveVideoState {
var isLiveView = false.obs; //
}

View File

@ -3,7 +3,6 @@ import 'dart:io';
import 'package:aliyun_push/aliyun_push.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart';
class XSAliyunPushProvider {
late AliyunPush _aliyunPush = AliyunPush();
@ -17,29 +16,29 @@ class XSAliyunPushProvider {
}
Future<void> _onNotification(Map<dynamic, dynamic> message) async {
// Toast.show(msg: 'onNotification: $message');
print('onNotification: $message');
}
Future<void> _onAndroidNotificationReceivedInApp(
Map<dynamic, dynamic> message) async {
// Toast.show(msg: 'onAndroidNotificationReceivedInApp: $message');
print('onAndroidNotificationReceivedInApp: $message');
}
Future<void> _onMessage(Map<dynamic, dynamic> message) async {
// Toast.show(msg: 'onMessage: $message');
print('onMessage: $message');
}
Future<void> _onNotificationOpened(Map<dynamic, dynamic> message) async {
// Toast.show(msg: 'onNotificationOpened: $message');
print('onNotificationOpened: $message');
}
Future<void> _onNotificationRemoved(Map<dynamic, dynamic> message) async {
// Toast.show(msg: 'onNotificationRemoved: $message');
print('onNotificationRemoved: $message');
}
Future<void> _onAndroidNotificationClickedWithNoAction(
Map<dynamic, dynamic> message) async {
// Toast.show(msg: 'onAndroidNotificationClickedWithNoAction: $message');
print('onAndroidNotificationClickedWithNoAction: $message');
}
Future<void> _onIOSChannelOpened(Map<dynamic, dynamic> message) async {}