Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 163 Vote(s) - 3.55 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to show Loading Indicator in WebView Flutter?

#11
**<h3>Complete Example</h3>**

class WebViewState extends State<WebViewScreen>{

String title,url;
bool isLoading=true;
final _key = UniqueKey();

WebViewState(String title,String url){
this.title=title;
this.url=url;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: new AppBar(
title: Text(this.title,style: TextStyle(fontWeight: FontWeight.w700)),centerTitle: true
),
body: Stack(
children: <Widget>[
WebView(
key: _key,
initialUrl: this.url,
javascriptMode: JavascriptMode.unrestricted,
onPageFinished: (finish) {
setState(() {
isLoading = false;
});
},
),
isLoading ? Center( child: CircularProgressIndicator(),)
: Stack(),
],
),
);
}

}
Reply

#12
If anyone stumbles across this using webview_flutter version 4.0.2, we must use the `WebViewController`'s `setNavigationDelegate` and set the onPageFinished callback.


```
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class PrivacyPolicyPage extends StatefulWidget {
static const routeName = "/privacy_policy";

const PrivacyPolicyPage({super.key});

@override
State<PrivacyPolicyPage> createState() => _PrivacyPolicyPageState();
}

class _PrivacyPolicyPageState extends State<PrivacyPolicyPage> {
late final WebViewController _controller;
bool _loading = true;

@override
void initState() {
_controller = WebViewController.fromPlatformCreationParams(
const PlatformWebViewControllerCreationParams())
..setNavigationDelegate(NavigationDelegate(
onPageFinished: (_) => setState(() {
_loading = false;
})))
..setJavaScriptMode(JavaScriptMode.disabled)
..loadFlutterAsset("assets/privacy_policy.html");
super.initState();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Privacy Policy')),
body: Stack(children: [
WebViewWidget(controller: _controller),
if (_loading) const Center(child: CircularProgressIndicator())
]),
);
}
}

```
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through