app-starlock/lib/mine/mineSet/google_home/google_home_page.dart
2024-09-12 11:34:17 +08:00

118 lines
3.5 KiB
Dart

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'.tr,
rightTitle: 'ScienerSmart'.tr,
),
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, '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)),
),
],
);
}
}