app-starlock/lib/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_page.dart

118 lines
4.6 KiB
Dart
Executable File

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/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_logic.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoViewSafetyProblem/minePersonInfoViewSafetyProblem_state.dart';
import '../../../app_settings/app_colors.dart';
import '../../../tools/commonItem.dart';
import '../../../tools/titleAppBar.dart';
class MinePersonInfoViewSafetyProblemPage extends StatefulWidget {
const MinePersonInfoViewSafetyProblemPage({Key? key}) : super(key: key);
@override
State<MinePersonInfoViewSafetyProblemPage> createState() =>
_MinePersonInfoViewSafetyProblemPageState();
}
class _MinePersonInfoViewSafetyProblemPageState extends State<MinePersonInfoViewSafetyProblemPage> {
final MineViewSafetyProblemLogic logic = Get.put(MineViewSafetyProblemLogic());
final MineViewSafetyProblemState state = Get.find<MineViewSafetyProblemLogic>().state;
@override
void initState() {
super.initState();
logic.getOwnQuestionListRequest();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '安全问题'.tr,
haveBack: true,
actionsList: <Widget>[
TextButton(
onPressed: () {
Navigator.pushNamed(
context, Routers.minePersonInfoSetSafetyProblemPage,
arguments: <String, Object>{
'firstProblemStr': state.firstProblemStr.value,
'secondProblemStr': state.secondProblemStr.value,
'thirdProblemStr': state.thirdProblemStr.value,
'firstAnswerStr': state.firstAnswerStr.value,
'secondAnswerStr': state.secondAnswerStr.value,
'thirdAnswerStr': state.thirdAnswerStr.value,
'firstQuestionId': state.firstQuestionId.value,
'secondQuestionId': state.secondQuestionId.value,
'thirdQuestionId': state.thirdQuestionId.value,
'firstAnswerId': state.firstAnswerId.value,
'secondAnswerId': state.secondAnswerId.value,
'thirdAnswerId': state.thirdAnswerId.value,
});
},
child: Text(
'修改'.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp),
))
],
backgroundColor: AppColors.mainColor),
body: ListView(
children: <Widget>[
Container(
width: 1.sw,
color: AppColors.greyBackgroundColor,
padding: EdgeInsets.all(20.h),
child: Text(
'当你手机丢了,可以通过回答设置的安全问题来登录新设备'.tr,
style: TextStyle(fontSize: 18.sp),
)),
Obx(() => _safityProblemItem(
state.firstProblemStr.value, state.firstAnswerStr.value)),
SizedBox(height: 10.h),
Obx(() => _safityProblemItem(
state.secondProblemStr.value, state.secondAnswerStr.value)),
SizedBox(height: 10.h),
Obx(() => _safityProblemItem(
state.thirdProblemStr.value, state.thirdAnswerStr.value))
],
));
}
Widget _safityProblemItem(String problemTitle, String answerTitle) {
return Column(
children: <Widget>[
CommonItem(
leftTitel: problemTitle,
rightTitle: '',
isHaveLine: true,
isHaveDirection: true),
Container(
color: Colors.white,
padding: EdgeInsets.only(left: 35.w),
child: TextField(
//输入框一行
maxLines: 1,
enabled: false,
autofocus: false,
decoration: InputDecoration(
//输入里面输入文字内边距设置
// contentPadding: const EdgeInsets.only(top: 8.0, left: -19.0, right: -15.0, bottom: 8.0),
// labelText: label,
hintText: answerTitle,
//不需要输入框下划线
border: InputBorder.none,
hintStyle: TextStyle(fontSize: 22.sp)),
obscureText: false,
),
)
],
);
}
}