"multiple webview in flutter" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "multiple webview in flutter" answered properly. Developers are finding an appropriate answer about multiple webview in flutter related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like multiple webview in flutter. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on multiple webview in flutter.
multiple webview in flutter
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
class Home extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _HomeState();
}
}
class _HomeState extends State<Home> {
final _key = UniqueKey();
bool _isLoadingPage;
WebViewController controller;
int _selectedIndex = 0;
List<String> arr_links = [
'https://pub.dev/',
'https://flutter.io',
'https://www.google.com/',
];
@override
void initState() {
super.initState();
_isLoadingPage = true;
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Multiple WebView'),
),
body: Stack(
children: <Widget>[
WebView(
key: _key,
initialUrl: arr_links[_selectedIndex],
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) {
controller = webViewController;
},
onPageFinished: (finish) {
setState(() {
_isLoadingPage = false;
});
},
),
_isLoadingPage ? Scaffold(
body: Center(
child: CircularProgressIndicator(
valueColor: new AlwaysStoppedAnimation<Color>(
Colors.white),
),
),
backgroundColor: Colors.black.withOpacity(
0.70), // this is the main reason of transparency at next screen. I am ignoring rest implementation but what i have achieved is you can see.
) : Stack()
],
),
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: Text('Home'),
),
BottomNavigationBarItem(
icon: Icon(Icons.business),
title: Text('Business'),
),
BottomNavigationBarItem(
icon: Icon(Icons.school),
title: Text('School'),
),
],
currentIndex: _selectedIndex,
onTap: _onItemTapped,
),
);
}
void _onItemTapped(int index) {
setState(() {
_selectedIndex = index;
_isLoadingPage = true;
controller.loadUrl(arr_links[_selectedIndex]);
});
}
}
Source: stackoverflow.com
All those coders who are working on the Whatever based application and are stuck on multiple webview in flutter can get a collection of related answers to their query. Programmers need to enter their query on multiple webview in flutter related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about multiple webview in flutter for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of multiple webview in flutter while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "multiple webview in flutter". Visit this developer's friendly online web community, CodeProZone, and get your queries like multiple webview in flutter resolved professionally and stay updated to the latest Whatever updates.