update
This commit is contained in:
@@ -2,43 +2,48 @@ class UserInfoModel {
|
|||||||
UserInfoModel({
|
UserInfoModel({
|
||||||
required this.userId,
|
required this.userId,
|
||||||
required this.username,
|
required this.username,
|
||||||
|
required this.mobile,
|
||||||
|
required this.email,
|
||||||
required this.privacy,
|
required this.privacy,
|
||||||
required this.nickname,
|
required this.nickname,
|
||||||
required this.avatar,
|
required this.avatar,
|
||||||
required this.address,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
String userId;
|
String userId;
|
||||||
String username;
|
String username;
|
||||||
bool privacy;
|
String? mobile;
|
||||||
|
String? email;
|
||||||
|
bool? privacy;
|
||||||
String? nickname;
|
String? nickname;
|
||||||
String? avatar;
|
String? avatar;
|
||||||
String? address;
|
|
||||||
|
|
||||||
factory UserInfoModel.fromJson(Map<String, dynamic> json) => UserInfoModel(
|
factory UserInfoModel.fromJson(Map<String, dynamic> json) => UserInfoModel(
|
||||||
userId: json['user_id'].toString(),
|
userId: json['user_id'].toString(),
|
||||||
username: json['username'],
|
username: json['username'],
|
||||||
|
mobile: json['mobile'],
|
||||||
|
email: json['email'],
|
||||||
privacy: json['privacy'],
|
privacy: json['privacy'],
|
||||||
nickname: json['nickname'],
|
nickname: json['nickname'],
|
||||||
avatar: json['avatar'],
|
avatar: json['avatar'],
|
||||||
address: json['address'],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
factory UserInfoModel.empty() => UserInfoModel(
|
factory UserInfoModel.empty() => UserInfoModel(
|
||||||
userId: '',
|
userId: '',
|
||||||
username: '',
|
username: '',
|
||||||
|
mobile: '',
|
||||||
|
email: '',
|
||||||
privacy: true,
|
privacy: true,
|
||||||
nickname: '',
|
nickname: '',
|
||||||
avatar: '',
|
avatar: '',
|
||||||
address: '',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
Map<String, dynamic> toJson() => {
|
||||||
"userId": userId,
|
"userId": userId,
|
||||||
"username": username,
|
"username": username,
|
||||||
|
"mobile": mobile,
|
||||||
|
"email": email,
|
||||||
"privacy": privacy,
|
"privacy": privacy,
|
||||||
"nickname": nickname,
|
"nickname": nickname,
|
||||||
"avatar": avatar,
|
"avatar": avatar,
|
||||||
"address": address,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,4 +72,8 @@ class UserProvider {
|
|||||||
}
|
}
|
||||||
return null;
|
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(
|
Text(
|
||||||
'我的地址: ' +
|
'我的地址: ' +
|
||||||
Convert.hideCenterStr(
|
Convert.hideCenterStr(
|
||||||
AuthService.to.userInfo.value.address!,
|
AuthService.to.userInfo.value.username,
|
||||||
start: 4,
|
start: 4,
|
||||||
end: 4,
|
end: 4,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -62,8 +62,7 @@ class UserTopBar extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
Convert.hideCenterStr(
|
Convert.hideCenterStr(_.userInfo.value.username),
|
||||||
_.userInfo.value.address ?? ''),
|
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: AppColors.unactive,
|
color: AppColors.unactive,
|
||||||
),
|
),
|
||||||
@@ -73,7 +72,7 @@ class UserTopBar extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Clipboard.setData(
|
Clipboard.setData(
|
||||||
ClipboardData(
|
ClipboardData(
|
||||||
text: _.userInfo.value.address,
|
text: _.userInfo.value.username,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
UiTools.toast('地址复制成功');
|
UiTools.toast('地址复制成功');
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:otp/otp.dart';
|
||||||
|
|
||||||
class UserServeGooglePage extends StatefulWidget {
|
class UserServeGooglePage extends StatefulWidget {
|
||||||
const UserServeGooglePage({Key? key}) : super(key: key);
|
const UserServeGooglePage({Key? key}) : super(key: key);
|
||||||
@@ -8,13 +9,52 @@ class UserServeGooglePage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _UserServeGooglePageState extends State<UserServeGooglePage> {
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('谷歌验证器'),
|
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/app_routes.dart';
|
||||||
import 'package:chat/routes/user_routes.dart';
|
|
||||||
import 'package:chat/views/home/widgets/action_item.dart';
|
import 'package:chat/views/home/widgets/action_item.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -20,15 +19,16 @@ class _UserServePageState extends State<UserServePage> {
|
|||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
ActionItem(
|
// ActionItem(
|
||||||
'谷歌验证器',
|
// '谷歌验证器',
|
||||||
isFirst: true,
|
// isFirst: true,
|
||||||
onTap: () {
|
// onTap: () {
|
||||||
Get.toNamed(UserRoutes.serveGoogle);
|
// Get.toNamed(UserRoutes.serveGoogle);
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
ActionItem(
|
ActionItem(
|
||||||
'扫一扫',
|
'扫一扫',
|
||||||
|
isFirst: true,
|
||||||
isLast: true,
|
isLast: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.toNamed(AppRoutes.scan);
|
Get.toNamed(AppRoutes.scan);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class UserSettingPrivacyPage extends StatelessWidget {
|
|||||||
return LinkActionItem(
|
return LinkActionItem(
|
||||||
title: '允许通过搜索添加我为好友',
|
title: '允许通过搜索添加我为好友',
|
||||||
trailing: Switch(
|
trailing: Switch(
|
||||||
value: _.userInfo.value.privacy,
|
value: _.userInfo.value.privacy ?? true,
|
||||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
onChanged: (e) {
|
onChanged: (e) {
|
||||||
_.togglePrivacy();
|
_.togglePrivacy();
|
||||||
|
|||||||
@@ -21,31 +21,35 @@ class _UserSettingSafePageState extends State<UserSettingSafePage> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('安全设置'),
|
title: const Text('安全设置'),
|
||||||
),
|
),
|
||||||
body: Column(
|
body: GetX<AuthService>(builder: (_) {
|
||||||
children: [
|
return Column(
|
||||||
ActionItem(
|
children: [
|
||||||
'导出助记词',
|
ActionItem(
|
||||||
isFirst: true,
|
'导出助记词',
|
||||||
isLast: true,
|
isFirst: true,
|
||||||
onTap: _showMnemonic,
|
isLast: true,
|
||||||
),
|
onTap: _showMnemonic,
|
||||||
const SizedBox(height: 8),
|
),
|
||||||
ActionItem(
|
const SizedBox(height: 8),
|
||||||
'绑定手机',
|
ActionItem(
|
||||||
isFirst: true,
|
'绑定手机',
|
||||||
onTap: () {
|
extend: _.userInfo.value.mobile ?? '未绑定',
|
||||||
Get.toNamed(UserRoutes.settingSafeMobile);
|
isFirst: true,
|
||||||
},
|
onTap: () {
|
||||||
),
|
Get.toNamed(UserRoutes.settingSafeMobile);
|
||||||
ActionItem(
|
},
|
||||||
'绑定邮箱',
|
),
|
||||||
isLast: true,
|
ActionItem(
|
||||||
onTap: () {
|
'绑定邮箱',
|
||||||
Get.toNamed(UserRoutes.settingSafeEmail);
|
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"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.0.0"
|
||||||
|
base32:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: base32
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.3"
|
||||||
bip32:
|
bip32:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -487,6 +494,13 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.1"
|
version: "1.0.1"
|
||||||
|
logging:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: logging
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.0"
|
||||||
lpinyin:
|
lpinyin:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -543,6 +557,13 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.2.1"
|
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:
|
package_info_plus:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ dependencies:
|
|||||||
wechat_camera_picker: ^3.5.0+1
|
wechat_camera_picker: ^3.5.0+1
|
||||||
filesize: ^2.0.1
|
filesize: ^2.0.1
|
||||||
file_picker: ^4.6.1
|
file_picker: ^4.6.1
|
||||||
|
otp: ^3.1.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user