Skip to content

Commit 345a4f8

Browse files
committed
logout
1 parent 75c88a3 commit 345a4f8

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

‎lib/common/dao/UserDao.dart‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,9 @@ class UserDao {
9494
return new DataResult(res.data, false);
9595
}
9696
}
97+
98+
static clearAll() async {
99+
HttpManager.clearAuthorization();
100+
LocalStorage.remove(Config.USER_INFO);
101+
}
97102
}

‎lib/widget/HomeDrawer.dart‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_redux/flutter_redux.dart';
3+
import 'package:gsy_github_app_flutter/common/dao/UserDao.dart';
34
import 'package:gsy_github_app_flutter/common/model/User.dart';
45
import 'package:gsy_github_app_flutter/common/redux/GSYState.dart';
56
import 'package:gsy_github_app_flutter/common/style/GSYStyle.dart';
7+
import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart';
68

79
/**
810
* 主页drawer
@@ -26,7 +28,7 @@ class HomeDrawer extends StatelessWidget {
2628
style: GSYConstant.largeTextWhite,
2729
),
2830
accountEmail: new Text(
29-
user.email != null ? user.email: user.name,
31+
user.email != null ? user.email : user.name,
3032
style: GSYConstant.subNormalText,
3133
),
3234
//用户名
@@ -46,8 +48,14 @@ class HomeDrawer extends StatelessWidget {
4648
),
4749
new ListTile(
4850
//第一个功能项
49-
title: new Text(GSYStrings.Login_out, style: GSYConstant.normalText,),
50-
onTap: () {}),
51+
title: new Text(
52+
GSYStrings.Login_out,
53+
style: GSYConstant.normalText,
54+
),
55+
onTap: () {
56+
NavigatorUtils.goLogin(context);
57+
UserDao.clearAll();
58+
}),
5159
],
5260
),
5361
);

0 commit comments

Comments
 (0)