个人中心完善页面路由
This commit is contained in:
@@ -3,9 +3,12 @@ import 'package:chat/views/contact/index/index_page.dart';
|
||||
import 'package:chat/views/user/info/index_page.dart';
|
||||
import 'package:chat/views/user/info/nickname_page.dart';
|
||||
import 'package:chat/views/user/qr_code/index_page.dart';
|
||||
import 'package:chat/views/user/safe/index_page.dart';
|
||||
import 'package:chat/views/user/serve/index_page.dart';
|
||||
import 'package:chat/views/user/setting/about/index_page.dart';
|
||||
import 'package:chat/views/user/setting/index_page.dart';
|
||||
import 'package:chat/views/user/setting/privacy/index_page.dart';
|
||||
import 'package:chat/views/user/setting/safe/index_page.dart';
|
||||
import 'package:chat/views/user/setting/sugguest/index_page.dart';
|
||||
import 'package:chat/views/user/share/index_page.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -13,11 +16,18 @@ abstract class UserRoutes {
|
||||
/// 身份验证页面
|
||||
static const String index = '/user';
|
||||
static const String qrCode = '/user/qrCode';
|
||||
|
||||
static const String setting = '/user/setting';
|
||||
static const String settingPrivacy = '/user/setting/privacy';
|
||||
static const String settingAbout = '/user/setting/about';
|
||||
static const String settingSafe = '/user/setting/safe';
|
||||
static const String settingSugguest = '/user/setting/sugguest';
|
||||
|
||||
static const String share = '/user/share';
|
||||
static const String safe = '/user/safe';
|
||||
|
||||
static const String info = '/user/info';
|
||||
static const String infoNickname = '/user/info/nickname';
|
||||
|
||||
static const String serve = '/user/serve';
|
||||
|
||||
static GetPage router = GetPage(
|
||||
@@ -38,10 +48,24 @@ abstract class UserRoutes {
|
||||
GetPage(
|
||||
name: '/setting',
|
||||
page: () => const UserSettingPage(),
|
||||
children: [
|
||||
GetPage(
|
||||
name: '/about',
|
||||
page: () => const UserSettingAboutPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: '/rivacy',
|
||||
page: () => const UserSettingPrivacyPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: '/safe',
|
||||
page: () => const UserSafePage(),
|
||||
page: () => const UserSettingSafePage(),
|
||||
),
|
||||
GetPage(
|
||||
name: '/sugguest',
|
||||
page: () => const UserSettingSugguestPage(),
|
||||
),
|
||||
],
|
||||
),
|
||||
GetPage(
|
||||
name: '/info',
|
||||
|
||||
@@ -55,6 +55,7 @@ class AuthService extends GetxService {
|
||||
var result = await AuthProvider.login(address);
|
||||
|
||||
if (result != null) {
|
||||
_box.write('mnemonic', mnemonic);
|
||||
_box.write('userId', result.userID);
|
||||
_box.write('userSig', result.userSig);
|
||||
_box.write('userToken', result.userToken);
|
||||
@@ -82,6 +83,9 @@ class AuthService extends GetxService {
|
||||
_box.remove('userSig');
|
||||
_box.remove('userId');
|
||||
_box.remove('userToken');
|
||||
_box.remove('mnemonic');
|
||||
_box.remove('userInfo');
|
||||
|
||||
userSig = '';
|
||||
userId = '';
|
||||
userToken = '';
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UserSafePage extends StatefulWidget {
|
||||
const UserSafePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<UserSafePage> createState() => _UserSafePageState();
|
||||
}
|
||||
|
||||
class _UserSafePageState extends State<UserSafePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('安全设置'),
|
||||
),
|
||||
body: Container(),
|
||||
);
|
||||
}
|
||||
}
|
||||
15
lib/views/user/setting/about/index_page.dart
Normal file
15
lib/views/user/setting/about/index_page.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UserSettingAboutPage extends StatefulWidget {
|
||||
const UserSettingAboutPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_UserSettingAboutPageState createState() => _UserSettingAboutPageState();
|
||||
}
|
||||
|
||||
class _UserSettingAboutPageState extends State<UserSettingAboutPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:chat/configs/app_colors.dart';
|
||||
import 'package:chat/routes/user_routes.dart';
|
||||
import 'package:chat/services/auth_service.dart';
|
||||
@@ -25,7 +26,7 @@ class _UserSettingPageState extends State<UserSettingPage> {
|
||||
ActionItem(
|
||||
'账号与安全',
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.safe);
|
||||
Get.toNamed(UserRoutes.settingSafe);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
@@ -40,7 +41,7 @@ class _UserSettingPageState extends State<UserSettingPage> {
|
||||
ActionItem(
|
||||
'新消息通知',
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.safe);
|
||||
Get.toNamed(UserRoutes.settingSafe);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
@@ -51,7 +52,7 @@ class _UserSettingPageState extends State<UserSettingPage> {
|
||||
ActionItem(
|
||||
'隐私权限',
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.safe);
|
||||
Get.toNamed(UserRoutes.settingPrivacy);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
@@ -62,7 +63,7 @@ class _UserSettingPageState extends State<UserSettingPage> {
|
||||
ActionItem(
|
||||
'关于ZH-CHAT',
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.safe);
|
||||
Get.toNamed(UserRoutes.settingAbout);
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
@@ -73,7 +74,7 @@ class _UserSettingPageState extends State<UserSettingPage> {
|
||||
ActionItem(
|
||||
'帮助与反馈',
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.safe);
|
||||
Get.toNamed(UserRoutes.settingSugguest);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
@@ -83,9 +84,7 @@ class _UserSettingPageState extends State<UserSettingPage> {
|
||||
),
|
||||
ActionItem(
|
||||
'版本更新',
|
||||
onTap: () {
|
||||
Get.toNamed(UserRoutes.safe);
|
||||
},
|
||||
onTap: () {},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
@@ -100,7 +99,18 @@ class _UserSettingPageState extends State<UserSettingPage> {
|
||||
'退出',
|
||||
color: AppColors.primary,
|
||||
onTap: () async {
|
||||
OkCancelResult result = await showOkCancelAlertDialog(
|
||||
style: AdaptiveStyle.iOS,
|
||||
context: context,
|
||||
title: '退出登录',
|
||||
message: '确认您已备份助记词并保存好了么?退出登录后助记词将无法导出。',
|
||||
okLabel: '确定',
|
||||
cancelLabel: '取消',
|
||||
defaultType: OkCancelAlertDefaultType.cancel,
|
||||
);
|
||||
if (result == OkCancelResult.ok) {
|
||||
AuthService.to.logout();
|
||||
}
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
|
||||
15
lib/views/user/setting/privacy/index_page.dart
Normal file
15
lib/views/user/setting/privacy/index_page.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UserSettingPrivacyPage extends StatefulWidget {
|
||||
const UserSettingPrivacyPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_UserSettingPrivacyPageState createState() => _UserSettingPrivacyPageState();
|
||||
}
|
||||
|
||||
class _UserSettingPrivacyPageState extends State<UserSettingPrivacyPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
55
lib/views/user/setting/safe/index_page.dart
Normal file
55
lib/views/user/setting/safe/index_page.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
import 'package:chat/configs/app_colors.dart';
|
||||
import 'package:chat/views/home/widgets/action_item.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UserSettingSafePage extends StatefulWidget {
|
||||
const UserSettingSafePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<UserSettingSafePage> createState() => _UserSettingSafePageState();
|
||||
}
|
||||
|
||||
class _UserSettingSafePageState extends State<UserSettingSafePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('安全设置'),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
ActionItem(
|
||||
'导出助记词',
|
||||
onTap: () {},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
ActionItem(
|
||||
'绑定手机',
|
||||
onTap: () {},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
indent: 16,
|
||||
color: AppColors.border,
|
||||
),
|
||||
ActionItem(
|
||||
'绑定邮箱',
|
||||
onTap: () {},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
color: AppColors.border,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
16
lib/views/user/setting/sugguest/index_page.dart
Normal file
16
lib/views/user/setting/sugguest/index_page.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UserSettingSugguestPage extends StatefulWidget {
|
||||
const UserSettingSugguestPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_UserSettingSugguestPageState createState() =>
|
||||
_UserSettingSugguestPageState();
|
||||
}
|
||||
|
||||
class _UserSettingSugguestPageState extends State<UserSettingSugguestPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user