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 createState() => _GoogleHomePageState(); } class _GoogleHomePageState extends State { final EdgeInsets _contentPadding = EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.h); final GoogleHomeLogic logic = Get.put(GoogleHomeLogic()); final GoogleHomeState state = Get.find().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)), ), ], ); } }