update
This commit is contained in:
@@ -2,43 +2,48 @@ class UserInfoModel {
|
||||
UserInfoModel({
|
||||
required this.userId,
|
||||
required this.username,
|
||||
required this.mobile,
|
||||
required this.email,
|
||||
required this.privacy,
|
||||
required this.nickname,
|
||||
required this.avatar,
|
||||
required this.address,
|
||||
});
|
||||
|
||||
String userId;
|
||||
String username;
|
||||
bool privacy;
|
||||
String? mobile;
|
||||
String? email;
|
||||
bool? privacy;
|
||||
String? nickname;
|
||||
String? avatar;
|
||||
String? address;
|
||||
|
||||
factory UserInfoModel.fromJson(Map<String, dynamic> json) => UserInfoModel(
|
||||
userId: json['user_id'].toString(),
|
||||
username: json['username'],
|
||||
mobile: json['mobile'],
|
||||
email: json['email'],
|
||||
privacy: json['privacy'],
|
||||
nickname: json['nickname'],
|
||||
avatar: json['avatar'],
|
||||
address: json['address'],
|
||||
);
|
||||
|
||||
factory UserInfoModel.empty() => UserInfoModel(
|
||||
userId: '',
|
||||
username: '',
|
||||
mobile: '',
|
||||
email: '',
|
||||
privacy: true,
|
||||
nickname: '',
|
||||
avatar: '',
|
||||
address: '',
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"userId": userId,
|
||||
"username": username,
|
||||
"mobile": mobile,
|
||||
"email": email,
|
||||
"privacy": privacy,
|
||||
"nickname": nickname,
|
||||
"avatar": avatar,
|
||||
"address": address,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -72,4 +72,8 @@ class UserProvider {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static Future updateMobile(String mobile) async {}
|
||||
|
||||
static Future updateEmail(String email) async {}
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ class _Search extends StatelessWidget implements PreferredSizeWidget {
|
||||
Text(
|
||||
'我的地址: ' +
|
||||
Convert.hideCenterStr(
|
||||
AuthService.to.userInfo.value.address!,
|
||||
AuthService.to.userInfo.value.username,
|
||||
start: 4,
|
||||
end: 4,
|
||||
),
|
||||
|
||||
@@ -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('地址复制成功');
|
||||
|
||||
@@ -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('刷新密码'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
21
pubspec.lock
21
pubspec.lock
@@ -43,6 +43,13 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
base32:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: base32
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
bip32:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -487,6 +494,13 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: logging
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
lpinyin:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -543,6 +557,13 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.2.1"
|
||||
otp:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: otp
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
package_info_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@@ -52,6 +52,7 @@ dependencies:
|
||||
wechat_camera_picker: ^3.5.0+1
|
||||
filesize: ^2.0.1
|
||||
file_picker: ^4.6.1
|
||||
otp: ^3.1.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user