u
This commit is contained in:
@@ -7,6 +7,7 @@ class UserInfoModel {
|
||||
required this.privacy,
|
||||
required this.nickname,
|
||||
required this.avatar,
|
||||
this.google2fa,
|
||||
});
|
||||
|
||||
String userId;
|
||||
@@ -16,6 +17,7 @@ class UserInfoModel {
|
||||
bool? privacy;
|
||||
String? nickname;
|
||||
String? avatar;
|
||||
bool? google2fa;
|
||||
|
||||
factory UserInfoModel.fromJson(Map<String, dynamic> json) => UserInfoModel(
|
||||
userId: json['user_id'].toString(),
|
||||
@@ -25,6 +27,7 @@ class UserInfoModel {
|
||||
privacy: json['privacy'],
|
||||
nickname: json['nickname'],
|
||||
avatar: json['avatar'],
|
||||
google2fa: json['google2fa'],
|
||||
);
|
||||
|
||||
factory UserInfoModel.empty() => UserInfoModel(
|
||||
@@ -35,15 +38,17 @@ class UserInfoModel {
|
||||
privacy: true,
|
||||
nickname: '',
|
||||
avatar: '',
|
||||
google2fa: false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"userId": userId,
|
||||
"username": username,
|
||||
"mobile": mobile,
|
||||
"email": email,
|
||||
"privacy": privacy,
|
||||
"nickname": nickname,
|
||||
"avatar": avatar,
|
||||
'userId': userId,
|
||||
'username': username,
|
||||
'mobile': mobile,
|
||||
'email': email,
|
||||
'privacy': privacy,
|
||||
'nickname': nickname,
|
||||
'avatar': avatar,
|
||||
'google2fa': google2fa,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:chat/views/user/setting/index_page.dart';
|
||||
import 'package:chat/views/user/setting/message/index_page.dart';
|
||||
import 'package:chat/views/user/setting/privacy/index_page.dart';
|
||||
import 'package:chat/views/user/setting/safe/email_page.dart';
|
||||
import 'package:chat/views/user/setting/safe/google_page.dart';
|
||||
import 'package:chat/views/user/setting/safe/index_page.dart';
|
||||
import 'package:chat/views/user/setting/safe/mobile_page.dart';
|
||||
import 'package:chat/views/user/setting/sugguest/index_page.dart';
|
||||
@@ -28,6 +29,7 @@ abstract class UserRoutes {
|
||||
static const String settingPrivacy = '/user/setting/privacy';
|
||||
static const String settingSafe = '/user/setting/safe';
|
||||
static const String settingSafeEmail = '/user/setting/safe/email';
|
||||
static const String settingSafeGoogle = '/user/setting/safe/google';
|
||||
static const String settingSafeMobile = '/user/setting/safe/mobile';
|
||||
static const String settingSugguest = '/user/setting/sugguest';
|
||||
|
||||
@@ -79,6 +81,10 @@ abstract class UserRoutes {
|
||||
name: '/email',
|
||||
page: () => const UserSettingSafeEmailPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: '/google',
|
||||
page: () => const UserSettingSafeGooglePage(),
|
||||
),
|
||||
GetPage(
|
||||
name: '/mobile',
|
||||
page: () => const UserSettingSafeMobilePage(),
|
||||
|
||||
15
lib/views/user/setting/safe/google_page.dart
Normal file
15
lib/views/user/setting/safe/google_page.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UserSettingSafeGooglePage extends StatelessWidget {
|
||||
const UserSettingSafeGooglePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('UserSettingSafeGooglePage'),
|
||||
),
|
||||
body: Container(),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,16 @@ class _UserSettingSafePageState extends State<UserSettingSafePage> {
|
||||
Get.toNamed(UserRoutes.settingSafeEmail);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
ActionItem(
|
||||
'开启两部验证',
|
||||
extend: (_.userInfo.value.google2fa ?? false) ? '已开启' : '未开启',
|
||||
isFirst: true,
|
||||
isLast: true,
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.settingSafeGoogle);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user