Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit e7cbb1fd
authored
2025-12-12 12:05:32 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
测试iOS返回的手势操作
1 parent
647c7088
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
80 deletions
lib/ui/pages/web_page.dart
lib/ui/pages/web_page.dart
View file @
e7cbb1f
import
'dart:io'
;
import
'package:appframe/bloc/web_cubit.dart'
;
import
'package:appframe/config/constant.dart'
;
import
'package:appframe/config/evn_config.dart'
;
...
...
@@ -45,87 +43,74 @@ class WebPage extends StatelessWidget {
),
child:
BlocConsumer
<
WebCubit
,
WebState
>(
builder:
(
ctx
,
state
)
{
return
PopScope
(
canPop:
Platform
.
isIOS
,
onPopInvokedWithResult:
(
didPop
,
result
)
{
print
(
"onPopInvokedWithResult---------------------------
$didPop
$result
"
);
if
(
Platform
.
isIOS
)
{
if
(
didPop
)
{
ctx
.
read
<
WebCubit
>().
handleBack
();
}
}
else
{
ctx
.
read
<
WebCubit
>().
handleBack
();
}
},
child:
Scaffold
(
appBar:
_buildAppBar
(
ctx
,
state
),
endDrawer:
_buildDrawer
(
ctx
,
state
),
body:
Stack
(
children:
[
state
.
loaded
?
SizedBox
(
height:
MediaQuery
.
of
(
ctx
).
size
.
height
-
60
,
// 减去100像素留空
child:
WebViewWidget
(
controller:
ctx
.
read
<
WebCubit
>().
controller
),
)
:
const
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
CircularProgressIndicator
(
color:
Color
(
0xFF7691fa
)),
SizedBox
(
height:
16
),
Text
(
'加载中...'
),
],
),
),
// 添加升级遮罩层
if
(
state
.
isUpgrading
)
Container
(
color:
Colors
.
black54
,
child:
const
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
CircularProgressIndicator
(
color:
Color
(
0xFF7691fa
)),
SizedBox
(
height:
16
),
Text
(
'资源更新中...'
,
style:
TextStyle
(
color:
Colors
.
white
)),
],
),
return
Scaffold
(
appBar:
_buildAppBar
(
ctx
,
state
),
endDrawer:
_buildDrawer
(
ctx
,
state
),
body:
Stack
(
children:
[
state
.
loaded
?
SizedBox
(
height:
MediaQuery
.
of
(
ctx
).
size
.
height
-
60
,
// 减去100像素留空
child:
WebViewWidget
(
controller:
ctx
.
read
<
WebCubit
>().
controller
),
)
:
const
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
CircularProgressIndicator
(
color:
Color
(
0xFF7691fa
)),
SizedBox
(
height:
16
),
Text
(
'加载中...'
),
],
),
),
// 添加升级遮罩层
if
(
state
.
isUpgrading
)
Container
(
color:
Colors
.
black54
,
child:
const
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
CircularProgressIndicator
(
color:
Color
(
0xFF7691fa
)),
SizedBox
(
height:
16
),
Text
(
'资源更新中...'
,
style:
TextStyle
(
color:
Colors
.
white
)),
],
),
),
],
),
bottomNavigationBar:
state
.
showBottomNavBar
?
BottomNavigationBar
(
type:
BottomNavigationBarType
.
fixed
,
currentIndex:
state
.
selectedIndex
,
selectedItemColor:
Color
(
0xFF7691fa
),
unselectedItemColor:
Color
(
0xFF969799
),
onTap:
(
index
)
{
// 更新选中索引
ctx
.
read
<
WebCubit
>().
updateSelectedIndex
(
index
);
// 根据 index 执行相应的操作
},
items:
const
[
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
home
,
size:
32
),
label:
'我的班级'
,
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
contact_page
,
size:
32
),
label:
'通讯录'
,
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
find_in_page
,
size:
32
),
label:
'发现'
,
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
person
,
size:
32
),
label:
'我的'
,
),
],
)
:
null
,
),
],
),
bottomNavigationBar:
state
.
showBottomNavBar
?
BottomNavigationBar
(
type:
BottomNavigationBarType
.
fixed
,
currentIndex:
state
.
selectedIndex
,
selectedItemColor:
Color
(
0xFF7691fa
),
unselectedItemColor:
Color
(
0xFF969799
),
onTap:
(
index
)
{
// 更新选中索引
ctx
.
read
<
WebCubit
>().
updateSelectedIndex
(
index
);
// 根据 index 执行相应的操作
},
items:
const
[
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
home
,
size:
32
),
label:
'我的班级'
,
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
contact_page
,
size:
32
),
label:
'通讯录'
,
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
find_in_page
,
size:
32
),
label:
'发现'
,
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
person
,
size:
32
),
label:
'我的'
,
),
],
)
:
null
,
);
},
listener:
(
context
,
state
)
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment