Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
ChatGPT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
关振斌
ChatGPT
Commits
5487a56b
Commit
5487a56b
authored
Apr 13, 2023
by
skeyboy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登出功能
parent
2aff02c7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
2 deletions
+63
-2
lib/common/store/user.dart
lib/common/store/user.dart
+13
-1
lib/pages/my/view.dart
lib/pages/my/view.dart
+9
-1
pubspec.lock
pubspec.lock
+40
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
lib/common/store/user.dart
View file @
5487a56b
...
...
@@ -12,6 +12,7 @@ import 'package:chart/pages/application/index.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'package:get/get.dart'
;
// import 'package:connectivity_plus/connectivity_plus.dart';
// import 'package:highlight/languages/rust.dart';
// import 'package:social_login_buttons/social_login_buttons.dart';
...
...
@@ -28,16 +29,20 @@ class UserStore extends GetxController {
// static StorageService get to => Get.put(StorageService());
// 是否登录
final
_isLogin
=
false
.
obs
;
late
final
_isLogin
=
false
.
obs
;
// 令牌 token
String
token
=
''
;
// 用户 profile
final
_profile
=
IntegralEntity
(
id:
''
,
token:
''
,
username:
''
,
integral:
0
,
expireTime:
null
)
.
obs
;
bool
get
isLogin
=>
_isLogin
.
value
;
IntegralEntity
get
profile
=>
_profile
.
value
;
bool
get
hasToken
=>
token
.
isNotEmpty
;
@override
...
...
@@ -104,6 +109,12 @@ class UserStore extends GetxController {
}
}
void
logout
()
{
_profile
.
value
=
IntegralEntity
(
id:
''
,
token:
''
,
username:
''
,
integral:
0
,
expireTime:
null
);
_isLogin
.
value
=
false
;
}
Future
refreshInfo
()
async
{
if
(
GetPlatform
.
isIOS
)
{
IosDeviceInfo
iosInfo
=
await
deviceInfo
.
iosInfo
;
...
...
@@ -198,6 +209,7 @@ class UserStore extends GetxController {
StorageService
.
to
.
setString
(
STORAGE_USER_PROFILE_KEY
,
jsonEncode
(
copiedMap
));
}
// // 保存 profile
// Future<void> saveProfile(UserLoginResponseEntity profile) async {
// _isLogin.value = true;
...
...
lib/pages/my/view.dart
View file @
5487a56b
import
'package:bruno/bruno.dart'
;
import
'package:chart/common/routers/routes.dart'
;
import
'package:chart/common/store/store.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -29,7 +30,8 @@ class MyPage extends GetView<MyController> {
alignment:
Alignment
.
center
,
child:
Container
(
// color: Colors.amber,
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
,
vertical:
0
),
padding:
EdgeInsets
.
symmetric
(
horizontal:
20
,
vertical:
0
),
child:
RichText
(
textAlign:
TextAlign
.
center
,
text:
TextSpan
(
children:
[
...
...
@@ -180,6 +182,12 @@ class MyPage extends GetView<MyController> {
),
),
),
UserStore
.
to
.
isLogin
?
Column
(
children:
[
SizedBox
(
height:
145
,),
BrnBigMainButton
(
title:
"退出"
,
onTap:
()
{
UserStore
.
to
.
logout
();
Get
.
back
();
})],)
:
Container
()
// GradientButton(child: Text("321"), callback: () {})
],
);
...
...
pubspec.lock
View file @
5487a56b
...
...
@@ -81,6 +81,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.5+1"
bindings_compatible:
dependency: transitive
description:
name: bindings_compatible
sha256: "5dd5189f7512aff8ec180a8a11bd59230aa34a2d743e65e427192b7292a78d87"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
boolean_selector:
dependency: transitive
description:
...
...
@@ -89,6 +97,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.1"
bruno:
dependency: "direct main"
description:
name: bruno
sha256: "18866ef04d470876dc2434eb44c2ec3c2213ef354f734f8f99cfabee93fd4027"
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.3.0"
bubble:
dependency: "direct main"
description:
...
...
@@ -973,6 +989,14 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.1"
lpinyin:
dependency: transitive
description:
name: lpinyin
sha256: "0bb843363f1f65170efd09fbdfc760c7ec34fc6354f9fcb2f89e74866a0d814a"
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.3"
markdown:
dependency: transitive
description:
...
...
@@ -1069,6 +1093,22 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.2"
path_drawing:
dependency: transitive
description:
name: path_drawing
sha256: bbb1934c0cbb03091af082a6389ca2080345291ef07a5fa6d6e078ba8682f977
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
path_parsing:
dependency: transitive
description:
name: path_parsing
sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
path_provider:
dependency: "direct main"
description:
...
...
pubspec.yaml
View file @
5487a56b
...
...
@@ -127,6 +127,7 @@ dependencies:
custom_pop_up_menu
:
^1.2.4
speech_to_text
:
^6.1.1
flutter_persistent_keyboard_height
:
^1.0.5
bruno
:
^3.3.0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment