Skip to content

Commit 5ab7b88

Browse files
committed
修改profile_router
1 parent c3197c9 commit 5ab7b88

File tree

5 files changed

+84
-84
lines changed

5 files changed

+84
-84
lines changed

lib/views/profile/account_security/account_security_page.dart

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import 'package:flutter/gestures.dart';
21
import 'package:flutter/material.dart';
3-
import 'package:shared_preferences/shared_preferences.dart';
4-
5-
import 'package:flutter_wechat/constant/cache_key.dart';
2+
import 'package:flutter_wechat/routers/fluro_navigator.dart';
63

74
import 'package:flutter_wechat/model/common/common_item.dart';
85
import 'package:flutter_wechat/model/common/common_group.dart';
96
import 'package:flutter_wechat/model/common/common_footer.dart';
10-
import 'package:flutter_wechat/model/common/common_header.dart';
117

128
import 'package:flutter_wechat/widgets/common/common_group_widget.dart';
139

14-
import 'package:flutter_wechat/views/profile/more_security_setting/more_security_setting_page.dart';
10+
import 'package:flutter_wechat/views/profile/profile_rourer.dart';
1511

1612
/// 账号与安全
1713
class AccountSecurityPage extends StatefulWidget {
@@ -77,11 +73,7 @@ class _AccountSecurityPageState extends State<AccountSecurityPage> {
7773
final moreSecuritySetting = CommonItem(
7874
title: "更多安全设置",
7975
onTap: (_) {
80-
Navigator.of(context).push(new MaterialPageRoute(
81-
builder: (_) {
82-
return MoreSecuritySettingPage();
83-
},
84-
));
76+
NavigatorUtils.push(context, ProfileRouter.moreSecuritySettingPage);
8577
},
8678
);
8779
final group2 = CommonGroup(

lib/views/profile/general/general_page.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ class GeneralPage extends StatelessWidget {
2121
@override
2222
Widget build(BuildContext context) {
2323
return Scaffold(
24-
appBar: AppBar(
25-
title: Text('通用'),
26-
),
27-
body: Container(
28-
child: _buildChildWidget(context),
29-
));
24+
appBar: AppBar(
25+
title: Text('通用'),
26+
),
27+
body: Container(
28+
child: _buildChildWidget(context),
29+
),
30+
);
3031
}
3132

3233
// 跳转设置语言

lib/views/profile/message_notify/message_notify_page.dart

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import 'package:flutter/material.dart';
22

33
import 'package:flutter_wechat/constant/cache_key.dart';
4-
import 'package:flutter_wechat/constant/constant.dart';
54

65
import 'package:flutter_wechat/model/common/common_item.dart';
76
import 'package:flutter_wechat/model/common/common_group.dart';
87
import 'package:flutter_wechat/model/common/common_header.dart';
9-
import 'package:flutter_wechat/model/common/common_footer.dart';
108

119
import 'package:flutter_wechat/widgets/common/common_group_widget.dart';
1210

@@ -16,12 +14,13 @@ class MessageNotifyPage extends StatelessWidget {
1614
@override
1715
Widget build(BuildContext context) {
1816
return Scaffold(
19-
appBar: AppBar(
20-
title: Text('新消息通知'),
21-
),
22-
body: Container(
23-
child: _buildChildWidget(context),
24-
));
17+
appBar: AppBar(
18+
title: Text('新消息通知'),
19+
),
20+
body: Container(
21+
child: _buildChildWidget(context),
22+
),
23+
);
2524
}
2625

2726
/// 配置数据

lib/views/profile/profile_rourer.dart

Lines changed: 55 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ import 'package:flutter_wechat/views/profile/account_security/account_security_p
77
import 'package:flutter_wechat/views/profile/general/general_page.dart';
88
import 'package:flutter_wechat/views/profile/message_notify/message_notify_page.dart';
99
import 'package:flutter_wechat/views/profile/privates/privates_page.dart';
10+
import 'package:flutter_wechat/views/profile/more_security_setting/more_security_setting_page.dart';
11+
import 'package:flutter_wechat/views/profile/chat_background/chat_background_page.dart';
12+
import 'package:flutter_wechat/views/profile/discover_manager/discover_manager_page.dart';
13+
import 'package:flutter_wechat/views/profile/resource/resource_page.dart';
14+
import 'package:flutter_wechat/views/profile/chat_record_backup/chat_record_backup.dart';
15+
1016
import 'profile_page.dart';
1117

1218
class ProfileRouter implements IRouterProvider {
@@ -31,6 +37,20 @@ class ProfileRouter implements IRouterProvider {
3137
/// 通用
3238
static String generalPage = "/profile/general";
3339

40+
/// 更多安全设置
41+
static String moreSecuritySettingPage = "/profile/more-security-setting";
42+
43+
/// 聊天背景
44+
static String chatBackgroundPage = "/profile/chat-background";
45+
46+
/// 照片、视频和文件
47+
static String resourcePage = "/profile/resource";
48+
49+
/// 发现页管理
50+
static String discoverManagerPage = "/profile/discover-manager";
51+
52+
/// 聊天记录备份与迁移
53+
static String chatRecordBackupPage = "/profile/chat-record-backup";
3454
@override
3555
void initRouter(Router router) {
3656
// 我root页
@@ -43,28 +63,40 @@ class ProfileRouter implements IRouterProvider {
4363
settingPage,
4464
handler: Handler(handlerFunc: (_, params) => SettingPage()),
4565
);
46-
router.define(aboutUsPage,
47-
handler: Handler(handlerFunc: (_, params) => AboutUsPage()));
48-
router.define(accountSecurityPage,
49-
handler: Handler(handlerFunc: (_, params) => AccountSecurityPage()));
50-
router.define(messageNotifyPage,
51-
handler: Handler(handlerFunc: (_, params) => MessageNotifyPage()));
52-
router.define(privatesPage,
53-
handler: Handler(handlerFunc: (_, params) => PrivatesPage()));
54-
router.define(generalPage,
55-
handler: Handler(handlerFunc: (_, params) => GeneralPage()));
56-
// router.define(phoneLoginPage, handler: Handler(handlerFunc: (_, params) {
57-
// final String phone = params['phone']?.first;
58-
// final String zoneCode = params['zone_code']?.first;
59-
// return PhoneLoginPage(
60-
// phone: phone,
61-
// zoneCode: zoneCode,
62-
// );
63-
// }));
64-
// router.define(languagePickerPage,
65-
// handler: Handler(handlerFunc: (_, params) {
66-
// final String language = params['language']?.first;
67-
// return LanguagePickerPage(value: language);
68-
// }));
66+
// 关于微信
67+
router.define(
68+
aboutUsPage,
69+
handler: Handler(handlerFunc: (_, params) => AboutUsPage()),
70+
);
71+
// 账号与安全
72+
router.define(
73+
accountSecurityPage,
74+
handler: Handler(handlerFunc: (_, params) => AccountSecurityPage()),
75+
);
76+
// 新消息通知
77+
router.define(
78+
messageNotifyPage,
79+
handler: Handler(handlerFunc: (_, params) => MessageNotifyPage()),
80+
);
81+
// 隐私
82+
router.define(
83+
privatesPage,
84+
handler: Handler(handlerFunc: (_, params) => PrivatesPage()),
85+
);
86+
// 通用
87+
router.define(
88+
generalPage,
89+
handler: Handler(handlerFunc: (_, params) => GeneralPage()),
90+
);
91+
// 更多安全设置
92+
router.define(
93+
moreSecuritySettingPage,
94+
handler: Handler(handlerFunc: (_, params) => MoreSecuritySettingPage()),
95+
);
96+
// 聊天背景
97+
router.define(
98+
chatBackgroundPage,
99+
handler: Handler(handlerFunc: (_, params) => ChatBackgroundPage()),
100+
);
69101
}
70102
}

lib/views/profile/setting/setting_page.dart

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'package:fluro/fluro.dart';
22
import 'package:flutter/material.dart';
33

4-
import 'package:flutter_wechat/constant/constant.dart';
54
import 'package:flutter_wechat/model/common/common_item.dart';
65
import 'package:flutter_wechat/model/common/common_group.dart';
76

@@ -13,11 +12,6 @@ import 'package:flutter_wechat/widgets/common/common_group_widget.dart';
1312
import 'package:flutter_wechat/components/action_sheet/action_sheet.dart';
1413
import 'package:flutter_wechat/widgets/loading_dialog/loading_dialog.dart';
1514

16-
import 'package:flutter_wechat/views/profile/general/general_page.dart';
17-
import 'package:flutter_wechat/views/profile/message_notify/message_notify_page.dart';
18-
import 'package:flutter_wechat/views/profile/privates/privates_page.dart';
19-
import 'package:flutter_wechat/views/profile/account_security/account_security_page.dart';
20-
2115
import 'package:flutter_wechat/utils/service/account_service.dart';
2216

2317
class SettingPage extends StatelessWidget {
@@ -42,13 +36,7 @@ class SettingPage extends StatelessWidget {
4236
final accountSecurity = CommonItem(
4337
title: '账号与安全',
4438
onTap: (_) {
45-
Navigator.of(context).push(
46-
new MaterialPageRoute(
47-
builder: (_) {
48-
return AccountSecurityPage();
49-
},
50-
),
51-
);
39+
NavigatorUtils.push(context, ProfileRouter.accountSecurityPage);
5240
},
5341
);
5442
final group0 = CommonGroup(
@@ -58,35 +46,23 @@ class SettingPage extends StatelessWidget {
5846
// group1
5947
// 新消息通知
6048
final messageNotify = CommonItem(
61-
title: "新消息通知",
62-
onTap: (_) {
63-
Navigator.of(context).push(new MaterialPageRoute(
64-
builder: (_) {
65-
return MessageNotifyPage();
66-
},
67-
));
68-
});
49+
title: "新消息通知",
50+
onTap: (_) {
51+
NavigatorUtils.push(context, ProfileRouter.messageNotifyPage);
52+
},
53+
);
6954
// 隐私
7055
final privates = CommonItem(
71-
title: "隐私",
72-
onTap: (_) {
73-
Navigator.of(context).push(new MaterialPageRoute(
74-
builder: (_) {
75-
return PrivatesPage();
76-
},
77-
));
78-
});
56+
title: "隐私",
57+
onTap: (_) {
58+
NavigatorUtils.push(context, ProfileRouter.privatesPage);
59+
},
60+
);
7961
// 通用
8062
final general = CommonItem(
8163
title: "通用",
8264
onTap: (_) {
83-
Navigator.of(context).push(
84-
new MaterialPageRoute(
85-
builder: (_) {
86-
return GeneralPage();
87-
},
88-
),
89-
);
65+
NavigatorUtils.push(context, ProfileRouter.generalPage);
9066
},
9167
);
9268
final group1 = CommonGroup(

0 commit comments

Comments
 (0)