feat: 对接Google Home接口并完成相关功能
This commit is contained in:
parent
30383710b5
commit
57c7a41742
@ -47,6 +47,7 @@ import 'package:star_lock/mine/mineSet/amazon_alexa/amazon_alexa_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorAssociationLock/administratorAssociationLock_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorChangeDate/adminDetailChangeDate_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/administratorDetails/administratorDetails_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/google_home/google_home_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList/lockGroupList_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireLockManage_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_page.dart';
|
||||
@ -503,6 +504,7 @@ abstract class Routers {
|
||||
|
||||
static const String login = '/login'; //登录
|
||||
static const String amazonAlexaPage = '/amazonAlexaPage'; //AmazonAlexa
|
||||
static const String googleHomePage = '/googleHomePage'; //GoogleHome
|
||||
}
|
||||
|
||||
abstract class AppRouters {
|
||||
@ -1172,5 +1174,7 @@ abstract class AppRouters {
|
||||
name: Routers.palmDetailPage, page: () => const PalmDetailPage()),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.amazonAlexaPage, page: () => const AmazonAlexaPage()),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.googleHomePage, page: () => const GoogleHomePage()),
|
||||
];
|
||||
}
|
||||
|
||||
26
lib/mine/mineSet/google_home/google_home_logic.dart
Normal file
26
lib/mine/mineSet/google_home/google_home_logic.dart
Normal file
@ -0,0 +1,26 @@
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||
import 'package:star_lock/mine/mineSet/google_home/google_home_state.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
|
||||
class GoogleHomeLogic extends BaseGetXController {
|
||||
final GoogleHomeState state = GoogleHomeState();
|
||||
|
||||
//更新个人信息-google home
|
||||
Future<void> updateUserInfoWithGoogle() async {
|
||||
final PasswordKeyListEntity entity =
|
||||
await ApiRepository.to.updateUserInfoWithGoogle(
|
||||
isGoogle: state.isGoogleHome.value ? 0 : 1,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.isGoogleHome.value = !state.isGoogleHome.value;
|
||||
state.isGoogleHome.refresh();
|
||||
if (state.isGoogleHome.value) {
|
||||
state.isOpenedText.value = '关闭';
|
||||
} else {
|
||||
state.isOpenedText.value = '开启';
|
||||
}
|
||||
showToast('操作成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,120 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/mine/mineSet/google_home/google_home_logic.dart';
|
||||
import 'package:star_lock/mine/mineSet/google_home/google_home_state.dart';
|
||||
import 'package:star_lock/tools/commonItem.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
import 'package:star_lock/tools/submitBtn.dart';
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
|
||||
class GoogleHomePage extends StatefulWidget {
|
||||
const GoogleHomePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<GoogleHomePage> createState() => _GoogleHomePageState();
|
||||
}
|
||||
|
||||
class _GoogleHomePageState extends State<GoogleHomePage> {
|
||||
final EdgeInsets _contentPadding =
|
||||
EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.h);
|
||||
final GoogleHomeLogic logic = Get.put(GoogleHomeLogic());
|
||||
final GoogleHomeState state = Get.find<GoogleHomeLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: 'Google Home'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
_buildTopWidget(),
|
||||
SizedBox(height: 20.h),
|
||||
_buildBottomWidget(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTopWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: 'Action name',
|
||||
rightTitle: 'ScienerSmart',
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Obx(() => SubmitBtn(
|
||||
btnName: state.isOpenedText.value,
|
||||
onClick: () {
|
||||
// ShowTipView().showTipWithInputDialog(
|
||||
// contentText: '',
|
||||
// sureClick: (String value) {
|
||||
// Get.back();
|
||||
// },
|
||||
// sureText: '确定',
|
||||
// title: '设置安全码');
|
||||
logic.updateUserInfoWithGoogle();
|
||||
},
|
||||
)),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomWidget() {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
width: ScreenUtil().screenWidth,
|
||||
padding: _contentPadding,
|
||||
child: Column(
|
||||
children: [
|
||||
_buildInfoSection('支持的语言'.tr, '英语'.tr),
|
||||
SizedBox(height: 20.h),
|
||||
_buildInfoSection(
|
||||
'操作流程'.tr,
|
||||
'1.用智能锁APP添加锁和网关\n\n2.在APP里开启锁的远程开锁功能(这个功能默认是关闭的)。如果没有这个选项,则锁不支持Google Home \n\n3.安装Google Home APP,点击左上角的“+”按钮\n\n4.在设置页面,选择“与Google协同工作”\n\n5.搜索“ScienerSmart”,并用智能锁APP的账号和密码进行授权\n\n6.在智能锁APP里设置安全码,使用Google Home开锁时提供此安全码'
|
||||
.tr),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoSection(String title, String content) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.radio_button_checked_outlined,
|
||||
color: AppColors.mainColor),
|
||||
SizedBox(width: 6.w),
|
||||
Text(title.tr, style: TextStyle(fontSize: 20.sp)),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10.h, left: 10.w, right: 10.w),
|
||||
padding: EdgeInsets.all(10.w),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.lightBlueBgColor,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(content.tr, style: TextStyle(fontSize: 20.sp)),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
18
lib/mine/mineSet/google_home/google_home_state.dart
Normal file
18
lib/mine/mineSet/google_home/google_home_state.dart
Normal file
@ -0,0 +1,18 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class GoogleHomeState {
|
||||
GoogleHomeState() {
|
||||
final Map map = Get.arguments;
|
||||
if (map['isGoogleHome'] != null) {
|
||||
isGoogleHome.value = map['isGoogleHome'];
|
||||
if (isGoogleHome.value) {
|
||||
isOpenedText.value = '关闭';
|
||||
} else {
|
||||
isOpenedText.value = '开启';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RxBool isGoogleHome = false.obs;
|
||||
RxString isOpenedText = '开启'.obs;
|
||||
}
|
||||
@ -48,6 +48,15 @@ class MineSetLogic extends BaseGetXController {
|
||||
} else {
|
||||
state.isWechatPublicAccountPush.value = false;
|
||||
}
|
||||
//是否打开Amazon Alexa
|
||||
entity.data!.isAmazonAlexa! == 1
|
||||
? state.isAmazonAlexa.value = true
|
||||
: state.isAmazonAlexa.value = false;
|
||||
|
||||
//是否打开Google Home
|
||||
entity.data!.isGoogleHome! == 1
|
||||
? state.isGoogleHome.value = true
|
||||
: state.isGoogleHome.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -333,8 +333,9 @@ class _MineSetPageState extends State<MineSetPage>
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
// logic.showToast('功能暂未开放'.tr);
|
||||
Get.toNamed(Routers.amazonAlexaPage);
|
||||
Get.toNamed(Routers.amazonAlexaPage, arguments: <String, dynamic>{
|
||||
'isAmazonAlexa': state.isAmazonAlexa.value
|
||||
});
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: 'Google Home',
|
||||
@ -342,7 +343,11 @@ class _MineSetPageState extends State<MineSetPage>
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
logic.showToast('功能暂未开放'.tr);
|
||||
Get.toNamed(Routers.googleHomePage, arguments: <String, dynamic>{
|
||||
'isGoogleHome': state.isGoogleHome.value
|
||||
})?.then((Object? value) {
|
||||
logic.userSettingsInfoRequest();
|
||||
});
|
||||
}),
|
||||
if (!F.isProductionEnv)
|
||||
CommonItem(
|
||||
|
||||
@ -16,6 +16,8 @@ class MineSetState {
|
||||
var lockScreen = 2.obs; //锁屏
|
||||
var hideExpiredAccessFlag = 2.obs; //隐藏无效开锁
|
||||
var currentLanguage = "".obs; //隐藏无效开锁
|
||||
RxBool isAmazonAlexa = false.obs; //亚马逊Alexa
|
||||
RxBool isGoogleHome = false.obs; //谷歌Home
|
||||
|
||||
late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||
FlutterLocalNotificationsPlugin();
|
||||
|
||||
@ -42,6 +42,8 @@ class UserSettingInfoData {
|
||||
int? hasGoogleHome;
|
||||
int? alertMode;
|
||||
int? mpWechatPushSwitch;
|
||||
int? isAmazonAlexa;
|
||||
int? isGoogleHome;
|
||||
|
||||
UserSettingInfoData(
|
||||
{this.userSettings,
|
||||
@ -56,7 +58,9 @@ class UserSettingInfoData {
|
||||
this.hasCameraLock,
|
||||
this.hasGoogleHome,
|
||||
this.alertMode,
|
||||
this.mpWechatPushSwitch});
|
||||
this.mpWechatPushSwitch,
|
||||
this.isAmazonAlexa,
|
||||
this.isGoogleHome});
|
||||
|
||||
UserSettingInfoData.fromJson(Map<String, dynamic> json) {
|
||||
userSettings = json['userSettings'] != null
|
||||
@ -74,6 +78,8 @@ class UserSettingInfoData {
|
||||
hasGoogleHome = json['hasGoogleHome'];
|
||||
alertMode = json['alertMode'];
|
||||
mpWechatPushSwitch = json['mpWechatPushSwitch'];
|
||||
isAmazonAlexa = json['is_amazon_alexa'];
|
||||
isGoogleHome = json['is_google_home'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@ -93,6 +99,8 @@ class UserSettingInfoData {
|
||||
data['hasGoogleHome'] = hasGoogleHome;
|
||||
data['alertMode'] = alertMode;
|
||||
data['mpWechatPushSwitch'] = mpWechatPushSwitch;
|
||||
data['is_amazon_alexa'] = isAmazonAlexa;
|
||||
data['is_google_home'] = isGoogleHome;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,7 +128,8 @@ class _ValueAddedServicesPageListState
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
'Google Home', () {
|
||||
EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds);
|
||||
// EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds);
|
||||
Get.toNamed(Routers.googleHomePage);
|
||||
}),
|
||||
if (!F.isProductionEnv)
|
||||
_valueAddedServicesItem(
|
||||
|
||||
@ -342,13 +342,15 @@ class ApiProvider extends BaseProvider {
|
||||
);
|
||||
|
||||
// 锁记录上传
|
||||
Future<Response> lockReportLockSuccessfullyUploadData(int lockId, int keyId) => post(
|
||||
lockRecordUploadURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
'keyId': keyId,
|
||||
}),
|
||||
isUnShowLoading: true);
|
||||
Future<Response> lockReportLockSuccessfullyUploadData(
|
||||
int lockId, int keyId) =>
|
||||
post(
|
||||
lockRecordUploadURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
'keyId': keyId,
|
||||
}),
|
||||
isUnShowLoading: true);
|
||||
|
||||
// 获取手机联网token
|
||||
Future<Response> getLockNetToken(String lockId) => post(
|
||||
@ -1477,7 +1479,7 @@ class ApiProvider extends BaseProvider {
|
||||
|
||||
// 获取遥控列表
|
||||
Future<Response> getRemoteControlListData(
|
||||
String lockId, String pageNo, String pageSize, String searchStr) =>
|
||||
String lockId, String pageNo, String pageSize, String searchStr) =>
|
||||
post(
|
||||
getRemoteControlListURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -1489,21 +1491,21 @@ class ApiProvider extends BaseProvider {
|
||||
|
||||
// 添加遥控
|
||||
Future<Response> addRemoteControlData(
|
||||
String lockId,
|
||||
String remoteName,
|
||||
String remoteNumber,
|
||||
int remoteType,
|
||||
int startDate,
|
||||
int endDate,
|
||||
int addType,
|
||||
List weekDay,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int remoteRight,
|
||||
// String mac,
|
||||
// int electricQuantity,
|
||||
// List firmwareInfo
|
||||
) =>
|
||||
String lockId,
|
||||
String remoteName,
|
||||
String remoteNumber,
|
||||
int remoteType,
|
||||
int startDate,
|
||||
int endDate,
|
||||
int addType,
|
||||
List weekDay,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int remoteRight,
|
||||
// String mac,
|
||||
// int electricQuantity,
|
||||
// List firmwareInfo
|
||||
) =>
|
||||
post(
|
||||
addRemoteControlURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -1525,27 +1527,30 @@ class ApiProvider extends BaseProvider {
|
||||
|
||||
// 更新遥控序号
|
||||
Future<Response> updateRemoteUserNoLoadData(
|
||||
int lockId, int remoteId, String remoteUserNo) =>
|
||||
int lockId, int remoteId, String remoteUserNo) =>
|
||||
post(
|
||||
updateRemoteUserNoURL.toUrl,
|
||||
jsonEncode(
|
||||
{'lockId': lockId, 'remoteId': remoteId, 'remoteUserNo': remoteUserNo}));
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
'remoteId': remoteId,
|
||||
'remoteUserNo': remoteUserNo
|
||||
}));
|
||||
|
||||
// 编辑遥控
|
||||
Future<Response> editRemoteControlData(
|
||||
int lockId,
|
||||
int remoteId,
|
||||
int startDate,
|
||||
int endDate,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int remoteType,
|
||||
List weekDay,
|
||||
String remoteName,
|
||||
int addType,
|
||||
int isCoerced,
|
||||
int remoteRight,
|
||||
) =>
|
||||
int lockId,
|
||||
int remoteId,
|
||||
int startDate,
|
||||
int endDate,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int remoteType,
|
||||
List weekDay,
|
||||
String remoteName,
|
||||
int addType,
|
||||
int isCoerced,
|
||||
int remoteRight,
|
||||
) =>
|
||||
post(
|
||||
editRemoteControlURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -1564,30 +1569,28 @@ class ApiProvider extends BaseProvider {
|
||||
}));
|
||||
|
||||
// 删除遥控
|
||||
Future<Response> deletRemoteControlData(int remoteId) =>
|
||||
post(
|
||||
deleteRemoteControlURL.toUrl,
|
||||
jsonEncode({
|
||||
'remoteId': remoteId,
|
||||
}));
|
||||
Future<Response> deletRemoteControlData(int remoteId) => post(
|
||||
deleteRemoteControlURL.toUrl,
|
||||
jsonEncode({
|
||||
'remoteId': remoteId,
|
||||
}));
|
||||
|
||||
// 重置遥控
|
||||
Future<Response> resetRemoteControlData(int lockId) =>
|
||||
post(
|
||||
clearRemoteControlURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
}));
|
||||
Future<Response> resetRemoteControlData(int lockId) => post(
|
||||
clearRemoteControlURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
}));
|
||||
|
||||
// 校验遥控名字是否重复
|
||||
Future<Response> checkRemoteControlNameDuplicatedData(
|
||||
String lockId, String remoteName) =>
|
||||
String lockId, String remoteName) =>
|
||||
post(checkRemoteControlNameURL.toUrl,
|
||||
jsonEncode({'lockId': lockId, 'remoteName': remoteName}));
|
||||
|
||||
// 获取掌静脉列表
|
||||
Future<Response> getPalmListData(
|
||||
String lockId, String pageNo, String pageSize, String searchStr) =>
|
||||
String lockId, String pageNo, String pageSize, String searchStr) =>
|
||||
post(
|
||||
getPalmListURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -1599,18 +1602,17 @@ class ApiProvider extends BaseProvider {
|
||||
|
||||
// 添加掌静脉
|
||||
Future<Response> addPalmData(
|
||||
String lockId,
|
||||
String palmVeinName,
|
||||
String palmVeinNumber,
|
||||
int palmVeinType,
|
||||
int startDate,
|
||||
int endDate,
|
||||
int addType,
|
||||
List weekDay,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int palmVeinRight
|
||||
) =>
|
||||
String lockId,
|
||||
String palmVeinName,
|
||||
String palmVeinNumber,
|
||||
int palmVeinType,
|
||||
int startDate,
|
||||
int endDate,
|
||||
int addType,
|
||||
List weekDay,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int palmVeinRight) =>
|
||||
post(
|
||||
addPalmURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -1629,27 +1631,30 @@ class ApiProvider extends BaseProvider {
|
||||
|
||||
// 更新掌静脉序号
|
||||
Future<Response> updatePalmUserNoLoadData(
|
||||
int lockId, int palmVeinId, String palmVeinUserNo) =>
|
||||
int lockId, int palmVeinId, String palmVeinUserNo) =>
|
||||
post(
|
||||
updatePalmUserNoURL.toUrl,
|
||||
jsonEncode(
|
||||
{'lockId': lockId, 'palmVeinId': palmVeinId, 'palmVeinUserNo': palmVeinUserNo}));
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
'palmVeinId': palmVeinId,
|
||||
'palmVeinUserNo': palmVeinUserNo
|
||||
}));
|
||||
|
||||
// 编辑掌静脉
|
||||
Future<Response> editPalmData(
|
||||
int lockId,
|
||||
int palmVeinId,
|
||||
int startDate,
|
||||
int endDate,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int palmVeinType,
|
||||
List weekDay,
|
||||
String palmVeinName,
|
||||
int addType,
|
||||
int isCoerced,
|
||||
int palmVeinRight,
|
||||
) =>
|
||||
int lockId,
|
||||
int palmVeinId,
|
||||
int startDate,
|
||||
int endDate,
|
||||
int startTime,
|
||||
int endTime,
|
||||
int palmVeinType,
|
||||
List weekDay,
|
||||
String palmVeinName,
|
||||
int addType,
|
||||
int isCoerced,
|
||||
int palmVeinRight,
|
||||
) =>
|
||||
post(
|
||||
editPalmURL.toUrl,
|
||||
jsonEncode({
|
||||
@ -1668,24 +1673,22 @@ class ApiProvider extends BaseProvider {
|
||||
}));
|
||||
|
||||
// 删除掌静脉
|
||||
Future<Response> deletPalmData(int palmVeinId) =>
|
||||
post(
|
||||
deletePalmURL.toUrl,
|
||||
jsonEncode({
|
||||
'palmVeinId': palmVeinId,
|
||||
}));
|
||||
Future<Response> deletPalmData(int palmVeinId) => post(
|
||||
deletePalmURL.toUrl,
|
||||
jsonEncode({
|
||||
'palmVeinId': palmVeinId,
|
||||
}));
|
||||
|
||||
// 重置掌静脉
|
||||
Future<Response> resetPalmData(int lockId) =>
|
||||
post(
|
||||
clearPalmURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
}));
|
||||
Future<Response> resetPalmData(int lockId) => post(
|
||||
clearPalmURL.toUrl,
|
||||
jsonEncode({
|
||||
'lockId': lockId,
|
||||
}));
|
||||
|
||||
// 校验掌静脉名字是否重复
|
||||
Future<Response> checkPalmNameDuplicatedData(
|
||||
String lockId, String palmVeinName) =>
|
||||
String lockId, String palmVeinName) =>
|
||||
post(checkPalmNameURL.toUrl,
|
||||
jsonEncode({'lockId': lockId, 'palmVeinName': palmVeinName}));
|
||||
|
||||
@ -1932,6 +1935,20 @@ class ApiProvider extends BaseProvider {
|
||||
'headUrl': headUrl,
|
||||
}));
|
||||
|
||||
//更新个人信息-是否打开amazon alexa 0否 1是
|
||||
Future<Response> updateUserInfoWithAlexa(int isAlexa) => post(
|
||||
updateUserInfoURL.toUrl,
|
||||
jsonEncode({
|
||||
'is_amazon_alexa': isAlexa,
|
||||
}));
|
||||
|
||||
//更新个人信息-是否打开google home 0否 1是
|
||||
Future<Response> updateUserInfoWithGoogle(int isGoogle) => post(
|
||||
updateUserInfoURL.toUrl,
|
||||
jsonEncode({
|
||||
'is_google_home': isGoogle,
|
||||
}));
|
||||
|
||||
//修改绑定手机号
|
||||
Future<Response> bindPhone(String countryCode, String account,
|
||||
String verificationCode, String unbindToken) =>
|
||||
@ -2125,8 +2142,7 @@ class ApiProvider extends BaseProvider {
|
||||
}));
|
||||
|
||||
// 设置面容防误开
|
||||
Future<Response> updateFacePreventMisrun(
|
||||
int lockId, int faceEnErrUnlock) =>
|
||||
Future<Response> updateFacePreventMisrun(int lockId, int faceEnErrUnlock) =>
|
||||
post(
|
||||
updateLockSettingUrl.toUrl,
|
||||
jsonEncode({
|
||||
@ -2588,9 +2604,9 @@ class ApiProvider extends BaseProvider {
|
||||
|
||||
// 获取锁信息列表
|
||||
Future<Response> updateZoneOffsetsAndLanguages(
|
||||
int timezoneOffset,
|
||||
// String language
|
||||
) =>
|
||||
int timezoneOffset,
|
||||
// String language
|
||||
) =>
|
||||
post(
|
||||
updateZoneOffsetsAndLanguagesURL.toUrl,
|
||||
jsonEncode(<String, dynamic>{
|
||||
|
||||
@ -314,7 +314,8 @@ class ApiRepository {
|
||||
// 电子钥匙开锁成功上报
|
||||
Future<KeyOperationRecordEntity> lockReportLockSuccessfullyUploadData(
|
||||
{required int lockId, required int keyId}) async {
|
||||
final res = await apiProvider.lockReportLockSuccessfullyUploadData(lockId, keyId);
|
||||
final res =
|
||||
await apiProvider.lockReportLockSuccessfullyUploadData(lockId, keyId);
|
||||
return KeyOperationRecordEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -1705,8 +1706,8 @@ class ApiRepository {
|
||||
// 更新ICCard用户序号
|
||||
Future<LoginEntity> updateRemoteUserNoLoadData(
|
||||
{required int lockId,
|
||||
required int remoteId,
|
||||
required String remoteUserNo}) async {
|
||||
required int remoteId,
|
||||
required String remoteUserNo}) async {
|
||||
final res = await apiProvider.updateRemoteUserNoLoadData(
|
||||
lockId, remoteId, remoteUserNo);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
@ -1758,7 +1759,8 @@ class ApiRepository {
|
||||
// 校验遥控名字是否重复
|
||||
Future<LoginEntity> checkRemoteControlNameDuplicatedData(
|
||||
{required String lockId, required String remoteName}) async {
|
||||
final res = await apiProvider.checkRemoteControlNameDuplicatedData(lockId, remoteName);
|
||||
final res = await apiProvider.checkRemoteControlNameDuplicatedData(
|
||||
lockId, remoteName);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -1769,8 +1771,8 @@ class ApiRepository {
|
||||
required String pageSize,
|
||||
required String searchStr,
|
||||
}) async {
|
||||
final res = await apiProvider.getPalmListData(
|
||||
lockId, pageNo, pageSize, searchStr);
|
||||
final res =
|
||||
await apiProvider.getPalmListData(lockId, pageNo, pageSize, searchStr);
|
||||
return FingerprintListDataEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -1806,8 +1808,8 @@ class ApiRepository {
|
||||
// 更新掌静脉用户序号
|
||||
Future<LoginEntity> updatePalmUserNoLoadData(
|
||||
{required int lockId,
|
||||
required int palmVeinId,
|
||||
required String palmVeinUserNo}) async {
|
||||
required int palmVeinId,
|
||||
required String palmVeinUserNo}) async {
|
||||
final res = await apiProvider.updatePalmUserNoLoadData(
|
||||
lockId, palmVeinId, palmVeinUserNo);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
@ -1859,7 +1861,8 @@ class ApiRepository {
|
||||
// 校验掌静脉名字是否重复
|
||||
Future<LoginEntity> checkPalmNameDuplicatedData(
|
||||
{required String lockId, required String palmVeinName}) async {
|
||||
final res = await apiProvider.checkPalmNameDuplicatedData(lockId, palmVeinName);
|
||||
final res =
|
||||
await apiProvider.checkPalmNameDuplicatedData(lockId, palmVeinName);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -1977,6 +1980,22 @@ class ApiRepository {
|
||||
return PasswordKeyListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//更新个人信息-是否打开amazon alexa 0否 1是
|
||||
Future<PasswordKeyListEntity> updateUserInfoWithAlexa({
|
||||
required int isAlexa,
|
||||
}) async {
|
||||
final res = await apiProvider.updateUserInfoWithAlexa(isAlexa);
|
||||
return PasswordKeyListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//更新个人信息-是否打开google home 0否 1是
|
||||
Future<PasswordKeyListEntity> updateUserInfoWithGoogle({
|
||||
required int isGoogle,
|
||||
}) async {
|
||||
final res = await apiProvider.updateUserInfoWithGoogle(isGoogle);
|
||||
return PasswordKeyListEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//修改绑定手机号
|
||||
Future<PasswordKeyListEntity> bindPhone(String countryCode, String account,
|
||||
String verificationCode, String unbindToken) async {
|
||||
@ -2579,13 +2598,13 @@ class ApiRepository {
|
||||
}
|
||||
|
||||
// 更新云用户时区偏移与语言
|
||||
Future<LoginEntity> updateZoneOffsetsAndLanguages(
|
||||
{
|
||||
required int timezoneOffset,
|
||||
// required String language
|
||||
}) async {
|
||||
final res = await apiProvider.updateZoneOffsetsAndLanguages(timezoneOffset,
|
||||
// language
|
||||
Future<LoginEntity> updateZoneOffsetsAndLanguages({
|
||||
required int timezoneOffset,
|
||||
// required String language
|
||||
}) async {
|
||||
final res = await apiProvider.updateZoneOffsetsAndLanguages(
|
||||
timezoneOffset,
|
||||
// language
|
||||
);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/tools/showTFView.dart';
|
||||
@ -125,7 +126,7 @@ class ShowTipView {
|
||||
);
|
||||
}
|
||||
|
||||
void resetGetController(){
|
||||
void resetGetController() {
|
||||
getController.text = '';
|
||||
}
|
||||
|
||||
@ -148,4 +149,66 @@ class ShowTipView {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
//输入框的弹窗
|
||||
void showTipWithInputDialog({
|
||||
required String title,
|
||||
required String sureText,
|
||||
required String contentText,
|
||||
required Function(String) sureClick,
|
||||
String cancelText = '取消',
|
||||
VoidCallback? onCancel,
|
||||
}) {
|
||||
final TextEditingController controller = TextEditingController();
|
||||
controller.text = contentText;
|
||||
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
barrierDismissible: true,
|
||||
builder: (BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyle(color: AppColors.blackColor),
|
||||
),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
const SizedBox(height: 16),
|
||||
CupertinoTextField(
|
||||
controller: controller,
|
||||
placeholder: '请输入',
|
||||
style: TextStyle(color: AppColors.blackColor),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
),
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
cancelText,
|
||||
style: TextStyle(color: AppColors.blackColor),
|
||||
),
|
||||
onPressed: () {
|
||||
if (onCancel != null) {
|
||||
onCancel();
|
||||
}
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(
|
||||
sureText,
|
||||
style: const TextStyle(color: AppColors.blueTextTipsColor),
|
||||
),
|
||||
onPressed: () {
|
||||
sureClick(controller.text);
|
||||
// Get.back(); // 关闭弹窗
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user