This commit is contained in:
2022-11-01 16:51:56 +08:00
parent 96d822cb3f
commit ec22583ebb
10 changed files with 119 additions and 45 deletions

View File

@@ -62,8 +62,7 @@ class UserTopBar extends StatelessWidget {
Row(
children: [
Text(
Convert.hideCenterStr(
_.userInfo.value.address ?? ''),
Convert.hideCenterStr(_.userInfo.value.username),
style: const TextStyle(
color: AppColors.unactive,
),
@@ -73,7 +72,7 @@ class UserTopBar extends StatelessWidget {
onTap: () {
Clipboard.setData(
ClipboardData(
text: _.userInfo.value.address,
text: _.userInfo.value.username,
),
);
UiTools.toast('地址复制成功');

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:otp/otp.dart';
class UserServeGooglePage extends StatefulWidget {
const UserServeGooglePage({Key? key}) : super(key: key);
@@ -8,13 +9,52 @@ class UserServeGooglePage extends StatefulWidget {
}
class _UserServeGooglePageState extends State<UserServeGooglePage> {
String code = '000000';
String secret = 'T4UM3VPYXPALF7M5';
int remaining = 0;
@override
void initState() {
super.initState();
getCode();
}
void getCode() {
setState(() {
remaining = OTP.remainingSeconds();
code = OTP.generateTOTPCodeString(
secret,
DateTime.now().millisecondsSinceEpoch,
algorithm: Algorithm.SHA1,
isGoogle: true,
);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('谷歌验证器'),
),
body: Container(),
body: Column(
children: [
Text(
code,
style: const TextStyle(
fontSize: 32,
),
),
Text(remaining.toString()),
ElevatedButton(
onPressed: () {
getCode();
},
child: const Text('刷新密码'),
),
],
),
);
}
}

View File

@@ -1,5 +1,4 @@
import 'package:chat/routes/app_routes.dart';
import 'package:chat/routes/user_routes.dart';
import 'package:chat/views/home/widgets/action_item.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -20,15 +19,16 @@ class _UserServePageState extends State<UserServePage> {
),
body: Column(
children: [
ActionItem(
'谷歌验证器',
isFirst: true,
onTap: () {
Get.toNamed(UserRoutes.serveGoogle);
},
),
// ActionItem(
// '谷歌验证器',
// isFirst: true,
// onTap: () {
// Get.toNamed(UserRoutes.serveGoogle);
// },
// ),
ActionItem(
'扫一扫',
isFirst: true,
isLast: true,
onTap: () {
Get.toNamed(AppRoutes.scan);

View File

@@ -24,7 +24,7 @@ class UserSettingPrivacyPage extends StatelessWidget {
return LinkActionItem(
title: '允许通过搜索添加我为好友',
trailing: Switch(
value: _.userInfo.value.privacy,
value: _.userInfo.value.privacy ?? true,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onChanged: (e) {
_.togglePrivacy();

View File

@@ -21,31 +21,35 @@ class _UserSettingSafePageState extends State<UserSettingSafePage> {
appBar: AppBar(
title: const Text('安全设置'),
),
body: Column(
children: [
ActionItem(
'导出助记词',
isFirst: true,
isLast: true,
onTap: _showMnemonic,
),
const SizedBox(height: 8),
ActionItem(
'绑定手机',
isFirst: true,
onTap: () {
Get.toNamed(UserRoutes.settingSafeMobile);
},
),
ActionItem(
'绑定邮箱',
isLast: true,
onTap: () {
Get.toNamed(UserRoutes.settingSafeEmail);
},
),
],
),
body: GetX<AuthService>(builder: (_) {
return Column(
children: [
ActionItem(
'导出助记词',
isFirst: true,
isLast: true,
onTap: _showMnemonic,
),
const SizedBox(height: 8),
ActionItem(
'绑定手机',
extend: _.userInfo.value.mobile ?? '未绑定',
isFirst: true,
onTap: () {
Get.toNamed(UserRoutes.settingSafeMobile);
},
),
ActionItem(
'绑定邮箱',
extend: _.userInfo.value.email ?? '未绑定',
isLast: true,
onTap: () {
Get.toNamed(UserRoutes.settingSafeEmail);
},
),
],
);
}),
);
}