gpt4 book ai didi

android - Flutter Webview 在点击功能的抽屉导航中不起作用

转载 作者:行者123 更新时间:2023-11-29 05:14:31 24 4
gpt4 key购买 nike

我正在尝试在flutter中使用webview,在抽屉导航列表项的onclick方法上使用它。但没有成功。我使用的代码是,

onclick(){ 
webview(
initalurl: 'hhtp//www.google.com'
)
}

如果有人可以帮助我,请。

最佳答案

Here is the Code, I have used Navigator rather than Webview just because that was not working. I have used at one place where you can see the way I was using Webiew in Drawer Navigator .
class BottomNavBar extends StatefulWidget {
@override
_BottomNavBarState createState() => _BottomNavBarState();
}

class _BottomNavBarState extends State<BottomNavBar> {
int _page = 0;
GlobalKey _bottomNavigationKey = GlobalKey();
// ignore: non_constant_identifier_names
final Tab=[
WebViewContainer('https://panel.islamlive.app'),
messages(),
WebViewContainer('https://panel.islamlive.app/my-account/all-notifications/'),
dashbord(),
WebViewContainer('https://panel.islamlive.app/user/buyer/'),
];
@override

@override
Widget build(BuildContext context) {
void page(){
Navigator.of(context).pop();
Navigator.push(context,
new MaterialPageRoute(builder: (context) => homrpage()));
}
return Scaffold(
appBar: AppBar(title: Image(image: AssetImage('assets/logo.png')),backgroundColor: Colors.lightGreen,),
body: Tab[_page],
drawer: new Drawer(
elevation: 3.0,
child: ListView(
children: <Widget>[
ListTile(
title: Text("List New Service"),
trailing: new Icon(Icons.local_laundry_service),
onTap:()=>{
WebView(initialUrl: 'https://panel.islamlive.app',)
// Navigator.push(context, new MaterialPageRoute(builder: (context)=>ListNewService()))
}
),
new Divider(),
ListTile(
title: Text("Manage Listings"),
trailing: new Icon(Icons.hearing),
onTap: ()=>{
Navigator.push(context, new MaterialPageRoute(builder: (context)=>ManageListning()))
},
),
new Divider(),
ListTile(
title: Text('Manage Calendar'),
trailing: new Icon(Icons.calendar_today),
onTap: ()=>{
Navigator.push(context, new MaterialPageRoute(builder: (context)=>ManageCalender()))
},
),
new Divider(),
ListTile(
title: Text("Service Requests"),
trailing: new Icon(Icons.room_service),
onTap: ()=>{
Navigator.push(context,new MaterialPageRoute(builder: (context)=>ServiceRequest()))
},
),
new Divider(),
ListTile(
title: Text("Confirmed Appointments"),
trailing: new Icon(Icons.confirmation_number),
onTap: ()=>{
Navigator.push(context,new MaterialPageRoute(builder: (context)=>CconfirmedAppointment()))
},
),
new Divider(),
ListTile(
title: Text("Pending Confirmation"),
trailing: new Icon(Icons.today),
onTap: ()=>{
Navigator.push(context,new MaterialPageRoute(builder: (context)=>PendingConfirmation()))
},
),
new Divider(),
ListTile(
title: Text("Earnings"),
trailing: new Icon(Icons.work),
onTap: ()=>{
Navigator.push(context,new MaterialPageRoute(builder: (context)=>Earnings()))
},
),
ListTile(
title: Text("Student Menu"),
subtitle: Text("Post Service Request"),
trailing: new Icon(Icons.directions_run),
onTap: ()=>{
Navigator.push(context,new MaterialPageRoute(builder: (context)=>StudentMenu()))
},
),
new Divider(),
ListTile(
title: Text("Transactions"),
trailing: new Icon(Icons.transit_enterexit),
onTap: ()=>{
Navigator.push(context,new MaterialPageRoute(builder: (context)=>Transactions()))
},
),
new Divider(),
ListTile(
title: Text("My Favorites"),
trailing: new Icon(Icons.favorite),
onTap: ()=>{
Navigator.push(context,new MaterialPageRoute(builder: (context)=>MyFavorite()))
},
),
new Divider(),
ListTile(
title: Text("Settings"),
trailing: new Icon(Icons.settings),
onTap: ()=>{
Navigator.push(context,new MaterialPageRoute(builder: (context)=>Settings()))
},
),
new Divider(),
ListTile(
title: Text("Logout"),
trailing: new Icon(Icons.exit_to_app),
onTap: ()=>{
WebView(
initialUrl: 'https://panel.islamlive.app/wp-login.php?action=logout&redirect_to=https%3A%2F%2Fpanel.islamlive.app&_wpnonce=8f283f4fe9',
)
},
),
],
),
),
bottomNavigationBar: CurvedNavigationBar(
key: _bottomNavigationKey,
index: _page,
height: 40.0,
items: <Widget>[
Icon(Icons.home, size: 30),
Icon(Icons.message, size: 30),
Icon(Icons.notifications_active, size: 30),
Icon(Icons.dashboard, size: 30),
Icon(Icons.verified_user, size: 30),
],
color: Colors.lightGreen,
buttonBackgroundColor: Colors.lightGreen,
backgroundColor: Colors.white,
animationCurve: Curves.easeInOut,
animationDuration: Duration(milliseconds: 200),
onTap: (index) {
setState(() {
_page = index;
});
},
),
);
}
}

关于android - Flutter Webview 在点击功能的抽屉导航中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59316954/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com