Commit f4cbcf78 by tanghuan

增加iOS打开测试登录界面

1 parent 62544f85
......@@ -72,13 +72,18 @@ class WebCubit extends Cubit<WebState> {
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(
NavigationDelegate(
onUrlChange: (UrlChange url) {
print('onUrlChange===${url.url}');
},
onPageStarted: (String url) {
// 进行新页面加载时,关闭录音器和播放器,(如果有打开过)
// closeLocalRecorder() ;
// closeLocalPlayer();
},
onPageFinished: (String url) {
print("onPageFinished-------------------------$url");
finishLoading();
},
onUrlChange: (UrlChange url) {
print('url===${url.url}');
},
),
)
..addJavaScriptChannel("xeJsBridge", onMessageReceived: _onMessageReceived);
......@@ -126,7 +131,7 @@ class WebCubit extends Cubit<WebState> {
}
void finishLoading() {
emit(state.copyWith(loaded: true, title: '业务首页'));
emit(state.copyWith(loaded: true, title: '班小二测试H5'));
}
// 测试
......@@ -144,6 +149,13 @@ class WebCubit extends Cubit<WebState> {
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
Future<void> close() async {
_server.close();
......
......@@ -31,12 +31,26 @@ class WebPage extends StatelessWidget {
? WebViewWidget(controller: context.read<WebCubit>().controller)
: const Center(child: CircularProgressIndicator()),
// 用于测试一下点击跳转路由
floatingActionButton: FloatingActionButton(
onPressed: () {
context.read<WebCubit>().goAuth();
},
child: const Icon(Icons.add),
),
floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
FloatingActionButton(
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) {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!