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
b72d1fa9
Commit
b72d1fa9
authored
Apr 17, 2023
by
skeyboy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Android端私人助理页 需要登录才可查看
parent
726abbf8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
8 deletions
+33
-8
lib/pages/application/controller.dart
lib/pages/application/controller.dart
+33
-8
No files found.
lib/pages/application/controller.dart
View file @
b72d1fa9
import
'dart:async'
;
import
'dart:io'
;
// import 'package:vibration/vibration.dart';
import
'package:chart/common/store/user.dart'
;
import
'package:chart/pages/frame/notfound/index.dart'
;
...
...
@@ -15,6 +16,7 @@ import 'package:get/get.dart';
import
'package:speech_to_text/speech_recognition_result.dart'
;
import
'package:speech_to_text/speech_to_text.dart'
;
import
'package:chart/package/chat_dash/dash_chat_2.dart'
as
Chat
;
// import 'package:vibrate/vibrate.dart';
// import 'package:uni_links/uni_links.dart';
...
...
@@ -111,15 +113,38 @@ class ApplicationController extends GetxController {
// tab栏动画
void
handleNavBarTap
(
int
index
)
async
{
// if (await Vibration.hasVibrator() != null) {
// Vibration.vibrate(duration: 10, amplitude: 128);
// }
Vibrate
.
feedback
(
FeedbackType
.
impact
);
try
{
pageController
.
animateToPage
(
index
,
duration:
const
Duration
(
milliseconds:
200
),
curve:
Curves
.
ease
);
}
catch
(
e
)
{
print
(
e
);
if
(!
await
_canHandleNavBar
(
index
))
{
return
;
}
else
{
try
{
pageController
.
animateToPage
(
index
,
duration:
const
Duration
(
milliseconds:
200
),
curve:
Curves
.
ease
);
}
catch
(
e
)
{
print
(
e
);
}
}
}
// 判断是否能够跳转至私人助理页面
Future
<
bool
>
_canHandleNavBar
(
int
index
,{
bool
autoChange
=
true
})
async
{
///私人助手index
int
asssitIndex
=
2
;
// android平台私人助理页需要登录才可以查看
if
(
Platform
.
isAndroid
&&
index
==
asssitIndex
&&
UserStore
.
to
.
isLogin
==
false
)
{
int
prePage
=
state
.
page
;
var
rev
=
await
Get
.
toNamed
(
AppRoutes
.
SIGN_IN
);
if
(
UserStore
.
to
.
isLogin
&&
autoChange
)
{
//返回后判断登录了自动切换到 私人助手 tab
handleNavBarTap
(
index
);
return
true
;
}
else
{
return
false
;
}
}
else
{
return
true
;
}
}
...
...
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