控制网页网址的全部跳转

This commit is contained in:
WoNiu 2024-04-07 16:05:30 +08:00
parent 172e30b2a3
commit 99ab6695a9
1 changed files with 45 additions and 18 deletions

View File

@ -223,14 +223,34 @@ class _ShowWebWidgetState extends State<ShowWebWidget> {
input() {
return Row(
children: [
SizedBox(width: 400, child: TextField(style: const TextStyle(fontSize: 14),controller: urlController,)),
TextButton(onPressed: (){
SizedBox(
width: 400,
child: TextField(
style: const TextStyle(fontSize: 14),
controller: urlController,
)),
TextButton(
onPressed: () {
String url = urlController.text;
// if (!url.startsWith("https://") ) {
// url = "https://$url";
// }
widget.controller.loadUrl(url);
}, child: const Text('跳转',style: TextStyle(fontSize: 14),))
},
child: const Text(
'跳转',
style: TextStyle(fontSize: 14),
)),
TextButton(
onPressed: () {
String url = urlController.text;
widget.allLoadUrl(url);
},
child: const Text(
'全部跳转',
style: TextStyle(fontSize: 14),
)),
],
);
}
@ -239,15 +259,22 @@ class _ShowWebWidgetState extends State<ShowWebWidget> {
ipController.text = SocketUtils.getInstance().url;
return Row(
children: [
SizedBox(width: 100, child: TextField(style: const TextStyle(fontSize: 14),controller: ipController,)),
TextButton(onPressed: (){
SizedBox(
width: 100,
child: TextField(
style: const TextStyle(fontSize: 14),
controller: ipController,
)),
TextButton(
onPressed: () {
SocketUtils.getInstance().url = ipController.text;
SocketUtils.getInstance().connect();
}, child: const Text('保存服务器ip',style: TextStyle(fontSize: 14),))
},
child: const Text(
'保存服务器ip',
style: TextStyle(fontSize: 14),
))
],
);
}
}