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
5f368f69
Commit
5f368f69
authored
Apr 14, 2023
by
skeyboy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复切换tabbar导致用户状态丢失的问题
parent
04afb450
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
247 additions
and
187 deletions
+247
-187
lib/pages/assistant/view.dart
lib/pages/assistant/view.dart
+18
-1
lib/pages/creation/view.dart
lib/pages/creation/view.dart
+21
-1
lib/pages/home/view.dart
lib/pages/home/view.dart
+208
-185
No files found.
lib/pages/assistant/view.dart
View file @
5f368f69
...
@@ -9,7 +9,7 @@ class AssistantPage extends GetView<AssistantController> {
...
@@ -9,7 +9,7 @@ class AssistantPage extends GetView<AssistantController> {
// 主视图
// 主视图
Widget
_buildView
()
{
Widget
_buildView
()
{
return
GridWidget
();
return
_AssistantPage
();
}
}
@override
@override
...
@@ -29,3 +29,20 @@ class AssistantPage extends GetView<AssistantController> {
...
@@ -29,3 +29,20 @@ class AssistantPage extends GetView<AssistantController> {
);
);
}
}
}
}
class
_AssistantPage
extends
StatefulWidget
{
const
_AssistantPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
_AssistantPage
>
createState
()
=>
_AssistantPageState
();
}
class
_AssistantPageState
extends
State
<
_AssistantPage
>
with
AutomaticKeepAliveClientMixin
{
@override
// TODO: implement wantKeepAlive
bool
get
wantKeepAlive
=>
true
;
@override
Widget
build
(
BuildContext
context
)
{
return
GridWidget
();
}
}
lib/pages/creation/view.dart
View file @
5f368f69
...
@@ -9,7 +9,7 @@ class CreationPage extends GetView<CreationController> {
...
@@ -9,7 +9,7 @@ class CreationPage extends GetView<CreationController> {
// 主视图
// 主视图
Widget
_buildView
()
{
Widget
_buildView
()
{
return
GridWidget
();
return
const
_InnerCreationPage
();
// return Obx(() => Center(
// return Obx(() => Center(
// child: InkWell(
// child: InkWell(
// onTap: () => controller.increment(),
// onTap: () => controller.increment(),
...
@@ -40,3 +40,23 @@ class CreationPage extends GetView<CreationController> {
...
@@ -40,3 +40,23 @@ class CreationPage extends GetView<CreationController> {
);
);
}
}
}
}
class
_InnerCreationPage
extends
StatefulWidget
{
const
_InnerCreationPage
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
_InnerCreationPage
>
createState
()
=>
_InnerCreationPageState
();
}
class
_InnerCreationPageState
extends
State
<
_InnerCreationPage
>
with
AutomaticKeepAliveClientMixin
{
/// 防止每次切换之后自动滑动到顶部
@override
bool
get
wantKeepAlive
=>
true
;
@override
Widget
build
(
BuildContext
context
)
{
return
GridWidget
();
}
}
lib/pages/home/view.dart
View file @
5f368f69
...
@@ -23,12 +23,34 @@ class HomePage extends GetView<HomeController> {
...
@@ -23,12 +23,34 @@ class HomePage extends GetView<HomeController> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
cc
=
Get
.
put
(
HomeController
());
return
WillPopScope
(
return
WillPopScope
(
onWillPop:
()
async
{
onWillPop:
()
async
{
return
false
;
return
false
;
},
},
child:
Obx
(()
=>
Scaffold
(
child:
const
_HomePage
());
}
}
class
_HomePage
extends
StatefulWidget
{
const
_HomePage
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
_HomePage
>
createState
()
=>
_HomePageState
();
}
class
_HomePageState
extends
State
<
_HomePage
>
with
AutomaticKeepAliveClientMixin
{
@override
// TODO: implement wantKeepAlive
bool
get
wantKeepAlive
=>
true
;
HomeController
get
controller
=>
Get
.
find
();
@override
Widget
build
(
BuildContext
context
)
{
final
cc
=
Get
.
put
(
HomeController
());
return
Obx
(()
=>
Scaffold
(
resizeToAvoidBottomInset:
false
,
resizeToAvoidBottomInset:
false
,
backgroundColor:
Color
.
fromARGB
(
0
,
0
,
0
,
0
),
backgroundColor:
Color
.
fromARGB
(
0
,
0
,
0
,
0
),
appBar:
transparentAppBar
(
appBar:
transparentAppBar
(
...
@@ -126,7 +148,7 @@ class HomePage extends GetView<HomeController> {
...
@@ -126,7 +148,7 @@ class HomePage extends GetView<HomeController> {
// GradientButton(
// GradientButton(
// child: Icon(Icons.text_fields_sharp), callback: () {}),
// child: Icon(Icons.text_fields_sharp), callback: () {}),
/*Android语音转换文字有问题暂时屏蔽掉*/
/*Android语音转换文字有问题暂时屏蔽掉*/
(
Platform
.
isAndroid
?
Container
()
:
Container
(
(
Platform
.
isAndroid
?
Container
()
:
Container
(
margin:
const
EdgeInsets
.
only
(
right:
10
),
margin:
const
EdgeInsets
.
only
(
right:
10
),
child:
InkWell
(
child:
InkWell
(
borderRadius:
BorderRadius
.
circular
(
100
),
borderRadius:
BorderRadius
.
circular
(
100
),
...
@@ -217,7 +239,8 @@ class HomePage extends GetView<HomeController> {
...
@@ -217,7 +239,8 @@ class HomePage extends GetView<HomeController> {
),
),
),
),
),
),
)));
)
);
}
}
}
}
...
...
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