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 f4cbcf78
authored
2025-09-10 17:50:19 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加iOS打开测试登录界面
1 parent
62544f85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
10 deletions
lib/bloc/web_cubit.dart
lib/ui/pages/web_page.dart
lib/bloc/web_cubit.dart
View file @
f4cbcf7
...
@@ -72,13 +72,18 @@ class WebCubit extends Cubit<WebState> {
...
@@ -72,13 +72,18 @@ class WebCubit extends Cubit<WebState> {
..
setJavaScriptMode
(
JavaScriptMode
.
unrestricted
)
..
setJavaScriptMode
(
JavaScriptMode
.
unrestricted
)
..
setNavigationDelegate
(
..
setNavigationDelegate
(
NavigationDelegate
(
NavigationDelegate
(
onUrlChange:
(
UrlChange
url
)
{
print
(
'onUrlChange===
${url.url}
'
);
},
onPageStarted:
(
String
url
)
{
// 进行新页面加载时,关闭录音器和播放器,(如果有打开过)
// closeLocalRecorder() ;
// closeLocalPlayer();
},
onPageFinished:
(
String
url
)
{
onPageFinished:
(
String
url
)
{
print
(
"onPageFinished-------------------------
$url
"
);
print
(
"onPageFinished-------------------------
$url
"
);
finishLoading
();
finishLoading
();
},
},
onUrlChange:
(
UrlChange
url
)
{
print
(
'url===
${url.url}
'
);
},
),
),
)
)
..
addJavaScriptChannel
(
"xeJsBridge"
,
onMessageReceived:
_onMessageReceived
);
..
addJavaScriptChannel
(
"xeJsBridge"
,
onMessageReceived:
_onMessageReceived
);
...
@@ -126,7 +131,7 @@ class WebCubit extends Cubit<WebState> {
...
@@ -126,7 +131,7 @@ class WebCubit extends Cubit<WebState> {
}
}
void
finishLoading
()
{
void
finishLoading
()
{
emit
(
state
.
copyWith
(
loaded:
true
,
title:
'
业务首页
'
));
emit
(
state
.
copyWith
(
loaded:
true
,
title:
'
班小二测试H5
'
));
}
}
// 测试
// 测试
...
@@ -144,6 +149,13 @@ class WebCubit extends Cubit<WebState> {
...
@@ -144,6 +149,13 @@ class WebCubit extends Cubit<WebState> {
emit
(
state
.
copyWith
(
needAuth:
true
));
emit
(
state
.
copyWith
(
needAuth:
true
));
}
}
//测试
void
goAuth2
()
{
print
(
"iOS 测试-------------------"
);
String
serverUrl
=
'http://127.0.0.1:
${_server.port}
/index.html'
;
_controller
.
loadRequest
(
Uri
.
parse
(
serverUrl
));
}
@override
@override
Future
<
void
>
close
()
async
{
Future
<
void
>
close
()
async
{
_server
.
close
();
_server
.
close
();
...
...
lib/ui/pages/web_page.dart
View file @
f4cbcf7
...
@@ -31,12 +31,26 @@ class WebPage extends StatelessWidget {
...
@@ -31,12 +31,26 @@ class WebPage extends StatelessWidget {
?
WebViewWidget
(
controller:
context
.
read
<
WebCubit
>().
controller
)
?
WebViewWidget
(
controller:
context
.
read
<
WebCubit
>().
controller
)
:
const
Center
(
child:
CircularProgressIndicator
()),
:
const
Center
(
child:
CircularProgressIndicator
()),
// 用于测试一下点击跳转路由
// 用于测试一下点击跳转路由
floatingActionButton:
FloatingActionButton
(
floatingActionButton:
Column
(
onPressed:
()
{
mainAxisAlignment:
MainAxisAlignment
.
end
,
context
.
read
<
WebCubit
>().
goAuth
();
children:
[
},
FloatingActionButton
(
child:
const
Icon
(
Icons
.
add
),
heroTag:
"btn1"
,
),
onPressed:
()
{
context
.
read
<
WebCubit
>().
goAuth
();
},
child:
const
Icon
(
Icons
.
add
),
),
const
SizedBox
(
height:
16
),
FloatingActionButton
(
heroTag:
"btn2"
,
onPressed:
()
{
context
.
read
<
WebCubit
>().
goAuth2
();
},
child:
const
Icon
(
Icons
.
add_alarm
),
),
]
)
);
);
},
},
listener:
(
context
,
state
)
{
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